Skip to content

Commit c42309c

Browse files
committed
wrap event signal code in a background thread
1 parent ed5d760 commit c42309c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

ios/RNIterableAPI/ReactIterableAPI.swift

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -514,14 +514,19 @@ extension ReactIterableAPI: IterableAuthDelegate {
514514
func onAuthTokenRequested(completion: @escaping AuthTokenRetrievalHandler) {
515515
ITBInfo()
516516

517-
sendEvent(withName: EventName.handleAuthCalled.rawValue,
518-
body: nil)
519-
520-
let authTokenRetrievalResult = authHandlerSemaphore.wait(timeout: .now() + 30.0)
521-
522-
if authTokenRetrievalResult == .success {
523-
ITBInfo("authTokenRetrieval successful")
524-
completion(passedAuthToken)
517+
DispatchQueue.global(qos: .userInitiated).async {
518+
self.sendEvent(withName: EventName.handleAuthCalled.rawValue,
519+
body: nil)
520+
521+
let authTokenRetrievalResult = self.authHandlerSemaphore.wait(timeout: .now() + 30.0)
522+
523+
if authTokenRetrievalResult == .success {
524+
ITBInfo("authTokenRetrieval successful")
525+
526+
DispatchQueue.main.async {
527+
completion(self.passedAuthToken)
528+
}
529+
}
525530
}
526531
}
527532
}

0 commit comments

Comments
 (0)