From b300ab99d85a666c93cc93afffa4493cd0ca817b Mon Sep 17 00:00:00 2001 From: Leandro Alonso Date: Thu, 18 Mar 2021 13:31:27 -0300 Subject: [PATCH 1/3] Revert "Sets platform to "wpcom"" This reverts commit 0898ffe47b2d76f0dd2bba99c29554108829301c. --- Automattic-Tracks-iOS/Services/TracksService.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 } From e2826e061d9907a8d6d1576085e07c8b3d5bbecf Mon Sep 17 00:00:00 2001 From: Leandro Alonso Date: Thu, 18 Mar 2021 13:56:05 -0300 Subject: [PATCH 2/3] Remove the foreground refresh from the library, this should be implemented by the app --- Automattic-Tracks-iOS/ABTesting/ExPlat.swift | 35 -------------------- 1 file changed, 35 deletions(-) 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() - } } From bd4cf9f4dacc3dbe100a4079c50ab83a7b7cea2d Mon Sep 17 00:00:00 2001 From: Leandro Alonso Date: Thu, 18 Mar 2021 16:01:26 -0300 Subject: [PATCH 3/3] Bump version --- Automattic-Tracks-iOS/TracksConstants.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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";