From 8029ad1cfd47a06a218c4ce427e7d27b61bfa721 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Mon, 20 May 2024 15:46:45 -0700 Subject: [PATCH 1/7] Update iOS app for survey changes. --- DuckDuckGo.xcodeproj/project.pbxproj | 12 ++++----- .../xcshareddata/swiftpm/Package.resolved | 8 +++--- ...ofillLoginSettingsListViewController.swift | 2 +- DuckDuckGo/HomeMessageViewModel.swift | 13 +-------- DuckDuckGo/HomeMessageViewModelBuilder.swift | 2 +- DuckDuckGo/RemoteMessaging.swift | 23 +++++----------- ... => RemoteMessagingSurveyURLBuilder.swift} | 27 +++++++------------ 7 files changed, 29 insertions(+), 58 deletions(-) rename DuckDuckGo/{SurveyURLBuilder.swift => RemoteMessagingSurveyURLBuilder.swift} (86%) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 513a4974a3..d9b08f74cf 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -213,7 +213,7 @@ 4B6484F327FD1E350050A7A1 /* MenuControllerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B6484E927FD1E340050A7A1 /* MenuControllerView.swift */; }; 4B6ED9452B992FE4007F5CAA /* vpn-dark-mode.json in Resources */ = {isa = PBXBuildFile; fileRef = 4B6ED9442B992FE4007F5CAA /* vpn-dark-mode.json */; }; 4B75EA9226A266CB00018634 /* PrintingUserScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B75EA9126A266CB00018634 /* PrintingUserScript.swift */; }; - 4B78074E2B183A1F009DB2CF /* SurveyURLBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B78074D2B183A1F009DB2CF /* SurveyURLBuilder.swift */; }; + 4B78074E2B183A1F009DB2CF /* RemoteMessagingSurveyURLBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B78074D2B183A1F009DB2CF /* RemoteMessagingSurveyURLBuilder.swift */; }; 4B948E2629DCCDB9002531FA /* Persistence in Frameworks */ = {isa = PBXBuildFile; productRef = 4B948E2529DCCDB9002531FA /* Persistence */; }; 4BB697A42B1D99C4003699B5 /* VPNWaitlistActivationDateStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B78074B2B1823C5009DB2CF /* VPNWaitlistActivationDateStore.swift */; }; 4BB697A52B1D99C5003699B5 /* VPNWaitlistActivationDateStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B78074B2B1823C5009DB2CF /* VPNWaitlistActivationDateStore.swift */; }; @@ -1304,7 +1304,7 @@ 4B6ED9442B992FE4007F5CAA /* vpn-dark-mode.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "vpn-dark-mode.json"; sourceTree = ""; }; 4B75EA9126A266CB00018634 /* PrintingUserScript.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrintingUserScript.swift; sourceTree = ""; }; 4B78074B2B1823C5009DB2CF /* VPNWaitlistActivationDateStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNWaitlistActivationDateStore.swift; sourceTree = ""; }; - 4B78074D2B183A1F009DB2CF /* SurveyURLBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SurveyURLBuilder.swift; sourceTree = ""; }; + 4B78074D2B183A1F009DB2CF /* RemoteMessagingSurveyURLBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteMessagingSurveyURLBuilder.swift; sourceTree = ""; }; 4BB7CBAF2AF59C310014A35F /* VPNWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNWidget.swift; sourceTree = ""; }; 4BBBBA892B031B4200D965DA /* VPNWaitlistDebugViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VPNWaitlistDebugViewController.swift; sourceTree = ""; }; 4BBBBA8A2B031B4200D965DA /* VPNWaitlistViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VPNWaitlistViewController.swift; sourceTree = ""; }; @@ -3326,7 +3326,6 @@ 4BBBBA8A2B031B4200D965DA /* VPNWaitlistViewController.swift */, 4BCD146A2B05C4B5000B1E4C /* VPNWaitlistTermsAndConditionsViewController.swift */, 4B78074B2B1823C5009DB2CF /* VPNWaitlistActivationDateStore.swift */, - 4B78074D2B183A1F009DB2CF /* SurveyURLBuilder.swift */, BDFF031F2BA3D3AD00F324C9 /* Feature Visibility */, ); name = VPN; @@ -4319,6 +4318,7 @@ C1B7B52028941F2A0098FD6A /* RemoteMessageRequest.swift */, C1B7B52128941F2A0098FD6A /* RemoteMessaging.swift */, C1B7B51F28941F2A0098FD6A /* RemoteMessagingStore.swift */, + 4B78074D2B183A1F009DB2CF /* RemoteMessagingSurveyURLBuilder.swift */, ); name = RemoteMessaging; sourceTree = ""; @@ -6451,7 +6451,7 @@ F1386BA41E6846C40062FC3C /* TabDelegate.swift in Sources */, 37CF91602BB4737300BADCAE /* CrashCollectionOnboarding.swift in Sources */, C1B924B72ACD6E6800EE7B06 /* AutofillNeverSavedTableViewCell.swift in Sources */, - 4B78074E2B183A1F009DB2CF /* SurveyURLBuilder.swift in Sources */, + 4B78074E2B183A1F009DB2CF /* RemoteMessagingSurveyURLBuilder.swift in Sources */, 3132FA2A27A0788F00DD7A12 /* QuickLookPreviewHelper.swift in Sources */, D670E5BB2BB6A75300941A42 /* SubscriptionNavigationCoordinator.swift in Sources */, C1D21E2D293A5965006E5A05 /* AutofillLoginSession.swift in Sources */, @@ -9853,8 +9853,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit"; requirement = { - kind = exactVersion; - version = 145.3.2; + branch = "sam/rmf-survey-updates"; + kind = branch; }; }; 9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 1c06503a4f..77bb3f86e7 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/DuckDuckGo/BrowserServicesKit", "state" : { - "revision" : "1c692ce52ffd74edd1d1180e038a14a0cf1dd736", - "version" : "145.3.2" + "branch" : "sam/rmf-survey-updates", + "revision" : "0bb46a5c37b5741ed1eb8a806fb498755cad92bc" } }, { @@ -185,8 +185,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/TrackerRadarKit.git", "state" : { - "revision" : "6c84fd19139414fc0edbf9673ade06e532a564f0", - "version" : "2.0.0" + "revision" : "c01e6a59d000356b58ec77053e0a99d538be56a5", + "version" : "2.1.1" } }, { diff --git a/DuckDuckGo/AutofillLoginSettingsListViewController.swift b/DuckDuckGo/AutofillLoginSettingsListViewController.swift index 7078a65db4..df88b9ef0f 100644 --- a/DuckDuckGo/AutofillLoginSettingsListViewController.swift +++ b/DuckDuckGo/AutofillLoginSettingsListViewController.swift @@ -220,7 +220,7 @@ final class AutofillLoginSettingsListViewController: UIViewController { let messageView = PasswordsSurveyView(surveyButtonAction: { [weak self] in let survey = "https://selfserve.decipherinc.com/survey/selfserve/32ab/240409" if let surveyURL = URL(string: survey) { - let surveyURLBuilder = DefaultSurveyURLBuilder() + let surveyURLBuilder = DefaultRemoteMessagingSurveyURLBuilder() let surveyURLWithParameters = surveyURLBuilder.addPasswordsCountSurveyParameter(to: surveyURL) LaunchTabNotification.postLaunchTabNotification(urlString: surveyURLWithParameters.absoluteString) } else { diff --git a/DuckDuckGo/HomeMessageViewModel.swift b/DuckDuckGo/HomeMessageViewModel.swift index e108700468..e6c7bbdd0c 100644 --- a/DuckDuckGo/HomeMessageViewModel.swift +++ b/DuckDuckGo/HomeMessageViewModel.swift @@ -139,20 +139,9 @@ struct HomeMessageViewModel { LaunchTabNotification.postLaunchTabNotification(urlString: value) onDidClose(buttonAction) } - case .surveyURL(let value): + case .survey(let value): return { -#if NETWORK_PROTECTION - if let surveyURL = URL(string: value) { - let surveyURLBuilder = DefaultSurveyURLBuilder() - let surveyURLWithParameters = surveyURLBuilder.addSurveyParameters(to: surveyURL) - LaunchTabNotification.postLaunchTabNotification(urlString: surveyURLWithParameters.absoluteString) - } else { - LaunchTabNotification.postLaunchTabNotification(urlString: value) - } -#else LaunchTabNotification.postLaunchTabNotification(urlString: value) -#endif - onDidClose(buttonAction) } case .appStore: diff --git a/DuckDuckGo/HomeMessageViewModelBuilder.swift b/DuckDuckGo/HomeMessageViewModelBuilder.swift index 4f54c60548..641be47a10 100644 --- a/DuckDuckGo/HomeMessageViewModelBuilder.swift +++ b/DuckDuckGo/HomeMessageViewModelBuilder.swift @@ -49,7 +49,7 @@ extension RemoteAction { case .share(let value, let title): return .share(value: value, title: title) - case .appStore, .url, .surveyURL: + case .appStore, .url, .survey: if isSecondaryAction { return .cancel } diff --git a/DuckDuckGo/RemoteMessaging.swift b/DuckDuckGo/RemoteMessaging.swift index a0dd506002..95a2a01edf 100644 --- a/DuckDuckGo/RemoteMessaging.swift +++ b/DuckDuckGo/RemoteMessaging.swift @@ -26,6 +26,7 @@ import Persistence import Bookmarks import RemoteMessaging import NetworkProtection +import Subscription struct RemoteMessaging { @@ -153,21 +154,9 @@ struct RemoteMessaging { case .success(let statusResponse): os_log("Successfully fetched remote messages", log: .remoteMessaging, type: .debug) - let isNetworkProtectionWaitlistUser: Bool - let daysSinceNetworkProtectionEnabled: Int - -#if NETWORK_PROTECTION - let vpnAccess = NetworkProtectionAccessController() - let accessType = vpnAccess.networkProtectionAccessType() - let isVPNActivated = NetworkProtectionKeychainTokenStore().isFeatureActivated let activationDateStore = DefaultVPNWaitlistActivationDateStore() - - isNetworkProtectionWaitlistUser = (accessType == .waitlistInvited) && isVPNActivated - daysSinceNetworkProtectionEnabled = activationDateStore.daysSinceActivation() ?? -1 -#else - isNetworkProtectionWaitlistUser = false - daysSinceNetworkProtectionEnabled = -1 -#endif + let daysSinceNetworkProtectionEnabled = activationDateStore.daysSinceActivation() ?? -1 + let surveyActionMapper = DefaultRemoteMessagingSurveyURLBuilder(statisticsStore: statisticsStore) let remoteMessagingConfigMatcher = RemoteMessagingConfigMatcher( appAttributeMatcher: AppAttributeMatcher(statisticsStore: statisticsStore, @@ -179,9 +168,11 @@ struct RemoteMessaging { favoritesCount: favoritesCount, appTheme: AppUserDefaults().currentThemeName.rawValue, isWidgetInstalled: isWidgetInstalled, - isNetPWaitlistUser: isNetworkProtectionWaitlistUser, - daysSinceNetPEnabled: daysSinceNetworkProtectionEnabled), + daysSinceNetPEnabled: daysSinceNetworkProtectionEnabled, + isPrivacyProEligibleUser: SubscriptionPurchaseEnvironment.canPurchase, + isPrivacyProSubscriber: AccountManager().isUserAuthenticated), percentileStore: RemoteMessagingPercentileUserDefaultsStore(userDefaults: .standard), + surveyActionMapper: surveyActionMapper, dismissedMessageIds: remoteMessagingStore.fetchDismissedRemoteMessageIds() ) diff --git a/DuckDuckGo/SurveyURLBuilder.swift b/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift similarity index 86% rename from DuckDuckGo/SurveyURLBuilder.swift rename to DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift index 4d396c3a62..e3b0f3aa73 100644 --- a/DuckDuckGo/SurveyURLBuilder.swift +++ b/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift @@ -1,5 +1,5 @@ // -// SurveyURLBuilder.swift +// RemoteMessagingSurveyURLBuilder.swift // DuckDuckGo // // Copyright © 2023 DuckDuckGo. All rights reserved. @@ -17,18 +17,13 @@ // limitations under the License. // -#if NETWORK_PROTECTION - import Foundation import BrowserServicesKit +import RemoteMessaging import Core import Common -protocol SurveyURLBuilder { - func addSurveyParameters(to url: URL) -> URL -} - -struct DefaultSurveyURLBuilder: SurveyURLBuilder { +struct DefaultRemoteMessagingSurveyURLBuilder: RemoteMessagingSurveyActionMapping { enum SurveyURLParameters: String, CaseIterable { case atb = "atb" @@ -50,7 +45,7 @@ struct DefaultSurveyURLBuilder: SurveyURLBuilder { } // swiftlint:disable:next cyclomatic_complexity - func addSurveyParameters(to surveyURL: URL) -> URL { + func add(parameters: [RemoteMessagingSurveyActionParameter], to surveyURL: URL) -> URL { guard var components = URLComponents(string: surveyURL.absoluteString) else { assertionFailure("Could not build URL components from survey URL") return surveyURL @@ -58,7 +53,7 @@ struct DefaultSurveyURLBuilder: SurveyURLBuilder { var queryItems = components.queryItems ?? [] - for parameter in SurveyURLParameters.allCases { + for parameter in parameters { switch parameter { case .atb: if let atb = statisticsStore.atb { @@ -68,11 +63,7 @@ struct DefaultSurveyURLBuilder: SurveyURLBuilder { if let variant = statisticsStore.variant { queryItems.append(URLQueryItem(name: parameter.rawValue, value: variant)) } - case .daysSinceActivated: - if let daysSinceActivated = activationDateStore.daysSinceActivation() { - queryItems.append(URLQueryItem(name: parameter.rawValue, value: String(describing: daysSinceActivated))) - } - case .iosVersion: + case .osVersion: queryItems.append(URLQueryItem(name: parameter.rawValue, value: AppVersion.shared.osVersion)) case .appVersion: queryItems.append(URLQueryItem(name: parameter.rawValue, value: AppVersion.shared.versionAndBuildNumber)) @@ -83,6 +74,8 @@ struct DefaultSurveyURLBuilder: SurveyURLBuilder { if let daysSinceLastActive = activationDateStore.daysSinceLastActive() { queryItems.append(URLQueryItem(name: parameter.rawValue, value: String(describing: daysSinceLastActive))) } + case .daysInstalled: + break // TODO } } @@ -92,7 +85,7 @@ struct DefaultSurveyURLBuilder: SurveyURLBuilder { } func addPasswordsCountSurveyParameter(to surveyURL: URL) -> URL { - let surveyURLWithParameters = addSurveyParameters(to: surveyURL) + let surveyURLWithParameters = add(parameters: RemoteMessagingSurveyActionParameter.allCases, to: surveyURL) guard var components = URLComponents(string: surveyURLWithParameters.absoluteString), let bucket = passwordsCountBucket() else { return surveyURLWithParameters @@ -129,5 +122,3 @@ struct DefaultSurveyURLBuilder: SurveyURLBuilder { } } - -#endif From cdb2831763cc8e6b4e74e9f53287058f36408438 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Mon, 20 May 2024 15:49:37 -0700 Subject: [PATCH 2/7] Update test suite. --- DuckDuckGoTests/RemoteMessagingStoreTests.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/DuckDuckGoTests/RemoteMessagingStoreTests.swift b/DuckDuckGoTests/RemoteMessagingStoreTests.swift index 02e052c72b..191ae48b11 100644 --- a/DuckDuckGoTests/RemoteMessagingStoreTests.swift +++ b/DuckDuckGoTests/RemoteMessagingStoreTests.swift @@ -141,9 +141,11 @@ class RemoteMessagingStoreTests: XCTestCase { favoritesCount: 0, appTheme: "light", isWidgetInstalled: false, - isNetPWaitlistUser: false, - daysSinceNetPEnabled: -1), + daysSinceNetPEnabled: -1, + isPrivacyProEligibleUser: false, + isPrivacyProSubscriber: false), percentileStore: RemoteMessagingPercentileUserDefaultsStore(userDefaults: self.defaults), + surveyActionMapper: MockRemoteMessagingSurveyActionMapper(), dismissedMessageIds: [] ) @@ -160,3 +162,11 @@ class RemoteMessagingStoreTests: XCTestCase { } } } + +private final class MockRemoteMessagingSurveyActionMapper: RemoteMessagingSurveyActionMapping { + + func add(parameters: [RemoteMessagingSurveyActionParameter], to url: URL) -> URL { + return url + } + +} From 8074d54319399ce00cf6bfa43c61271e57e36bed Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Wed, 22 May 2024 09:07:40 -0700 Subject: [PATCH 3/7] Update BSK reference. --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 89d1176b13..defc7248c0 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,7 +33,7 @@ "location" : "https://github.com/DuckDuckGo/BrowserServicesKit", "state" : { "branch" : "sam/rmf-survey-updates", - "revision" : "0bb46a5c37b5741ed1eb8a806fb498755cad92bc" + "revision" : "2a4f30cd03cd2d2ebed058302300aacb4cbeb26a" } }, { From d999e219f8a3186cc314dc5dfedae5d91bb4a3e7 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Wed, 22 May 2024 09:13:44 -0700 Subject: [PATCH 4/7] Add survey parameter for install date. --- DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift b/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift index e3b0f3aa73..5f93bb9366 100644 --- a/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift +++ b/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift @@ -75,7 +75,10 @@ struct DefaultRemoteMessagingSurveyURLBuilder: RemoteMessagingSurveyActionMappin queryItems.append(URLQueryItem(name: parameter.rawValue, value: String(describing: daysSinceLastActive))) } case .daysInstalled: - break // TODO + if let installDate = statisticsStore.installDate, + let daysSinceInstall = Calendar.current.numberOfDaysBetween(installDate, and: Date()) { + queryItems.append(URLQueryItem(name: parameter.rawValue, value: String(describing: daysSinceInstall))) + } } } From d70f2a0a78d5894526041d873c8d919a522e74ea Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Wed, 22 May 2024 09:21:53 -0700 Subject: [PATCH 5/7] Remove unused survey parameters enum. --- DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift b/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift index 5f93bb9366..fc813befe8 100644 --- a/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift +++ b/DuckDuckGo/RemoteMessagingSurveyURLBuilder.swift @@ -25,16 +25,6 @@ import Common struct DefaultRemoteMessagingSurveyURLBuilder: RemoteMessagingSurveyActionMapping { - enum SurveyURLParameters: String, CaseIterable { - case atb = "atb" - case atbVariant = "var" - case daysSinceActivated = "delta" - case iosVersion = "mv" - case appVersion = "ddgv" - case hardwareModel = "mo" - case lastActiveDate = "da" - } - private let statisticsStore: StatisticsStore private let activationDateStore: VPNWaitlistActivationDateStore From 33a8a90ac06df4b035bf2d19f58a2cfb9a996ca3 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Thu, 23 May 2024 21:51:25 -0700 Subject: [PATCH 6/7] Resolve conflicts. --- .../xcshareddata/swiftpm/Package.resolved | 2 +- DuckDuckGo/RemoteMessaging.swift | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index e15137e791..bf0fc9a83a 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,7 +33,7 @@ "location" : "https://github.com/DuckDuckGo/BrowserServicesKit", "state" : { "branch" : "sam/rmf-survey-updates", - "revision" : "2a4f30cd03cd2d2ebed058302300aacb4cbeb26a" + "revision" : "f0550f3266b8d8c114d5f2fd9ce12248eecf59e7" } }, { diff --git a/DuckDuckGo/RemoteMessaging.swift b/DuckDuckGo/RemoteMessaging.swift index e6a20f9607..b7cb77202f 100644 --- a/DuckDuckGo/RemoteMessaging.swift +++ b/DuckDuckGo/RemoteMessaging.swift @@ -154,13 +154,9 @@ struct RemoteMessaging { case .success(let statusResponse): os_log("Successfully fetched remote messages", log: .remoteMessaging, type: .debug) - let isNetworkProtectionWaitlistUser: Bool - let daysSinceNetworkProtectionEnabled: Int + let isPrivacyProSubscriber = AppDependencyProvider.shared.subscriptionManager.accountManager.isUserAuthenticated + let canPurchase = AppDependencyProvider.shared.subscriptionManager.canPurchase -#if NETWORK_PROTECTION - let vpnAccess = AppDependencyProvider.shared.networkProtectionAccessController - let accessType = vpnAccess.networkProtectionAccessType() - let isVPNActivated = AppDependencyProvider.shared.networkProtectionKeychainTokenStore.isFeatureActivated let activationDateStore = DefaultVPNWaitlistActivationDateStore() let daysSinceNetworkProtectionEnabled = activationDateStore.daysSinceActivation() ?? -1 let surveyActionMapper = DefaultRemoteMessagingSurveyURLBuilder(statisticsStore: statisticsStore) @@ -176,8 +172,8 @@ struct RemoteMessaging { appTheme: AppUserDefaults().currentThemeName.rawValue, isWidgetInstalled: isWidgetInstalled, daysSinceNetPEnabled: daysSinceNetworkProtectionEnabled, - isPrivacyProEligibleUser: SubscriptionPurchaseEnvironment.canPurchase, - isPrivacyProSubscriber: AccountManager().isUserAuthenticated), + isPrivacyProEligibleUser: canPurchase, + isPrivacyProSubscriber: isPrivacyProSubscriber), percentileStore: RemoteMessagingPercentileUserDefaultsStore(userDefaults: .standard), surveyActionMapper: surveyActionMapper, dismissedMessageIds: remoteMessagingStore.fetchDismissedRemoteMessageIds() From 7179cf539c562cc3f91fa3f05e57c54f5cda207b Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Thu, 23 May 2024 22:01:25 -0700 Subject: [PATCH 7/7] Set BSK version to 147.0.0. --- DuckDuckGo.xcodeproj/project.pbxproj | 4 ++-- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 9eb038f44f..b2423f048c 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -9829,8 +9829,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit"; requirement = { - branch = "sam/rmf-survey-updates"; - kind = branch; + kind = exactVersion; + version = 147.0.0; }; }; 9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index bf0fc9a83a..154c2671aa 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/DuckDuckGo/BrowserServicesKit", "state" : { - "branch" : "sam/rmf-survey-updates", - "revision" : "f0550f3266b8d8c114d5f2fd9ce12248eecf59e7" + "revision" : "610a58a77fefe82f8541d4a7f998ef2a4609a068", + "version" : "147.0.0" } }, {