Procházet zdrojové kódy

fix(settings): use in-app StoreKit review for Rate Us

Previously, tapping Rate Us opened App Store URLs (RateUsURL, hardcoded fallback, workspace open). That did not reliably present Apple’s rating UI and diverged from other flows that use SKStoreReviewController.

Changes:
- Implement openRateUsDestination() by calling SKStoreReviewController.requestReview() so Settings matches the native review prompt used elsewhere (e.g. requestAppRatingIfEligible).
- Set userHasRatedDefaultsKey after prompting so automated rating prompts do not overlap with explicit user-initiated taps.
- Remove URL candidate logic and extractAppleAppID helper, which existed only for the old App Store fallback path.

Co-authored-by: Cursor <cursoragent@cursor.com>
Uzair Tahir před 2 měsíci
rodič
revize
9a742ddabd
1 změnil soubory, kde provedl 2 přidání a 42 odebrání
  1. 2 42
      meetings_app/ViewController.swift

+ 2 - 42
meetings_app/ViewController.swift

@@ -1155,48 +1155,8 @@ private extension ViewController {
     }
 
     private func openRateUsDestination() {
-        let configured = (Bundle.main.object(forInfoDictionaryKey: "RateUsURL") as? String)?
-            .trimmingCharacters(in: .whitespacesAndNewlines)
-        let placeholder = (Bundle.main.object(forInfoDictionaryKey: "AppLaunchPlaceholderURL") as? String)?
-            .trimmingCharacters(in: .whitespacesAndNewlines)
-        let hardcodedRateUsURL = "https://apps.apple.com/pk/app/meeting-app-for-google-meet/id6654920763?mt=12"
-
-        var candidateStrings = [String]()
-        if let configured, !configured.isEmpty {
-            candidateStrings.append(configured)
-            if let appID = extractAppleAppID(from: configured) {
-                candidateStrings.append("macappstore://apps.apple.com/app/id\(appID)")
-                candidateStrings.append("macappstore://itunes.apple.com/app/id\(appID)")
-            }
-        }
-        candidateStrings.append(hardcodedRateUsURL)
-        candidateStrings.append("macappstore://apps.apple.com/app/id6654920763")
-        candidateStrings.append("macappstore://itunes.apple.com/app/id6654920763")
-        if let placeholder, !placeholder.isEmpty {
-            candidateStrings.append(placeholder)
-        }
-
-        for candidate in candidateStrings {
-            guard let url = URL(string: candidate) else { continue }
-            if NSWorkspace.shared.open(url) {
-                return
-            }
-        }
-
-        showSimpleAlert(
-            title: "Unable to Open Rate Page",
-            message: "Could not open the App Store rating page. Please try again."
-        )
-
-        requestAppRatingIfEligible(markAsRated: true)
-    }
-
-    private func extractAppleAppID(from urlString: String) -> String? {
-        guard let match = urlString.range(of: "id[0-9]+", options: .regularExpression) else {
-            return nil
-        }
-        let token = String(urlString[match])
-        return String(token.dropFirst())
+        SKStoreReviewController.requestReview()
+        UserDefaults.standard.set(true, forKey: userHasRatedDefaultsKey)
     }
 
     private func openInSafari(url: URL) {