Skip to content

Commit 92264e8

Browse files
committed
Backport oauth XPC interrupt fix
1 parent 37a3867 commit 92264e8

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Sources/Appwrite/Services/Account.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ open class Account: Service {
939939
success: String? = nil,
940940
failure: String? = nil,
941941
scopes: [String]? = nil
942-
) throws -> Bool {
942+
) async throws -> Bool {
943943
let path: String = "/account/sessions/oauth2/{provider}"
944944
.replacingOccurrences(of: "{provider}", with: provider)
945945

@@ -953,13 +953,12 @@ open class Account: Service {
953953
let query = "?\(client.parametersToQueryString(params: params))"
954954
let url = URL(string: client.endPoint + path + query)!
955955
let callbackScheme = "appwrite-callback-\(client.config["project"] ?? "")"
956-
let group = DispatchGroup()
957-
958-
group.enter()
959-
WebAuthComponent.authenticate(url: url, callbackScheme: callbackScheme) { result in
960-
group.leave()
956+
957+
try await withCheckedThrowingContinuation { continuation in
958+
WebAuthComponent.authenticate(url: url, callbackScheme: callbackScheme) { result in
959+
continuation.resume(with: result)
960+
}
961961
}
962-
group.wait()
963962

964963
return true
965964

@@ -1374,4 +1373,4 @@ open class Account: Service {
13741373
}
13751374

13761375

1377-
}
1376+
}

0 commit comments

Comments
 (0)