ThimraTV/MoviaBox/AppDelegate/AppDelegate+OpenApp.swift
2025-04-28 15:00:29 +08:00

61 lines
1.7 KiB
Swift

//
// AppDelegate+OpenApp.swift
// MoviaBox
//
// Created by on 2025/4/25.
//
import UIKit
extension AppDelegate {
func registerAPNS() {
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: [.badge, .sound, .alert]) { grant, error in
if grant {
SPRewardsAPI.requestUploadOpenNotify(completer: nil)
}
}
UIApplication.shared.registerForRemoteNotifications()
}
}
extension AppDelegate: UNUserNotificationCenterDelegate {
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// NIMSDK.shared().updateApnsToken(deviceToken)
}
///APP
// func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
// completionHandler([.badge])
// }
///app
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
completionHandler()
}
}
extension SceneDelegate {
///URLAPP
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
}
///UniversalLink app
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
guard let webpageURL = userActivity.webpageURL else { return }
guard let query = webpageURL.query else { return }
spLog(message: query)
}
}