From 99c21dcf98f1418d992e845492c730160611783a Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Mon, 14 Jun 2021 16:11:55 +0200 Subject: [PATCH] fix(ios): Use proper native events for cordova events (#4720) --- ios/Capacitor/Capacitor/CapacitorBridge.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/Capacitor/Capacitor/CapacitorBridge.swift b/ios/Capacitor/Capacitor/CapacitorBridge.swift index 749ab1f363..54faf2df58 100644 --- a/ios/Capacitor/Capacitor/CapacitorBridge.swift +++ b/ios/Capacitor/Capacitor/CapacitorBridge.swift @@ -234,10 +234,10 @@ internal class CapacitorBridge: NSObject, CAPBridgeProtocol { exportCordovaJS() registerCordovaPlugins() } else { - observers.append(NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: OperationQueue.main) { [weak self] (_) in + observers.append(NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] (_) in self?.triggerDocumentJSEvent(eventName: "resume") }) - observers.append(NotificationCenter.default.addObserver(forName: UIApplication.willResignActiveNotification, object: nil, queue: OperationQueue.main) { [weak self] (_) in + observers.append(NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main) { [weak self] (_) in self?.triggerDocumentJSEvent(eventName: "pause") }) }