diff --git a/Automattic-Tracks-iOS/ABTesting/ExPlat.swift b/Automattic-Tracks-iOS/ABTesting/ExPlat.swift index c0a8e4f6..d2a0ba07 100644 --- a/Automattic-Tracks-iOS/ABTesting/ExPlat.swift +++ b/Automattic-Tracks-iOS/ABTesting/ExPlat.swift @@ -25,7 +25,6 @@ import Cocoa service: ExPlatService? = nil) { self.service = service ?? ExPlatService(configuration: configuration) super.init() - subscribeToNotifications() ExPlat.shared = self } @@ -39,10 +38,6 @@ import Cocoa anonId: anonId)) } - deinit { - unsubscribeFromNotifications() - } - /// Only refresh if the TTL has expired /// public func refreshIfNeeded(completion: (() -> Void)? = nil) { @@ -90,34 +85,4 @@ import Cocoa return .treatment(variation) } } - - /// Check if the app is entering background and/or foreground - /// and start/stop the timers - /// - private func subscribeToNotifications() { - let notificationCenter = NotificationCenter.default - - #if os(iOS) || os(watchOS) || os(tvOS) - notificationCenter.addObserver(self, selector: #selector(applicationWillEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil) - #elseif os(macOS) - notificationCenter.addObserver(self, selector: #selector(applicationWillEnterForeground), name: NSApplication.willBecomeActiveNotification, object: nil) - #endif - } - - private func unsubscribeFromNotifications() { - let notificationCenter = NotificationCenter.default - - #if os(iOS) || os(watchOS) || os(tvOS) - notificationCenter.removeObserver(self, name: UIApplication.willEnterForegroundNotification, object: nil) - #elseif os(macOS) - notificationCenter.removeObserver(self, name: NSApplication.willBecomeActiveNotification, object: nil) - #endif - } - - /// When the app enter foreground refresh the assignments or - /// start the timer - /// - @objc private func applicationWillEnterForeground() { - refreshIfNeeded() - } } diff --git a/Automattic-Tracks-iOS/Services/TracksService.m b/Automattic-Tracks-iOS/Services/TracksService.m index 8d5b3e11..ea205ebb 100644 --- a/Automattic-Tracks-iOS/Services/TracksService.m +++ b/Automattic-Tracks-iOS/Services/TracksService.m @@ -212,8 +212,7 @@ - (void)switchToAuthenticatedUserWithUsername:(NSString *)username userID:(NSStr self.token = token; #if TARGET_OS_IPHONE - // Temporarily uses wpcom while we test that the implementation is not biased - [ExPlat configureWithPlatform:@"wpcom" oAuthToken:token userAgent:self.userAgent anonId:nil]; + [ExPlat configureWithPlatform:_eventNamePrefix oAuthToken:token userAgent:self.userAgent anonId:nil]; #endif } @@ -227,8 +226,7 @@ - (void)switchToAnonymousUserWithAnonymousID:(NSString *)anonymousID self.token = nil; #if TARGET_OS_IPHONE - // Temporarily uses wpcom while we test that the implementation is not biased - [ExPlat configureWithPlatform:@"wpcom" oAuthToken:nil userAgent:self.userAgent anonId:anonymousID]; + [ExPlat configureWithPlatform:_eventNamePrefix oAuthToken:nil userAgent:self.userAgent anonId:anonymousID]; #endif } diff --git a/Automattic-Tracks-iOS/TracksConstants.m b/Automattic-Tracks-iOS/TracksConstants.m index 3827a815..79ebfa2e 100644 --- a/Automattic-Tracks-iOS/TracksConstants.m +++ b/Automattic-Tracks-iOS/TracksConstants.m @@ -1,4 +1,4 @@ #import "TracksConstants.h" NSString *const TracksErrorDomain = @"TracksErrorDomain"; -NSString *const TracksLibraryVersion = @"0.8.2"; +NSString *const TracksLibraryVersion = @"0.8.3";