From 0d23d9428d564b40248c9ddd632bae9b10a62642 Mon Sep 17 00:00:00 2001 From: David Harris Date: Tue, 28 May 2024 16:08:41 -0400 Subject: [PATCH] feat: support single-target Watch applications (#163) --- .../Plugins/watchOS/WatchOSLifecycleMonitor.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Amplitude/Plugins/watchOS/WatchOSLifecycleMonitor.swift b/Sources/Amplitude/Plugins/watchOS/WatchOSLifecycleMonitor.swift index 386aeb6c..f9c5d823 100644 --- a/Sources/Amplitude/Plugins/watchOS/WatchOSLifecycleMonitor.swift +++ b/Sources/Amplitude/Plugins/watchOS/WatchOSLifecycleMonitor.swift @@ -13,14 +13,14 @@ class WatchOSLifecycleMonitor: UtilityPlugin { var wasBackgrounded: Bool = false - private var watchExtension = WKExtension.shared() + private var watchExtension = WKApplication.shared() private var appNotifications: [NSNotification.Name] = [ - WKExtension.applicationWillEnterForegroundNotification, - WKExtension.applicationDidEnterBackgroundNotification, + WKApplication.willEnterForegroundNotification, + WKApplication.didEnterBackgroundNotification, ] override init() { - watchExtension = WKExtension.shared() + watchExtension = WKApplication.shared() super.init() setupListeners() } @@ -28,9 +28,9 @@ @objc func notificationResponse(notification: NSNotification) { switch notification.name { - case WKExtension.applicationWillEnterForegroundNotification: + case WKApplication.willEnterForegroundNotification: self.applicationWillEnterForeground(notification: notification) - case WKExtension.applicationDidEnterBackgroundNotification: + case WKApplication.didEnterBackgroundNotification: self.applicationDidEnterBackground(notification: notification) default: break