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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user