Browse Source

Refine Settings premium and account actions to match expected UX.

Remove Restore Purchases from Settings, fix duplicate Upgrade label rendering, route Upgrade tap to the paywall, and rename account status copy to Zoom account connected.

Made-with: Cursor
huzaifahayat12 3 tháng trước cách đây
mục cha
commit
93dfc8dca9
1 tập tin đã thay đổi với 9 bổ sung42 xóa
  1. 9 42
      zoom_app/ViewController.swift

+ 9 - 42
zoom_app/ViewController.swift

@@ -236,7 +236,7 @@ class ViewController: NSViewController {
     private var nextSchedulerButtonTag: Int = 1
     private var nextSchedulerButtonTag: Int = 1
     private weak var settingsDarkModeSwitch: NSSwitch?
     private weak var settingsDarkModeSwitch: NSSwitch?
     private weak var settingsUpgradeButton: NSButton?
     private weak var settingsUpgradeButton: NSButton?
-    private weak var settingsRestoreButton: NSButton?
+    private weak var settingsUpgradeTitleLabel: NSTextField?
     private weak var settingsGoogleActionButton: NSButton?
     private weak var settingsGoogleActionButton: NSButton?
     private weak var topBarPremiumButton: NSButton?
     private weak var topBarPremiumButton: NSButton?
     private weak var topBarAuthButton: NSButton?
     private weak var topBarAuthButton: NSButton?
@@ -2806,11 +2806,7 @@ class ViewController: NSViewController {
         upgradeButton.widthAnchor.constraint(equalTo: stack.widthAnchor).isActive = true
         upgradeButton.widthAnchor.constraint(equalTo: stack.widthAnchor).isActive = true
         settingsUpgradeButton = upgradeButton
         settingsUpgradeButton = upgradeButton
 
 
-        let restoreButton = makeSettingsActionButton(icon: "↺", title: "Restore Purchases", action: .restorePurchases)
-        stack.addArrangedSubview(restoreButton)
-        restoreButton.widthAnchor.constraint(equalTo: stack.widthAnchor).isActive = true
-        settingsRestoreButton = restoreButton
-        stack.setCustomSpacing(24, after: restoreButton)
+        stack.setCustomSpacing(24, after: upgradeButton)
 
 
         let legalTitle = textLabel("Help & Legal", font: .systemFont(ofSize: 16, weight: .semibold), color: primaryText)
         let legalTitle = textLabel("Help & Legal", font: .systemFont(ofSize: 16, weight: .semibold), color: primaryText)
         stack.addArrangedSubview(legalTitle)
         stack.addArrangedSubview(legalTitle)
@@ -2857,7 +2853,6 @@ class ViewController: NSViewController {
     private enum SettingsAction: Int {
     private enum SettingsAction: Int {
         case shareApp = 1
         case shareApp = 1
         case upgrade = 2
         case upgrade = 2
-        case restorePurchases = 3
         case privacyPolicy = 4
         case privacyPolicy = 4
         case support = 5
         case support = 5
         case termsOfServices = 6
         case termsOfServices = 6
@@ -2898,7 +2893,7 @@ class ViewController: NSViewController {
         styleSurface(row, borderColor: palette.inputBorder, borderWidth: 1, shadow: false)
         styleSurface(row, borderColor: palette.inputBorder, borderWidth: 1, shadow: false)
 
 
         let signedIn = isUserLoggedIn()
         let signedIn = isUserLoggedIn()
-        let titleText = signedIn ? "Google account connected" : "Google account not connected"
+        let titleText = signedIn ? "Zoom account connected" : "Zoom account not connected"
         let subtitleText = signedIn ? "Signed in" : "Sign in to sync your meetings and calendar."
         let subtitleText = signedIn ? "Signed in" : "Sign in to sync your meetings and calendar."
 
 
         let title = textLabel(titleText, font: NSFont.systemFont(ofSize: 15, weight: .semibold), color: primaryText)
         let title = textLabel(titleText, font: NSFont.systemFont(ofSize: 15, weight: .semibold), color: primaryText)
@@ -2943,6 +2938,9 @@ class ViewController: NSViewController {
 
 
         let iconLabel = textLabel(icon, font: NSFont.systemFont(ofSize: 17, weight: .medium), color: primaryText)
         let iconLabel = textLabel(icon, font: NSFont.systemFont(ofSize: 17, weight: .medium), color: primaryText)
         let titleLabel = textLabel(title, font: NSFont.systemFont(ofSize: 15, weight: .semibold), color: primaryText)
         let titleLabel = textLabel(title, font: NSFont.systemFont(ofSize: 15, weight: .semibold), color: primaryText)
+        if action == .upgrade {
+            settingsUpgradeTitleLabel = titleLabel
+        }
         button.addSubview(iconLabel)
         button.addSubview(iconLabel)
         button.addSubview(titleLabel)
         button.addSubview(titleLabel)
         NSLayoutConstraint.activate([
         NSLayoutConstraint.activate([
@@ -2961,8 +2959,6 @@ class ViewController: NSViewController {
             showSimpleAlert(title: "Share", message: "Share action placeholder (match reference app behavior next).")
             showSimpleAlert(title: "Share", message: "Share action placeholder (match reference app behavior next).")
         case .upgrade:
         case .upgrade:
             settingsUpgradePremiumTapped()
             settingsUpgradePremiumTapped()
-        case .restorePurchases:
-            settingsRestorePurchasesTapped()
         case .privacyPolicy:
         case .privacyPolicy:
             showSimpleAlert(title: "Privacy Policy", message: "Add your Privacy Policy URL in the app and open it here.")
             showSimpleAlert(title: "Privacy Policy", message: "Add your Privacy Policy URL in the app and open it here.")
         case .support:
         case .support:
@@ -3039,10 +3035,10 @@ class ViewController: NSViewController {
     @MainActor
     @MainActor
     private func updatePremiumButtons() {
     private func updatePremiumButtons() {
         let isPremium = storeKitCoordinator.hasPremiumAccess
         let isPremium = storeKitCoordinator.hasPremiumAccess
-        settingsUpgradeButton?.title = isPremium ? "Premium Active" : "Upgrade"
+        settingsUpgradeButton?.title = ""
+        settingsUpgradeTitleLabel?.stringValue = isPremium ? "Premium Active" : "Upgrade"
         settingsUpgradeButton?.isEnabled = isPremium == false
         settingsUpgradeButton?.isEnabled = isPremium == false
         settingsUpgradeButton?.alphaValue = isPremium ? 0.6 : 1.0
         settingsUpgradeButton?.alphaValue = isPremium ? 0.6 : 1.0
-        settingsRestoreButton?.isEnabled = true
 
 
         updateTopBarPremiumButton()
         updateTopBarPremiumButton()
     }
     }
@@ -3120,36 +3116,7 @@ class ViewController: NSViewController {
 
 
     @objc private func settingsUpgradePremiumTapped() {
     @objc private func settingsUpgradePremiumTapped() {
         guard storeKitCoordinator.hasPremiumAccess == false else { return }
         guard storeKitCoordinator.hasPremiumAccess == false else { return }
-        settingsUpgradeButton?.isEnabled = false
-        settingsUpgradeButton?.alphaValue = 0.6
-        Task { [weak self] in
-            guard let self else { return }
-            let result = await self.storeKitCoordinator.purchase(plan: .lifetime)
-            await MainActor.run {
-                self.updatePremiumButtons()
-                switch result {
-                case .success:
-                    self.showSimpleAlert(title: "Purchase Complete", message: "Premium has been unlocked successfully.")
-                case .pending:
-                    self.showSimpleAlert(title: "Purchase Pending", message: "Your purchase is pending approval. You can continue once it completes.")
-                case .cancelled:
-                    break
-                case .failed(let message):
-                    self.showSimpleAlert(title: "Purchase Failed", message: message)
-                }
-            }
-        }
-    }
-
-    @objc private func settingsRestorePurchasesTapped() {
-        Task { [weak self] in
-            guard let self else { return }
-            let message = await self.storeKitCoordinator.restorePurchases()
-            await MainActor.run {
-                self.updatePremiumButtons()
-                self.showSimpleAlert(title: "Restore Purchases", message: message)
-            }
-        }
+        showPaywall()
     }
     }
 
 
     // MARK: - Paywall (ported from meetings_app)
     // MARK: - Paywall (ported from meetings_app)