Problem
Currently, when toggling a switch in BarKeeper (which triggers On/Off scripts), the process runs asynchronously and updates itself only once the action completes. However, there is no direct feedback to the user regarding the completion or failure of these actions unless they actively check the UI. This can reduce usability, especially if an action takes a while and the user switches to other tasks.
Proposed Solution: Notification Center Integration
Integrate BarKeeper with macOS's native Notification Center so that a push notification is sent to the user whenever a toggle action completes—regardless of success or error. This ensures the user is promptly notified of:
- Successful actions (e.g., action started or stopped)
- Failed actions (with error details)
Implementation Instructions
-
Notification Service Abstraction
- Implement a
NotificationService as an injectable/service class responsible for all notifications.
- Ensure the service is generic and can be reused by other (upcoming) components.
-
Using macOS Notification Center
- Use the
UNUserNotificationCenter or execute an AppleScript via a shell command (for CLI/bundled apps) to trigger system-level notifications.
- Define notification payloads: title, message, and error details (if any).
- Optionally, bundle or link notification icons for success/error messages.
-
Notification Triggers
- When a toggle operation starts: optionally notify the user ("Action started...").
- When a toggle operation completes:
- Notify success: include which action completed (e.g., "Script started" or "Script stopped").
- Notify error: include error details in the notification.
-
Configuration Option
- Add a configuration flag (e.g.,
enableNotifications: boolean) in the app's settings or user preferences.
- Respect user's opt-in/out choice when sending notifications.
- Persist the configuration across app restarts.
-
Usage
- Provide a straightforward API, e.g.,
notificationService.notify({ title, message, type }).
- Replace current "action completed" UI update hooks to call the notification service after a toggle action finishes.
-
Extensibility
- Document how other modules can inject or use the notification service.
- Allow future extensions (like supporting more notification channels, notification grouping, or user actions on notification).
Acceptance Criteria
Feel free to refine the implementation approach based on the actual tech stack.
Problem
Currently, when toggling a switch in BarKeeper (which triggers On/Off scripts), the process runs asynchronously and updates itself only once the action completes. However, there is no direct feedback to the user regarding the completion or failure of these actions unless they actively check the UI. This can reduce usability, especially if an action takes a while and the user switches to other tasks.
Proposed Solution: Notification Center Integration
Integrate BarKeeper with macOS's native Notification Center so that a push notification is sent to the user whenever a toggle action completes—regardless of success or error. This ensures the user is promptly notified of:
Implementation Instructions
Notification Service Abstraction
NotificationServiceas an injectable/service class responsible for all notifications.Using macOS Notification Center
UNUserNotificationCenteror execute an AppleScript via a shell command (for CLI/bundled apps) to trigger system-level notifications.Notification Triggers
Configuration Option
enableNotifications: boolean) in the app's settings or user preferences.Usage
notificationService.notify({ title, message, type }).Extensibility
Acceptance Criteria
Feel free to refine the implementation approach based on the actual tech stack.