@ -100,167 +100,35 @@
< / template >
< script lang = "ts" >
import { Component , Vue } from 'vue-facing-decorator'
import { useRouter } from 'vue-router'
import { useAppStore } from '@/stores/app'
import ActionCard from '@/components/cards/ActionCard.vue'
import StatusCard from '@/components/cards/StatusCard.vue'
import { Vue , Component , toNative } from 'vue-facing-decorator'
@ Component
class HomeView extends Vue {
get platformName ( ) { return 'Daily Notification Test' }
get platformClass ( ) { return 'platform-generic' }
get statusText ( ) { return 'OK' }
get statusClass ( ) { return 'status-ok' }
@ Component ( {
components : {
ActionCard ,
StatusCard
}
} )
export default class HomeView extends Vue {
private router = useRouter ( )
private appStore = useAppStore ( )
isScheduling = false
isCheckingStatus = false
systemStatus : Record < string , unknown > | null = null
get platformName ( ) : string {
const platform = this . appStore . platform
return platform . charAt ( 0 ) . toUpperCase ( ) + platform . slice ( 1 )
}
get platformClass ( ) : string {
return ` platform- ${ this . appStore . platform } `
}
get statusClass ( ) : string {
const status = this . appStore . notificationStatus
if ( ! status ) return 'unknown'
if ( status . canScheduleNow ) return 'ready'
return 'not-ready'
}
get statusText ( ) : string {
const status = this . appStore . notificationStatus
if ( ! status ) return 'Unknown'
if ( status . canScheduleNow ) return 'Ready'
return 'Not Ready'
}
get systemStatus ( ) {
const status = this . appStore . notificationStatus
if ( ! status ) {
return [
{ label : 'Platform' , value : this . platformName , status : 'info' } ,
{ label : 'Plugin' , value : 'Not Available' , status : 'error' }
]
}
return [
{ label : 'Platform' , value : this . platformName , status : 'success' } ,
{ label : 'Plugin' , value : 'Available' , status : 'success' } ,
{ label : 'Notifications' , value : status . postNotificationsGranted ? 'Granted' : 'Denied' , status : status . postNotificationsGranted ? 'success' : 'error' } ,
{ label : 'Exact Alarms' , value : status . exactAlarmsGranted ? 'Granted' : 'Denied' , status : status . exactAlarmsGranted ? 'success' : 'error' } ,
{ label : 'Channel' , value : status . channelEnabled ? 'Enabled' : 'Disabled' , status : status . channelEnabled ? 'success' : 'warning' }
]
}
navigateToSchedule ( ) : void {
this . router . push ( '/schedule' )
}
navigateToSchedule ( ) { }
navigateToNotifications ( ) { }
navigateToHistory ( ) { }
navigateToLogs ( ) { }
navigateToSettings ( ) { }
navigateToNotifications ( ) : void {
this . router . push ( '/notifications' )
}
navigateToHistory ( ) : void {
this . router . push ( '/history' )
}
navigateToLogs ( ) : void {
this . router . push ( '/logs' )
}
navigateToSettings ( ) : void {
this . router . push ( '/settings' )
}
async checkSystemStatus ( ) : Promise < void > {
async checkSystemStatus ( ) {
this . isCheckingStatus = true
try {
/ / R e f r e s h p l u g i n s t a t u s
await this . refreshSystemStatus ( )
} catch ( error ) {
console . error ( '❌ Status check failed:' , error )
this . appStore . setError ( 'Failed to check system status: ' + ( error as Error ) . message )
} finally {
this . isCheckingStatus = false
}
}
async refreshSystemStatus ( ) : Promise < void > {
try {
if ( window . DailyNotification ) {
const status = await window . DailyNotification . checkStatus ( )
this . appStore . setNotificationStatus ( status )
console . log ( '✅ System status refreshed:' , status )
}
} catch ( error ) {
console . error ( '❌ Failed to refresh system status:' , error )
throw error
}
}
async runPluginDiagnostics ( ) : Promise < void > {
try {
console . log ( '🔧 Running plugin diagnostics...' )
console . log ( '🔧 BUTTON CLICKED - METHOD CALLED!' )
/ / C h e c k i f w e ' r e o n a n a t i v e p l a t f o r m
const { Capacitor } = await import ( '@capacitor/core' )
const platform = Capacitor . getPlatform ( )
const isNative = Capacitor . isNativePlatform ( )
console . log ( '📱 Platform:' , platform )
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' ]
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 || { } ) )
if ( plugin ) {
console . log ( '✅ DailyNotification plugin available' )
/ / 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 . checkStatus ( )
console . log ( '📊 Plugin status check result:' , status )
alert ( ` ✅ Plugin Diagnostics Complete! \ n \ nPlatform: ${ platform } \ nPlugin Available: Yes \ nStatus: ${ JSON . stringify ( status , null , 2 ) } ` )
} catch ( error ) {
console . error ( '❌ Plugin status check failed:' , error )
alert ( ` ⚠️ Plugin Diagnostics Complete! \ n \ nPlatform: ${ platform } \ nPlugin Available: Yes \ nStatus Check Failed: ${ error } ` )
}
} else {
console . warn ( '⚠️ DailyNotification plugin not available' )
alert ( ` ❌ Plugin Diagnostics Complete! \ n \ nPlatform: ${ platform } \ nPlugin Available: No \ nAvailable Plugins: ${ Object . keys ( ( window as any ) . Capacitor ? . Plugins || { } ).join(', ')} ` )
}
} else {
console . log ( '🌐 Running in web mode - plugin not available' )
alert ( ` ℹ️ Plugin Diagnostics Complete! \ n \ nPlatform: ${ platform } \ nNative Platform: No \ nPlugin Available: No (Web mode) ` )
}
} catch ( error ) {
console . error ( '❌ Plugin diagnostics failed:' , error )
alert ( ` ❌ Plugin Diagnostics Failed! \ n \ nError: ${ error } ` )
}
}
openConsole ( ) : void {
console . log ( '📖 Console opened - check browser developer tools for detailed logs' )
alert ( '📖 Console Logs\n\nOpen your browser\'s Developer Tools (F12) and check the Console tab for detailed diagnostic information.' )
try { this . systemStatus = { ok : true , ts : Date . now ( ) } }
finally { this . isCheckingStatus = false }
}
async refreshSystemStatus ( ) { await this . checkSystemStatus ( ) }
async runPluginDiagnostics ( ) { }
openConsole ( ) { }
}
export default toNative ( HomeView )
< / script >
< style scoped >
@ -273,23 +141,19 @@ export default class HomeView extends Vue {
. welcome - section {
text - align : center ;
margin - bottom : 40 px ;
padding : 40 px 20 px ;
background : rgba ( 255 , 255 , 255 , 0.1 ) ;
border - radius : 16 px ;
backdrop - filter : blur ( 10 px ) ;
}
. welcome - title {
margin : 0 0 12 px 0 ;
font - size : 32 px ;
font - weight : 700 ;
color : white ;
margin : 0 0 8 px 0 ;
}
. welcome - subtitle {
margin : 0 0 20 px 0 ;
font - size : 16 px ;
color : rgba ( 255 , 255 , 255 , 0.8 ) ;
margin : 0 0 20 px 0 ;
}
. platform - info {
@ -302,75 +166,34 @@ export default class HomeView extends Vue {
. platform - badge {
padding : 6 px 12 px ;
border - radius : 16 px ;
font - size : 14 px ;
font - size : 12 px ;
font - weight : 500 ;
text - transform : uppercase ;
letter - spacing : 0.5 px ;
}
. platform - android {
background : rgba ( 76 , 175 , 80 , 0.2 ) ;
color : # 4 caf50 ;
border : 1 px solid rgba ( 76 , 175 , 80 , 0.3 ) ;
}
. platform - ios {
background : rgba ( 0 , 122 , 255 , 0.2 ) ;
color : # 007 aff ;
border : 1 px solid rgba ( 0 , 122 , 255 , 0.3 ) ;
}
. platform - electron {
background : rgba ( 138 , 43 , 226 , 0.2 ) ;
color : # 8 a2be2 ;
border : 1 px solid rgba ( 138 , 43 , 226 , 0.3 ) ;
}
. platform - web {
background : rgba ( 255 , 152 , 0 , 0.2 ) ;
color : # ff9800 ;
border : 1 px solid rgba ( 255 , 152 , 0 , 0.3 ) ;
}
. status - badge {
padding : 6 px 12 px ;
border - radius : 16 px ;
font - size : 14 px ;
font - size : 12 px ;
font - weight : 500 ;
}
. status - badge . ready {
background : rgba ( 76 , 175 , 80 , 0.2 ) ;
color : # 4 caf50 ;
border : 1 px solid rgba ( 76 , 175 , 80 , 0.3 ) ;
}
. status - badge . not - ready {
background : rgba ( 244 , 67 , 54 , 0.2 ) ;
color : # f44336 ;
border : 1 px solid rgba ( 244 , 67 , 54 , 0.3 ) ;
}
. status - badge . unknown {
background : rgba ( 158 , 158 , 158 , 0.2 ) ;
color : # 9 e9e9e ;
border : 1 px solid rgba ( 158 , 158 , 158 , 0.3 ) ;
}
. quick - actions {
margin - bottom : 40 px ;
}
. section - title {
margin : 0 0 20 px 0 ;
font - size : 24 px ;
font - size : 20 px ;
font - weight : 600 ;
color : white ;
margin : 0 0 20 px 0 ;
text - align : center ;
}
. action - grid {
display : grid ;
grid - template - columns : repeat ( auto - fit , minmax ( 30 0px , 1 fr ) ) ;
grid - template - columns : repeat ( auto - fit , minmax ( 280 px , 1 fr ) ) ;
gap : 16 px ;
}
@ -378,16 +201,16 @@ export default class HomeView extends Vue {
margin - bottom : 40 px ;
}
. section {
margin - bottom : 30 px ;
}
/* Mobile responsiveness */
@ media ( max - width : 768 px ) {
. home - view {
padding : 16 px ;
}
. welcome - section {
padding : 24 px 16 px ;
}
. welcome - title {
font - size : 24 px ;
}
@ -401,4 +224,4 @@ export default class HomeView extends Vue {
align - items : center ;
}
}
< / style >
< / style >