@ -34,95 +34,19 @@
< / div >
< / template >
< script setup lang = "ts" >
import { onMounted , computed } from 'vue'
import { Capacitor } from '@capacitor/core'
import AppHeader from '@/components/layout/AppHeader.vue'
import AppFooter from '@/components/layout/AppFooter.vue'
import LoadingOverlay from '@/components/ui/LoadingOverlay.vue'
import ErrorDialog from '@/components/ui/ErrorDialog.vue'
import { useAppStore } from '@/stores/app'
< script lang = "ts" >
import { Vue , Component , toNative } from 'vue-facing-decorator'
const appStore = useAppStore ( )
const isLoading = computed ( ( ) => appStore . isLoading )
const errorMessage = computed ( ( ) => appStore . errorMessage )
const initializeApp = async ( ) : Promise < void > => {
try {
appStore . setLoading ( true )
/ / I n i t i a l i z e p l a t f o r m d e t e c t i o n
const platform = Capacitor . getPlatform ( )
const isNative = Capacitor . isNativePlatform ( )
appStore . setPlatform ( platform , isNative )
console . log ( '🚀 Daily Notification Test App Started' )
console . log ( '📱 Platform:' , platform )
console . log ( '🔧 Native Platform:' , isNative )
/ / 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
if ( isNative ) {
/ / W a i t a b i t f o r C a p a c i t o r t o f u l l y i n i t i a l i z e
await new Promise ( resolve => setTimeout ( resolve , 100 ) )
/ / 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' )
/ / I n i t i a l i z e p l u g i n s t a t u s c h e c k
await checkPluginStatus ( )
} else {
console . warn ( '⚠️ DailyNotification plugin not available' )
/ / D o n ' t s h o w e r r o r d i a l o g - j u s t l o g t h e i s s u e
console . log ( '🔍 Plugin not found, but continuing without error dialog' )
}
} else {
console . log ( '🌐 Running in web mode - plugin not available' )
}
} catch ( error ) {
console . error ( '❌ App initialization failed:' , error )
appStore . setError ( 'Failed to initialize app: ' + ( error as Error ) . message )
} finally {
appStore . setLoading ( false )
@ Component
class App extends Vue {
isLoading = false
errorMessage = ''
clearError ( ) {
this . errorMessage = ''
}
}
const checkPluginStatus = async ( ) : Promise < void > => {
try {
/ / 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' ]
if ( plugin ) {
const status = await plugin . checkStatus ( )
appStore . setNotificationStatus ( status )
console . log ( '📊 Plugin status:' , status )
} else {
console . warn ( '⚠️ Plugin not accessible for status check' )
}
} catch ( error ) {
console . error ( '❌ Plugin status check failed:' , error )
}
}
const clearError = ( ) : void => {
appStore . clearError ( )
}
onMounted ( ( ) => {
initializeApp ( )
} )
export default toNative ( App )
< / script >
< style scoped >