diff --git a/test-apps/android-test/src/App.vue b/test-apps/android-test/src/App.vue index 351aade..faddc3b 100644 --- a/test-apps/android-test/src/App.vue +++ b/test-apps/android-test/src/App.vue @@ -92,12 +92,14 @@ export default class App extends Vue { // Check if DailyNotification plugin is available if (!window.DailyNotification) { - throw new Error('DailyNotification plugin not available') + console.warn('⚠️ DailyNotification plugin not loaded - buttons will show error messages') + this.appStore.setError('DailyNotification plugin not loaded. Please restart the app to enable full functionality.') + return } console.log('✅ DailyNotification plugin available') } else { - console.log('🌐 Running in web mode') + console.log('🌐 Running in web mode - DailyNotification plugin not available') } } diff --git a/test-apps/android-test/src/stores/notifications.ts b/test-apps/android-test/src/stores/notifications.ts index e5e1f4f..52a7a0a 100644 --- a/test-apps/android-test/src/stores/notifications.ts +++ b/test-apps/android-test/src/stores/notifications.ts @@ -62,8 +62,12 @@ export const useNotificationsStore = defineStore('notifications', () => { priority?: string url?: string }): Promise { - if (!Capacitor.isNativePlatform() || !window.DailyNotification) { - throw new Error('DailyNotification plugin not available') + if (!Capacitor.isNativePlatform()) { + throw new Error('DailyNotification plugin only available on native platforms') + } + + if (!window.DailyNotification) { + throw new Error('DailyNotification plugin not loaded. Please restart the app.') } try { @@ -106,8 +110,12 @@ export const useNotificationsStore = defineStore('notifications', () => { repeatDaily?: boolean timezone?: string }): Promise { - if (!Capacitor.isNativePlatform() || !window.DailyNotification) { - throw new Error('DailyNotification plugin not available') + if (!Capacitor.isNativePlatform()) { + throw new Error('DailyNotification plugin only available on native platforms') + } + + if (!window.DailyNotification) { + throw new Error('DailyNotification plugin not loaded. Please restart the app.') } try { @@ -140,8 +148,12 @@ export const useNotificationsStore = defineStore('notifications', () => { } async function cancelReminder(reminderId: string): Promise { - if (!Capacitor.isNativePlatform() || !window.DailyNotification) { - throw new Error('DailyNotification plugin not available') + if (!Capacitor.isNativePlatform()) { + throw new Error('DailyNotification plugin only available on native platforms') + } + + if (!window.DailyNotification) { + throw new Error('DailyNotification plugin not loaded. Please restart the app.') } try { @@ -169,7 +181,13 @@ export const useNotificationsStore = defineStore('notifications', () => { } async function checkStatus(): Promise { - if (!Capacitor.isNativePlatform() || !window.DailyNotification) { + if (!Capacitor.isNativePlatform()) { + console.warn('DailyNotification plugin only available on native platforms') + return + } + + if (!window.DailyNotification) { + console.warn('DailyNotification plugin not loaded') return } @@ -188,7 +206,13 @@ export const useNotificationsStore = defineStore('notifications', () => { } async function getLastNotification(): Promise { - if (!Capacitor.isNativePlatform() || !window.DailyNotification) { + if (!Capacitor.isNativePlatform()) { + console.warn('DailyNotification plugin only available on native platforms') + return + } + + if (!window.DailyNotification) { + console.warn('DailyNotification plugin not loaded') return }