Skip to content

Commit

Permalink
Fixup the signatures of clearPersistence and terminate
Browse files Browse the repository at this point in the history
While the underlying C++ layer does not generate errors for these
calls, the Obj C API exposes errors on these calls, so we should
here as well.
  • Loading branch information
darinf committed Mar 19, 2024
1 parent c14c6f4 commit 36bdb8e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Sources/FirebaseFirestore/Firestore+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ public class Firestore {
}
}

public func clearPersistence(completion: (() -> Void)?) {
public func clearPersistence(completion: ((Error?) -> Void)?) {
let future = swift_firebase.swift_cxx_shims.firebase.firestore.firestore_clear_persistence(impl)
future.setCompletion({
if let completion {
DispatchQueue.main.async {
completion()
completion(nil)
}
}
})
}

public func clearPersistence() async {
public func clearPersistence() async throws {
await withCheckedContinuation { continuation in
let future = swift_firebase.swift_cxx_shims.firebase.firestore.firestore_clear_persistence(impl)
future.setCompletion({
Expand All @@ -64,18 +64,18 @@ public class Firestore {
}
}

public func terminate(completion: (() -> Void)?) {
public func terminate(completion: ((Error?) -> Void)?) {
let future = swift_firebase.swift_cxx_shims.firebase.firestore.firestore_terminate(impl)
future.setCompletion({
if let completion {
DispatchQueue.main.async {
completion()
completion(nil)
}
}
})
}

public func terminate() async {
public func terminate() async throws {
await withCheckedContinuation { continuation in
let future = swift_firebase.swift_cxx_shims.firebase.firestore.firestore_terminate(impl)
future.setCompletion({
Expand Down

0 comments on commit 36bdb8e

Please sign in to comment.