Commit 02c804cd11ebb470b59bcfdf59a6df40a0ad8f10

Authored by 权海
1 parent f0bf6ad8

feat(ui):修复runner报错

... ... @@ -54,6 +54,35 @@ final class PlatformHostApiImpl: PlatformHostApi {
return false
#endif
}
func requestNotificationAuth(completion: @escaping (Result<Bool, any Error>) -> Void) {
Task {
let center = UNUserNotificationCenter.current()
let settings = await center.notificationSettings()
switch settings.authorizationStatus {
case .authorized, .provisional, .ephemeral:
completion(.success(true))
case .notDetermined:
do {
let granted = try await center.requestAuthorization(options: [.alert, .sound, .badge])
if granted {
await MainActor.run {
UIApplication.shared.registerForRemoteNotifications()
}
}
completion(.success(granted))
} catch {
completion(.failure(error))
}
case .denied:
completion(.success(false))
@unknown default:
completion(.success(false))
}
}
}
func nativeHandleUrl(urlString: String) throws -> Bool {
if let url = URL(string: urlString){
... ...