fix(test-app): implement Schedule Notification button functionality

- Replace empty TODO with actual plugin integration
- Add dynamic import of DailyNotification plugin
- Implement proper error handling with try/catch
- Add user feedback via alert dialogs
- Add comprehensive logging for debugging
- Fix TypeScript priority type with 'high' as const
- Successfully schedules notifications with AlarmManager
- Verified alarm appears in dumpsys alarm output

The Schedule Notification button now actually calls the native
plugin and schedules notifications instead of being a placeholder.
This commit is contained in:
Matthew Raymer
2025-10-23 12:51:15 +00:00
parent 6aaeaf7808
commit 4a8573ec87
2 changed files with 593 additions and 103 deletions

View File

@@ -52,7 +52,41 @@ class ScheduleView extends Vue {
async scheduleNotification() {
this.isScheduling = true
try {
// TODO: call plugin
console.log('🔄 Starting notification scheduling...')
// Import and use the real plugin
const { DailyNotification } = await import('@timesafari/daily-notification-plugin')
const plugin = DailyNotification
console.log('✅ Plugin loaded:', plugin)
const options = {
time: this.scheduleTime,
title: this.notificationTitle,
body: this.notificationMessage,
sound: true,
priority: 'high' as const
}
console.log('📅 Scheduling notification with options:', options)
await plugin.scheduleDailyNotification(options)
console.log('✅ Notification scheduled successfully!')
// Show success feedback to user
alert('Notification scheduled successfully!')
} catch (error) {
console.error('❌ Failed to schedule notification:', error)
console.error('❌ Error details:', {
name: error.name,
message: error.message,
stack: error.stack
})
// Show error feedback to user
alert(`Failed to schedule notification: ${error.message}`)
} finally {
this.isScheduling = false
}