diff --git a/ios/App/App/AppDelegate.swift b/ios/App/App/AppDelegate.swift index b1becbab..29639735 100644 --- a/ios/App/App/AppDelegate.swift +++ b/ios/App/App/AppDelegate.swift @@ -22,50 +22,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // Initialize SQLite //let sqlite = SQLite() //sqlite.initialize() - - // Register SharedImage plugin manually after bridge is ready - // Try multiple times with increasing delays to ensure bridge is initialized - var attempts = 0 - let maxAttempts = 5 - - func tryRegister() { - attempts += 1 - if registerSharedImagePlugin() { - print("[AppDelegate] ✅ Plugin registration successful on attempt \(attempts)") - } else if attempts < maxAttempts { - DispatchQueue.main.asyncAfter(deadline: .now() + Double(attempts) * 0.5) { - tryRegister() - } - } else { - print("[AppDelegate] ⚠️ Failed to register plugin after \(maxAttempts) attempts") - } - } - - // Start registration attempts - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - tryRegister() - } - + + // SharedImagePlugin is registered from AppBridgeViewController.capacitorDidLoad() + // (Phase 2B-2). The previous AppDelegate retry-based registration was removed. + // Override point for customization after application launch. return true } - - @discardableResult - private func registerSharedImagePlugin() -> Bool { - guard let window = self.window, - let bridgeVC = window.rootViewController as? CAPBridgeViewController, - let bridge = bridgeVC.bridge else { - return false - } - - // Create plugin instance - // The @objc(SharedImage) annotation makes it available as "SharedImage" to Objective-C - // which matches the JavaScript registration name - let pluginInstance = SharedImagePlugin() - bridge.registerPluginInstance(pluginInstance) - print("[AppDelegate] ✅ Registered SharedImagePlugin (exposed as 'SharedImage' via @objc annotation)") - return true - } func applicationWillResignActive(_ application: UIApplication) { // TEMPORARY SHARE TARGET DIAGNOSTICS