From 04311803bc6f977d8a2e0c6f6abb7fb5deb71b46 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 11 Nov 2025 23:12:21 -0800 Subject: [PATCH] fix(ios): register DailyNotification plugin methods in capacitor_plugins.js Fixed plugin method registration for iOS test app: Plugin Registration Fix: - Added proper method stubs for all DailyNotification plugin methods - Methods use Capacitor.nativePromise to bridge to Swift implementation - Includes permission, notification, status, channel, config, battery, and test methods Method Registration: - Permission: checkPermissionStatus, requestNotificationPermissions, checkPermissions, requestPermissions - Notification: scheduleDailyNotification, getNotificationStatus, cancelAllNotifications - Status: checkStatus - Channel: isChannelEnabled, openChannelSettings - Config: configure, configureNativeFetcher - Battery/Power: getBatteryStatus, getPowerState, requestBatteryOptimizationExemption - Exact Alarm: getExactAlarmStatus, openExactAlarmSettings - Test: testAlarm Fixes: - Error: 'requestNotificationPermissions is not a function' - Plugin methods now properly exposed to JavaScript - Methods bridge correctly to native Swift implementation Result: Permission buttons and other plugin methods should now work correctly --- .../App/App/public/capacitor_plugins.js | 71 +++++++++++++++++-- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/test-apps/ios-test-app/App/App/public/capacitor_plugins.js b/test-apps/ios-test-app/App/App/public/capacitor_plugins.js index dd4051c..ad9b9da 100644 --- a/test-apps/ios-test-app/App/App/public/capacitor_plugins.js +++ b/test-apps/ios-test-app/App/App/public/capacitor_plugins.js @@ -1,14 +1,75 @@ // Capacitor Plugins Registration -// This file is auto-generated by Capacitor, but we create a minimal version for testing +// This file registers the DailyNotification plugin for iOS window.Capacitor = window.Capacitor || {}; window.Capacitor.Plugins = window.Capacitor.Plugins || {}; -// Register DailyNotification plugin -// The actual plugin is registered by the native bridge +// Register DailyNotification plugin with method stubs +// Methods will be bridged to native Swift implementation window.Capacitor.Plugins.DailyNotification = window.Capacitor.Plugins.DailyNotification || { - // Plugin methods will be available after native bridge loads + // Permission methods + checkPermissionStatus: function() { + return window.Capacitor.nativePromise('DailyNotification', 'checkPermissionStatus', {}); + }, + requestNotificationPermissions: function() { + return window.Capacitor.nativePromise('DailyNotification', 'requestNotificationPermissions', {}); + }, + checkPermissions: function() { + return window.Capacitor.nativePromise('DailyNotification', 'checkPermissions', {}); + }, + requestPermissions: function() { + return window.Capacitor.nativePromise('DailyNotification', 'requestPermissions', {}); + }, + // Notification methods + scheduleDailyNotification: function(options) { + return window.Capacitor.nativePromise('DailyNotification', 'scheduleDailyNotification', options || {}); + }, + getNotificationStatus: function() { + return window.Capacitor.nativePromise('DailyNotification', 'getNotificationStatus', {}); + }, + cancelAllNotifications: function() { + return window.Capacitor.nativePromise('DailyNotification', 'cancelAllNotifications', {}); + }, + // Status methods + checkStatus: function() { + return window.Capacitor.nativePromise('DailyNotification', 'checkStatus', {}); + }, + // Channel methods + isChannelEnabled: function(options) { + return window.Capacitor.nativePromise('DailyNotification', 'isChannelEnabled', options || {}); + }, + openChannelSettings: function(options) { + return window.Capacitor.nativePromise('DailyNotification', 'openChannelSettings', options || {}); + }, + // Configuration methods + configure: function(options) { + return window.Capacitor.nativePromise('DailyNotification', 'configure', options || {}); + }, + configureNativeFetcher: function(options) { + return window.Capacitor.nativePromise('DailyNotification', 'configureNativeFetcher', options || {}); + }, + // Battery/Power methods + getBatteryStatus: function() { + return window.Capacitor.nativePromise('DailyNotification', 'getBatteryStatus', {}); + }, + getPowerState: function() { + return window.Capacitor.nativePromise('DailyNotification', 'getPowerState', {}); + }, + requestBatteryOptimizationExemption: function() { + return window.Capacitor.nativePromise('DailyNotification', 'requestBatteryOptimizationExemption', {}); + }, + // Exact alarm methods + getExactAlarmStatus: function() { + return window.Capacitor.nativePromise('DailyNotification', 'getExactAlarmStatus', {}); + }, + openExactAlarmSettings: function() { + return window.Capacitor.nativePromise('DailyNotification', 'openExactAlarmSettings', {}); + }, + // Test methods + testAlarm: function(options) { + return window.Capacitor.nativePromise('DailyNotification', 'testAlarm', options || {}); + } }; -console.log('Capacitor plugins file loaded'); +console.log('Capacitor plugins file loaded - DailyNotification plugin registered');