@ -145,8 +145,9 @@ const systemStatus = computed(() => {
return [
{ label : 'Platform' , value : platformName . value , status : 'info' } ,
{ label : 'Plugin' , value : 'Available' , status : 'success' } ,
{ label : 'Permissions' , value : status . postNotificationsGranted ? 'Granted' : 'Not Granted' , status : status . postNotificationsGranted ? 'success' : 'warning' } ,
{ label : 'Can Schedule' , value : status . canScheduleNow ? 'Yes' : 'No' , status : status . canScheduleNow ? 'success' : 'warning' } ,
{ label : 'Next Scheduled' , value : status . nextScheduledAt ? new Date ( status . nextScheduledAt ) . toLocaleTimeString ( ) : 'None' , status : 'info' }
{ label : 'Next Scheduled' , value : status . nextScheduledAt ? new Date ( status . nextScheduledAt ) . toLocaleTimeString ( ) : 'None' , status : 'info' }
]
} )
@ -191,18 +192,54 @@ const checkSystemStatus = async (): Promise<void> => {
console . log ( '🔧 Native platform detected, checking plugin availability...' )
/ / C h e c k i f D a i l y N o t i f i c a t i o n p l u g i n i s a v a i l a b l e
const plugin = ( window as any ) . Capacitor ? . Plugins ? . DailyNotification
console . log ( '🔧 DailyNotification plugin check:' , plugin ? 'Available' : 'Not Available' )
const { DailyNotification } = await import ( '@timesafari/daily-notification-plugin' )
const plugin = DailyNotification
const isPluginAvailable = plugin && typeof plugin . getNotificationStatus === 'function'
console . log ( '🔧 DailyNotification plugin check:' , isPluginAvailable ? 'Available' : 'Not Available' )
console . log ( '🔧 Plugin object:' , plugin )
if ( plugin ) {
console . log ( '✅ Plugin available, checking status...' )
try {
const status = await plugin . checkStatus ( )
console . log ( '📊 Plugin status:' , status )
const status = await plugin . getNotificationStatus ( )
const permissions = await plugin . checkPermissions ( )
const exactAlarmStatus = await plugin . getExactAlarmStatus ( )
/ / U p d a t e t h e a p p s t o r e s t a t u s
appStore . setNotificationStatus ( status )
console . log ( '📊 Plugin status object:' , status )
console . log ( '📊 Status values:' )
console . log ( ' - isEnabled:' , status . isEnabled )
console . log ( ' - isScheduled:' , status . isScheduled )
console . log ( ' - lastNotificationTime:' , status . lastNotificationTime )
console . log ( ' - nextNotificationTime:' , status . nextNotificationTime )
console . log ( ' - pending:' , status . pending )
console . log ( ' - error:' , status . error )
console . log ( '📊 Plugin permissions:' , permissions )
console . log ( '📊 Exact alarm status:' , exactAlarmStatus )
/ / M a p p l u g i n r e s p o n s e t o a p p s t o r e f o r m a t
const mappedStatus = {
canScheduleNow : status . isEnabled ? ? false ,
postNotificationsGranted : permissions . notifications === 'granted' ,
channelEnabled : true , / / D e f a u l t f o r n o w
channelImportance : 3 , / / D e f a u l t f o r n o w
channelId : 'daily-notifications' ,
exactAlarmsGranted : exactAlarmStatus . enabled ,
exactAlarmsSupported : exactAlarmStatus . supported ,
androidVersion : 33 , / / D e f a u l t f o r n o w
nextScheduledAt : typeof status . nextNotificationTime === 'number'
? status . nextNotificationTime
: await status . nextNotificationTime
}
/ / U p d a t e t h e a p p s t o r e s t a t u s - e v e n i f p e r m i s s i o n s a r e n ' t g r a n t e d
appStore . setNotificationStatus ( mappedStatus )
console . log ( '✅ System status updated successfully' )
/ / L o g p e r m i s s i o n s t a t u s f o r d e b u g g i n g
if ( ! mappedStatus . postNotificationsGranted ) {
console . warn ( '⚠️ Notification permissions not granted - user needs to enable in settings' )
}
} catch ( error ) {
console . error ( '❌ Plugin status check failed:' , error )
/ / K e e p e x i s t i n g s t a t u s o r s e t e r r o r s t a t e
@ -246,15 +283,14 @@ const runPluginDiagnostics = async (): Promise<void> => {
console . log ( '🔧 Native Platform:' , isNative )
if ( isNative ) {
/ / T r y m u l t i p l e w a y s t o a c c e s s t h e p l u g i n
const plugin = ( window as any ) . DailyNotification ||
( window as any ) . Capacitor ? . Plugins ? . DailyNotification ||
( window as any ) . Capacitor ? . Plugins ? . [ 'DailyNotification' ]
/ / U s e p r o p e r p l u g i n i m p o r t
const { DailyNotification } = await import ( '@timesafari/daily-notification-plugin' )
const plugin = DailyNotification
const isPluginAvailable = plugin && typeof plugin . getNotificationStatus === 'function'
console . log ( '🔍 Plugin detection debug:' )
console . log ( ' - window.DailyNotification:' , ( window as any ) . DailyNotification )
console . log ( ' - Capacitor.Plugins:' , ( window as any ) . Capacitor ? . Plugins )
console . log ( ' - Available plugins:' , Object . keys ( ( window as any ) . Capacitor ? . Plugins || { } ) )
console . log ( ' - DailyNotification plugin:' , isPluginAvailable ? 'Available' : 'Not Available' )
console . log ( ' - Plugin object:' , plugin )
if ( plugin ) {
console . log ( '✅ DailyNotification plugin available' )
@ -265,7 +301,7 @@ const runPluginDiagnostics = async (): Promise<void> => {
/ / T e s t t h e c h e c k S t a t u s m e t h o d
try {
const status = await plugin . check Status( )
const status = await plugin . getNotification Status( )
console . log ( '📊 Plugin status check result:' , status )
/ / C r e a t e d e t a i l e d p l u g i n r e p o r t