feat(android): add getSchedulesWithStatus() and alarm list UI
Adds ability to list alarms with AlarmManager status in web interface.
Changes:
- Add getSchedulesWithStatus() method to DailyNotificationPlugin
- Add ScheduleWithStatus TypeScript interface with isActuallyScheduled flag
- Add alarm list UI to android-test-app with status indicators
Backend:
- getSchedulesWithStatus() returns schedules with AlarmManager verification
- Checks isAlarmScheduled() for each notify schedule with nextRunAt
- Returns isActuallyScheduled boolean flag for each schedule
TypeScript:
- New ScheduleWithStatus interface extending Schedule
- Method signature with JSDoc and usage examples
UI:
- New "📋 List Alarms" button in test app
- Color-coded alarm cards (green=scheduled, orange=not scheduled)
- Shows schedule ID, next run time, pattern, and AlarmManager status
- Useful for debugging recovery scenarios and verifying alarm state
Use case:
- Verify which alarms are in database vs actually scheduled
- Debug Phase 1/2/3 recovery scenarios
- Visual confirmation of alarm state after app launch/boot
Related:
- Enhances: android-test-app for Phase 1-3 testing
- Supports: Recovery verification and debugging
This commit is contained in:
@@ -328,6 +328,15 @@ export interface Schedule {
|
||||
stateJson?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule with AlarmManager status
|
||||
* Extends Schedule with isActuallyScheduled flag indicating if alarm is registered in AlarmManager
|
||||
*/
|
||||
export interface ScheduleWithStatus extends Schedule {
|
||||
/** Whether the alarm is actually scheduled in AlarmManager (Android only, for 'notify' schedules) */
|
||||
isActuallyScheduled: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Input type for creating a new schedule
|
||||
*/
|
||||
@@ -697,6 +706,29 @@ export interface DailyNotificationPlugin {
|
||||
*/
|
||||
getSchedules(options?: { kind?: 'fetch' | 'notify'; enabled?: boolean }): Promise<{ schedules: Schedule[] }>;
|
||||
|
||||
/**
|
||||
* Get all schedules with their AlarmManager status
|
||||
* Returns schedules from database with isActuallyScheduled flag for each
|
||||
*
|
||||
* @param options Optional filters:
|
||||
* - kind: Filter by schedule type ('fetch' | 'notify')
|
||||
* - enabled: Filter by enabled status (true = only enabled, false = only disabled, undefined = all)
|
||||
* @returns Promise resolving to object with schedules array: { schedules: ScheduleWithStatus[] }
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // Get all notification schedules with AlarmManager status
|
||||
* const result = await DailyNotification.getSchedulesWithStatus({
|
||||
* kind: 'notify',
|
||||
* enabled: true
|
||||
* });
|
||||
* result.schedules.forEach(schedule => {
|
||||
* console.log(`${schedule.id}: ${schedule.isActuallyScheduled ? 'Scheduled' : 'Not scheduled'}`);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
getSchedulesWithStatus(options?: { kind?: 'fetch' | 'notify'; enabled?: boolean }): Promise<{ schedules: ScheduleWithStatus[] }>;
|
||||
|
||||
/**
|
||||
* Get a single schedule by ID
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user