瀏覽代碼

feat:评分引导

kailen 2 月之前
父節點
當前提交
aabe4bf0ff
共有 1 個文件被更改,包括 14 次插入1 次删除
  1. 14 1
      TSLiveWallpaper/AppDelegate.swift

+ 14 - 1
TSLiveWallpaper/AppDelegate.swift

@@ -5,11 +5,12 @@
 //  Created by 100Years on 2024/12/19.i
 //
 
+import ADManager
 import AppTrackingTransparency
 import GoogleMobileAds
+import StoreKit
 import TSVideoKit
 import UIKit
-import ADManager
 
 @main
 class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -21,6 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         window?.makeKeyAndVisible()
         goToLoadVC()
         initBaseDatas()
+        downloadNotifaction()
         return true
     }
 
@@ -52,6 +54,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         }
     }
 
+    @objc func recordData() {
+        if UserDefaults.standard.value(forKey: "CachedTag") == nil {
+            UserDefaults.standard.setValue("1", forKey: "CachedTag")
+            SKStoreReviewController.requestReview()
+        }
+    }
+
+    func downloadNotifaction() {
+        NotificationCenter.default.addObserver(self, selector: #selector(recordData), name: kGroupDownloadFinishNotifactionName, object: nil)
+    }
+
     static func requestAdTrack() {
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
             ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in