From 509aa81f8a92623f97f998376650abf554181d28 Mon Sep 17 00:00:00 2001 From: zjx Date: Thu, 19 Jun 2025 10:49:17 +0800 Subject: [PATCH] 1 --- MoviaBox.xcodeproj/project.pbxproj | 4 ++-- MoviaBox/AppDelegate/AppDelegate+APNS.swift | 12 ++++++++++++ MoviaBox/AppDelegate/SceneDelegate.swift | 1 + MoviaBox/Base/Networking/API/SPRewardsAPI.swift | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/MoviaBox.xcodeproj/project.pbxproj b/MoviaBox.xcodeproj/project.pbxproj index fbaa6e1..1d28052 100644 --- a/MoviaBox.xcodeproj/project.pbxproj +++ b/MoviaBox.xcodeproj/project.pbxproj @@ -257,7 +257,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.9; + MARKETING_VERSION = 1.0.7; PRODUCT_BUNDLE_IDENTIFIER = com.thimratv.app; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -303,7 +303,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.9; + MARKETING_VERSION = 1.0.7; PRODUCT_BUNDLE_IDENTIFIER = com.thimratv.app; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/MoviaBox/AppDelegate/AppDelegate+APNS.swift b/MoviaBox/AppDelegate/AppDelegate+APNS.swift index 5056a42..882e725 100644 --- a/MoviaBox/AppDelegate/AppDelegate+APNS.swift +++ b/MoviaBox/AppDelegate/AppDelegate+APNS.swift @@ -42,6 +42,7 @@ extension AppDelegate { Self.haveBeenShownAPNS = true SPAPPTool.sceneDelegate?.retryHandleOpenAppMessage() } + self.uploadNoticeStatus() } UIApplication.shared.registerForRemoteNotifications() } @@ -51,6 +52,17 @@ extension AppDelegate { view.show() } + ///更新通知状态 + func uploadNoticeStatus() { + UNUserNotificationCenter.current().getNotificationSettings { settings in + if settings.authorizationStatus == .authorized { + SPRewardsAPI.requestUploadNoticeStatus(status: true) + } else if settings.authorizationStatus == .denied { + SPRewardsAPI.requestUploadNoticeStatus(status: false) + } + } + } + } extension AppDelegate: UNUserNotificationCenterDelegate { diff --git a/MoviaBox/AppDelegate/SceneDelegate.swift b/MoviaBox/AppDelegate/SceneDelegate.swift index c7cd35a..3aa7d1e 100644 --- a/MoviaBox/AppDelegate/SceneDelegate.swift +++ b/MoviaBox/AppDelegate/SceneDelegate.swift @@ -65,6 +65,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func sceneWillEnterForeground(_ scene: UIScene) { // Called as the scene transitions from the background to the foreground. // Use this method to undo the changes made on entering the background. + SPAPPTool.appDelegate?.uploadNoticeStatus() DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { self.handleOpenAppMessage(webpageURL: nil) diff --git a/MoviaBox/Base/Networking/API/SPRewardsAPI.swift b/MoviaBox/Base/Networking/API/SPRewardsAPI.swift index b3c17f8..c5b91d8 100644 --- a/MoviaBox/Base/Networking/API/SPRewardsAPI.swift +++ b/MoviaBox/Base/Networking/API/SPRewardsAPI.swift @@ -22,4 +22,18 @@ class SPRewardsAPI: NSObject { } } + ///上传通知状态 + static func requestUploadNoticeStatus(status: Bool) { + var param = SPNetworkParameters(path: "/customer/uploadNoticeStatus") + param.isLoding = false + param.isToast = false + param.parameters = [ + "is_open_notice" : status ? 1 : 0 + ] + + SPNetwork.request(parameters: param) { (response: SPNetworkResponse) in + + } + } + }