From 29ee3223dcb1251fa9c0a4af339c2d995209afa8 Mon Sep 17 00:00:00 2001 From: Darin Fisher Date: Tue, 13 Feb 2024 09:57:41 -0800 Subject: [PATCH] Change CallOnCompletion to OnCompletion --- Sources/FirebaseCore/FutureProtocol.swift | 4 ++-- Sources/firebase/include/FirebaseCore.hh | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Sources/FirebaseCore/FutureProtocol.swift b/Sources/FirebaseCore/FutureProtocol.swift index c5c31e6..342b551 100644 --- a/Sources/FirebaseCore/FutureProtocol.swift +++ b/Sources/FirebaseCore/FutureProtocol.swift @@ -20,7 +20,7 @@ public protocol FutureProtocol { func error() -> Int32 func __error_messageUnsafe() -> UnsafePointer? func __resultUnsafe() -> UnsafePointer? - func CallOnCompletion( + func OnCompletion( _ completion: FutureCompletionType, _ user_data: UnsafeMutableRawPointer? ) @@ -35,7 +35,7 @@ public extension FutureProtocol { // While the underlying Firebase `OnCompletion` method can provide a reference // back to the Future, we don't need to expose that here. func setCompletion(_ completion: @escaping () -> Void) { - CallOnCompletion({ ptr in + OnCompletion({ ptr in Unmanaged.fromOpaque(ptr!).takeRetainedValue().completion() }, Unmanaged.passRetained(CompletionReference(completion)).toOpaque()) } diff --git a/Sources/firebase/include/FirebaseCore.hh b/Sources/firebase/include/FirebaseCore.hh index f1ee6fc..a34956c 100644 --- a/Sources/firebase/include/FirebaseCore.hh +++ b/Sources/firebase/include/FirebaseCore.hh @@ -20,12 +20,13 @@ template class ConformingFuture: public ::firebase::Future { ConformingFuture(const FutureType& rhs) : FutureType(rhs) {} - void CallOnCompletion( + void OnCompletion( _Nonnull FutureCompletionType completion, _Nullable void* user_data) const { - OnCompletion([completion, user_data](const FutureBase&) { - completion(user_data); - }); + ::firebase::FutureBase::OnCompletion( + [completion, user_data](const FutureBase&) { + completion(user_data); + }); } } __attribute__((swift_attr("conforms_to:FirebaseCore.FutureProtocol")));