Skip to content

Commit

Permalink
Daniel/subscriptions/3.manage subscription (#2336)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/72649045549333/1205054784245717/f

Implement Subscription Management View
Adds labels to the transaction progress box and reduces the opacity of the background view.
  • Loading branch information
afterxleep authored Jan 17, 2024
1 parent 0631759 commit eb1dae7
Show file tree
Hide file tree
Showing 44 changed files with 627 additions and 281 deletions.
4 changes: 2 additions & 2 deletions Core/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public enum FeatureFlag: String {
case networkProtection
case networkProtectionWaitlistAccess
case networkProtectionWaitlistActive
case privacyPro
case subscription
}

extension FeatureFlag: FeatureFlagSourceProviding {
public var source: FeatureFlagSource {
switch self {
case .debugMenu, .appTrackingProtection, .privacyPro:
case .debugMenu, .appTrackingProtection, .subscription:
return .internalOnly
case .sync:
return .remoteReleasable(.subfeature(SyncSubfeature.level0ShowSync))
Expand Down
2 changes: 1 addition & 1 deletion Core/UserDefaultsPropertyWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public struct UserDefaultsWrapper<T> {

case privacyConfigCustomURL = "com.duckduckgo.ios.privacyConfigCustomURL"

case privacyProHasActiveSubscription = "com.duckduckgo.ios.privacyPro.hasActiveSubscription"
case subscriptionIsActive = "com.duckduckgo.ios.subscruption.isActive"
}

private let key: Key
Expand Down
32 changes: 20 additions & 12 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -768,16 +768,17 @@
CBEFB9142AE0844700DEDE7B /* CriticalAlerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBEFB9102ADFFE7900DEDE7B /* CriticalAlerts.swift */; };
CBFCB30E2B2CD47800253E9E /* ConfigurationURLDebugViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBFCB30D2B2CD47800253E9E /* ConfigurationURLDebugViewController.swift */; };
D63657192A7BAE7C001AF19D /* EmailManagerRequestDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63657182A7BAE7C001AF19D /* EmailManagerRequestDelegate.swift */; };
D652498E2B515A6A0056B0DE /* SubscriptionSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D652498D2B515A6A0056B0DE /* SubscriptionSettingsViewModel.swift */; };
D664C7B62B289AA200CBFA76 /* SubscriptionFlowViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D664C7942B289AA000CBFA76 /* SubscriptionFlowViewModel.swift */; };
D664C7B72B289AA200CBFA76 /* PrivacyPro.storekit in Resources */ = {isa = PBXBuildFile; fileRef = D664C7952B289AA000CBFA76 /* PrivacyPro.storekit */; };
D664C7B72B289AA200CBFA76 /* Subscription.storekit in Resources */ = {isa = PBXBuildFile; fileRef = D664C7952B289AA000CBFA76 /* Subscription.storekit */; };
D664C7B92B289AA200CBFA76 /* WKUserContentController+Handler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D664C7982B289AA000CBFA76 /* WKUserContentController+Handler.swift */; };
D664C7C72B289AA200CBFA76 /* PurchaseInProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D664C7AD2B289AA000CBFA76 /* PurchaseInProgressView.swift */; };
D664C7C82B289AA200CBFA76 /* SubscriptionFlowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D664C7AE2B289AA000CBFA76 /* SubscriptionFlowView.swift */; };
D664C7C92B289AA200CBFA76 /* HeadlessWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D664C7AF2B289AA000CBFA76 /* HeadlessWebView.swift */; };
D664C7CC2B289AA200CBFA76 /* SubscriptionPagesUserScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = D664C7B32B289AA000CBFA76 /* SubscriptionPagesUserScript.swift */; };
D664C7CE2B289AA200CBFA76 /* SubscriptionPagesUseSubscriptionFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = D664C7B52B289AA000CBFA76 /* SubscriptionPagesUseSubscriptionFeature.swift */; };
D664C7DD2B28A02800CBFA76 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D664C7DC2B28A02800CBFA76 /* StoreKit.framework */; };
D69FBF762B28BE3600B505F1 /* SettingsPrivacyProView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D69FBF752B28BE3600B505F1 /* SettingsPrivacyProView.swift */; };
D69FBF762B28BE3600B505F1 /* SettingsSubscriptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D69FBF752B28BE3600B505F1 /* SettingsSubscriptionView.swift */; };
D6D12C9F2B291CA90054390C /* URL+Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D12C8B2B291CA90054390C /* URL+Subscription.swift */; };
D6D12CA02B291CA90054390C /* SubscriptionPurchaseEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D12C8C2B291CA90054390C /* SubscriptionPurchaseEnvironment.swift */; };
D6D12CA12B291CA90054390C /* Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D12C8D2B291CA90054390C /* Logging.swift */; };
Expand Down Expand Up @@ -809,6 +810,7 @@
D6E83C662B23936F006C8AFB /* SettingsDebugView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E83C652B23936F006C8AFB /* SettingsDebugView.swift */; };
D6E83C682B23B6A3006C8AFB /* FontSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E83C672B23B6A3006C8AFB /* FontSettings.swift */; };
D6F93E3C2B4FFA97004C268D /* SubscriptionDebugViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F93E3B2B4FFA97004C268D /* SubscriptionDebugViewController.swift */; };
D6F93E3E2B50A8A0004C268D /* SubscriptionSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F93E3D2B50A8A0004C268D /* SubscriptionSettingsView.swift */; };
EA39B7E2268A1A35000C62CD /* privacy-reference-tests in Resources */ = {isa = PBXBuildFile; fileRef = EA39B7E1268A1A35000C62CD /* privacy-reference-tests */; };
EAB19EDA268963510015D3EA /* DomainMatchingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB19ED9268963510015D3EA /* DomainMatchingTests.swift */; };
EE0153E12A6EABE0002A8B26 /* NetworkProtectionConvenienceInitialisers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0153E02A6EABE0002A8B26 /* NetworkProtectionConvenienceInitialisers.swift */; };
Expand Down Expand Up @@ -2407,16 +2409,17 @@
CBF14FC627970C8A001D94D0 /* HomeMessageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeMessageCollectionViewCell.swift; sourceTree = "<group>"; };
CBFCB30D2B2CD47800253E9E /* ConfigurationURLDebugViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationURLDebugViewController.swift; sourceTree = "<group>"; };
D63657182A7BAE7C001AF19D /* EmailManagerRequestDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmailManagerRequestDelegate.swift; sourceTree = "<group>"; };
D652498D2B515A6A0056B0DE /* SubscriptionSettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionSettingsViewModel.swift; sourceTree = "<group>"; };
D664C7942B289AA000CBFA76 /* SubscriptionFlowViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionFlowViewModel.swift; sourceTree = "<group>"; };
D664C7952B289AA000CBFA76 /* PrivacyPro.storekit */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PrivacyPro.storekit; sourceTree = "<group>"; };
D664C7952B289AA000CBFA76 /* Subscription.storekit */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Subscription.storekit; sourceTree = "<group>"; };
D664C7982B289AA000CBFA76 /* WKUserContentController+Handler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WKUserContentController+Handler.swift"; sourceTree = "<group>"; };
D664C7AD2B289AA000CBFA76 /* PurchaseInProgressView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PurchaseInProgressView.swift; sourceTree = "<group>"; };
D664C7AE2B289AA000CBFA76 /* SubscriptionFlowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionFlowView.swift; sourceTree = "<group>"; };
D664C7AF2B289AA000CBFA76 /* HeadlessWebView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeadlessWebView.swift; sourceTree = "<group>"; };
D664C7B32B289AA000CBFA76 /* SubscriptionPagesUserScript.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionPagesUserScript.swift; sourceTree = "<group>"; };
D664C7B52B289AA000CBFA76 /* SubscriptionPagesUseSubscriptionFeature.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionPagesUseSubscriptionFeature.swift; sourceTree = "<group>"; };
D664C7DC2B28A02800CBFA76 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
D69FBF752B28BE3600B505F1 /* SettingsPrivacyProView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsPrivacyProView.swift; sourceTree = "<group>"; };
D69FBF752B28BE3600B505F1 /* SettingsSubscriptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSubscriptionView.swift; sourceTree = "<group>"; };
D6D12C8B2B291CA90054390C /* URL+Subscription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "URL+Subscription.swift"; sourceTree = "<group>"; };
D6D12C8C2B291CA90054390C /* SubscriptionPurchaseEnvironment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionPurchaseEnvironment.swift; sourceTree = "<group>"; };
D6D12C8D2B291CA90054390C /* Logging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Logging.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2448,6 +2451,7 @@
D6E83C652B23936F006C8AFB /* SettingsDebugView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsDebugView.swift; sourceTree = "<group>"; };
D6E83C672B23B6A3006C8AFB /* FontSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontSettings.swift; sourceTree = "<group>"; };
D6F93E3B2B4FFA97004C268D /* SubscriptionDebugViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionDebugViewController.swift; sourceTree = "<group>"; };
D6F93E3D2B50A8A0004C268D /* SubscriptionSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionSettingsView.swift; sourceTree = "<group>"; };
EA39B7E1268A1A35000C62CD /* privacy-reference-tests */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "privacy-reference-tests"; path = "submodules/privacy-reference-tests"; sourceTree = SOURCE_ROOT; };
EAB19ED9268963510015D3EA /* DomainMatchingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DomainMatchingTests.swift; sourceTree = "<group>"; };
EE0153E02A6EABE0002A8B26 /* NetworkProtectionConvenienceInitialisers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionConvenienceInitialisers.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3766,7 +3770,7 @@
85AE668C20971FCA0014CF04 /* Notifications */,
F1C4A70C1E5771F800A6CA1B /* OmniBar */,
F1AE54DB1F0425BB00D9A700 /* Privacy */,
D664C7922B289AA000CBFA76 /* PrivacyPro */,
D664C7922B289AA000CBFA76 /* Subscription */,
F1DF09502B039E6E008CC908 /* PrivacyDashboard */,
02ECEC602A965074009F0654 /* PrivacyInfo.xcprivacy */,
C1B7B51D28941F160098FD6A /* RemoteMessaging */,
Expand Down Expand Up @@ -4503,23 +4507,24 @@
name = Resources;
sourceTree = "<group>";
};
D664C7922B289AA000CBFA76 /* PrivacyPro */ = {
D664C7922B289AA000CBFA76 /* Subscription */ = {
isa = PBXGroup;
children = (
D664C7952B289AA000CBFA76 /* PrivacyPro.storekit */,
D664C7952B289AA000CBFA76 /* Subscription.storekit */,
D664C7932B289AA000CBFA76 /* ViewModel */,
D664C7AC2B289AA000CBFA76 /* Views */,
D664C7B02B289AA000CBFA76 /* UserScripts */,
D664C7962B289AA000CBFA76 /* Extensions */,
D6D12C8A2B291CA90054390C /* Subscription */,
);
path = PrivacyPro;
path = Subscription;
sourceTree = "<group>";
};
D664C7932B289AA000CBFA76 /* ViewModel */ = {
isa = PBXGroup;
children = (
D664C7942B289AA000CBFA76 /* SubscriptionFlowViewModel.swift */,
D652498D2B515A6A0056B0DE /* SubscriptionSettingsViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
Expand All @@ -4535,9 +4540,10 @@
D664C7AC2B289AA000CBFA76 /* Views */ = {
isa = PBXGroup;
children = (
D664C7AF2B289AA000CBFA76 /* HeadlessWebView.swift */,
D664C7AD2B289AA000CBFA76 /* PurchaseInProgressView.swift */,
D664C7AE2B289AA000CBFA76 /* SubscriptionFlowView.swift */,
D664C7AF2B289AA000CBFA76 /* HeadlessWebView.swift */,
D6F93E3D2B50A8A0004C268D /* SubscriptionSettingsView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -4612,7 +4618,7 @@
D6E83C3C2B1F2C03006C8AFB /* SettingsLoginsView.swift */,
D6E83C402B1FC285006C8AFB /* SettingsAppeareanceView.swift */,
D6E83C592B2213ED006C8AFB /* SettingsPrivacyView.swift */,
D69FBF752B28BE3600B505F1 /* SettingsPrivacyProView.swift */,
D69FBF752B28BE3600B505F1 /* SettingsSubscriptionView.swift */,
D6E83C5D2B224676006C8AFB /* SettingsCustomizeView.swift */,
D6E83C612B23298B006C8AFB /* SettingsMoreView.swift */,
D6E83C632B238432006C8AFB /* SettingsAboutView.swift */,
Expand Down Expand Up @@ -6081,7 +6087,7 @@
1EE411FD2858B9300003FE64 /* dark-trackers-2.json in Resources */,
AA4D6ABC23DE4D15007E8790 /* [email protected] in Resources */,
98D98A9B25ED954100D8E3DF /* BrowsingMenuButton.xib in Resources */,
D664C7B72B289AA200CBFA76 /* PrivacyPro.storekit in Resources */,
D664C7B72B289AA200CBFA76 /* Subscription.storekit in Resources */,
AA4D6AA823DE4CC4007E8790 /* [email protected] in Resources */,
AA4D6AE723DE4D33007E8790 /* [email protected] in Resources */,
1EE412002858B9300003FE64 /* dark-shield-dot.json in Resources */,
Expand Down Expand Up @@ -6563,7 +6569,7 @@
1E908BF329827C480008C8F3 /* AutoconsentManagement.swift in Sources */,
CB9B8739278C8E72001F4906 /* WidgetEducationViewController.swift in Sources */,
F4D9C4FA25117A0F00814B71 /* HomeMessageStorage.swift in Sources */,
D69FBF762B28BE3600B505F1 /* SettingsPrivacyProView.swift in Sources */,
D69FBF762B28BE3600B505F1 /* SettingsSubscriptionView.swift in Sources */,
D664C7CC2B289AA200CBFA76 /* SubscriptionPagesUserScript.swift in Sources */,
AA3D854523D9942200788410 /* AppIconSettingsViewController.swift in Sources */,
85C297042476C1FD0063A335 /* DaxDialogsSettings.swift in Sources */,
Expand Down Expand Up @@ -6606,6 +6612,7 @@
98AA92B32456FBE100ED4B9E /* SearchFieldContainerView.swift in Sources */,
3157B43827F4C8490042D3D7 /* FaviconsHelper.swift in Sources */,
85F200042216F5D8006BB258 /* FindInPageView.swift in Sources */,
D652498E2B515A6A0056B0DE /* SubscriptionSettingsViewModel.swift in Sources */,
8548D95E25262B1B005AAE49 /* ViewHighlighter.swift in Sources */,
F4D7221026F29A70007D6193 /* BookmarkDetailsCell.swift in Sources */,
D6D12CA22B291CA90054390C /* AccountManager.swift in Sources */,
Expand All @@ -6618,6 +6625,7 @@
C13B32D22A0E750700A59236 /* AutofillSettingStatus.swift in Sources */,
D6D12CA52B291CAA0054390C /* AppStorePurchaseFlow.swift in Sources */,
F4F6DFB426E6B63700ED7E12 /* BookmarkFolderCell.swift in Sources */,
D6F93E3E2B50A8A0004C268D /* SubscriptionSettingsView.swift in Sources */,
851B12CC22369931004781BC /* AtbAndVariantCleanup.swift in Sources */,
85F2FFCF2211F8E5006BB258 /* TabSwitcherViewController+KeyCommands.swift in Sources */,
3157B43327F497E90042D3D7 /* SaveLoginView.swift in Sources */,
Expand Down
45 changes: 0 additions & 45 deletions DuckDuckGo/PrivacyPro/Views/PurchaseInProgressView.swift

This file was deleted.

9 changes: 4 additions & 5 deletions DuckDuckGo/SettingsAboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ struct SettingsAboutView: View {

SettingsCellView(label: UserText.settingsAboutDDG,
action: { viewModel.presentLegacyView(.about) },
asLink: true,
disclosureIndicator: true)
disclosureIndicator: true,
isButton: true)

SettingsCellView(label: UserText.settingsVersion,
accesory: .rightDetail(viewModel.state.version),
asLink: true)
accesory: .rightDetail(viewModel.state.version))

SettingsCellView(label: UserText.settingsFeedback,
action: { viewModel.presentLegacyView(.feedback) },
asLink: true)
isButton: true)

}

Expand Down
8 changes: 4 additions & 4 deletions DuckDuckGo/SettingsAppeareanceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ struct SettingsAppeareanceView: View {
SettingsCellView(label: UserText.settingsIcon,
action: { viewModel.presentLegacyView(.appIcon ) },
accesory: .image(image),
asLink: true,
disclosureIndicator: true)
disclosureIndicator: true,
isButton: true)

SettingsPickerCellView(label: UserText.settingsFirebutton,
options: FireButtonAnimationType.allCases,
Expand All @@ -46,8 +46,8 @@ struct SettingsAppeareanceView: View {
SettingsCellView(label: UserText.settingsText,
action: { viewModel.presentLegacyView(.textSize) },
accesory: .rightDetail("\(viewModel.state.textSize.size)%"),
asLink: true,
disclosureIndicator: true)
disclosureIndicator: true,
isButton: true)
}

if viewModel.state.addressbar.enabled {
Expand Down
Loading

0 comments on commit eb1dae7

Please sign in to comment.