forked from shadowfacts/Tusker
Maybe fix continuation being reused
This commit is contained in:
parent
8a339ec171
commit
2e31d34e9d
|
@ -180,9 +180,6 @@ class PushManagerImpl: _PushManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func getDeviceToken() async throws -> Data {
|
private func getDeviceToken() async throws -> Data {
|
||||||
defer {
|
|
||||||
remoteNotificationsRegistrationContinuation = nil
|
|
||||||
}
|
|
||||||
return try await withCheckedThrowingContinuation { continuation in
|
return try await withCheckedThrowingContinuation { continuation in
|
||||||
remoteNotificationsRegistrationContinuation = continuation
|
remoteNotificationsRegistrationContinuation = continuation
|
||||||
UIApplication.shared.registerForRemoteNotifications()
|
UIApplication.shared.registerForRemoteNotifications()
|
||||||
|
@ -191,10 +188,12 @@ class PushManagerImpl: _PushManager {
|
||||||
|
|
||||||
func didRegisterForRemoteNotifications(deviceToken: Data) {
|
func didRegisterForRemoteNotifications(deviceToken: Data) {
|
||||||
remoteNotificationsRegistrationContinuation?.resume(returning: deviceToken)
|
remoteNotificationsRegistrationContinuation?.resume(returning: deviceToken)
|
||||||
|
remoteNotificationsRegistrationContinuation = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func didFailToRegisterForRemoteNotifications(error: any Error) {
|
func didFailToRegisterForRemoteNotifications(error: any Error) {
|
||||||
remoteNotificationsRegistrationContinuation?.resume(throwing: PushRegistrationError.registeringForRemoteNotifications(error))
|
remoteNotificationsRegistrationContinuation?.resume(throwing: PushRegistrationError.registeringForRemoteNotifications(error))
|
||||||
|
remoteNotificationsRegistrationContinuation = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
private func register(deviceToken: String) async throws -> PushProxyRegistration {
|
private func register(deviceToken: String) async throws -> PushProxyRegistration {
|
||||||
|
|
Loading…
Reference in New Issue