From 4b997743822a43f821f884c8792f15863736e2cc Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Thu, 23 Jan 2025 12:03:47 -0500 Subject: [PATCH] [Config] Mark `addOnConfigUpdateListener` as `Sendable` (#14375) --- FirebaseRemoteConfig/CHANGELOG.md | 4 +++ .../FirebaseRemoteConfig/FIRRemoteConfig.h | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/FirebaseRemoteConfig/CHANGELOG.md b/FirebaseRemoteConfig/CHANGELOG.md index a90bc0d3828..55b4573d890 100644 --- a/FirebaseRemoteConfig/CHANGELOG.md +++ b/FirebaseRemoteConfig/CHANGELOG.md @@ -1,3 +1,7 @@ +# Unreleased +- [fixed] Mark completion handlers as Sendable in RemoteConfig class. + Some completions handlers were missed in the 11.7.0 update. (#14257) + # 11.7.0 - [fixed] Mark ConfigUpdateListenerRegistration Sendable. (#14215) - [fixed] Mark completion handlers as Sendable in RemoteConfig class. (#14257) diff --git a/FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h b/FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h index ee3d4036526..610551a40d5 100644 --- a/FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h +++ b/FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h @@ -231,10 +231,18 @@ NS_SWIFT_NAME(RemoteConfig) /// Unavailable. Use +remoteConfig instead. - (nonnull instancetype)init __attribute__((unavailable("Use +remoteConfig instead."))); +#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000) +/// Ensures initialization is complete and clients can begin querying for Remote Config values. +/// @param completionHandler Initialization complete callback with error parameter. +- (void)ensureInitializedWithCompletionHandler: + (void (^_Nonnull NS_SWIFT_SENDABLE)(NSError *_Nullable initializationError))completionHandler; +#else /// Ensures initialization is complete and clients can begin querying for Remote Config values. /// @param completionHandler Initialization complete callback with error parameter. - (void)ensureInitializedWithCompletionHandler: (void (^_Nonnull)(NSError *_Nullable initializationError))completionHandler; +#endif + #pragma mark - Fetch #if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000) @@ -414,6 +422,25 @@ typedef void (^FIRRemoteConfigUpdateCompletion)(FIRRemoteConfigUpdate *_Nullable NSError *_Nullable error) NS_SWIFT_UNAVAILABLE("Use Swift's closure syntax instead."); +#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000) +/// Start listening for real-time config updates from the Remote Config backend and automatically +/// fetch updates when they're available. +/// +/// If a connection to the Remote Config backend is not already open, calling this method will +/// open it. Multiple listeners can be added by calling this method again, but subsequent calls +/// re-use the same connection to the backend. +/// +/// Note: Real-time Remote Config requires the Firebase Remote Config Realtime API. See Get started +/// with Firebase Remote Config at https://firebase.google.com/docs/remote-config/get-started for +/// more information. +/// +/// @param listener The configured listener that is called for every config update. +/// @return Returns a registration representing the listener. The registration contains +/// a remove method, which can be used to stop receiving updates for the provided listener. +- (FIRConfigUpdateListenerRegistration *_Nonnull)addOnConfigUpdateListener: + (FIRRemoteConfigUpdateCompletion _Nonnull NS_SWIFT_SENDABLE)listener + NS_SWIFT_NAME(addOnConfigUpdateListener(remoteConfigUpdateCompletion:)); +#else /// Start listening for real-time config updates from the Remote Config backend and automatically /// fetch updates when they're available. /// @@ -431,6 +458,7 @@ typedef void (^FIRRemoteConfigUpdateCompletion)(FIRRemoteConfigUpdate *_Nullable - (FIRConfigUpdateListenerRegistration *_Nonnull)addOnConfigUpdateListener: (FIRRemoteConfigUpdateCompletion _Nonnull)listener NS_SWIFT_NAME(addOnConfigUpdateListener(remoteConfigUpdateCompletion:)); +#endif - (void)setCustomSignals:(nonnull NSDictionary *)customSignals withCompletion:(void (^_Nullable)(NSError *_Nullable error))completionHandler