Skip to content

Commit

Permalink
[Config] Conditionally mark closures as Sendable for Xcode 16 (#14314)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 authored Jan 7, 2025
1 parent 15179e4 commit f94a964
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
7 changes: 5 additions & 2 deletions FirebaseRemoteConfig/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Unreleased
# 11.7.0
- [fixed] Mark ConfigUpdateListenerRegistration Sendable. (#14215)
- [feature] Added support for custom signal targeting in Remote Config. Use `setCustomSignals` API for setting custom signals and use them to build custom targeting conditions in Remote Config. (#13976)
- [fixed] Mark completion handlers as Sendable in RemoteConfig class. (#14257)
- [feature] Added support for custom signal targeting in Remote Config. Use
`setCustomSignals` API for setting custom signals and use them to build
custom targeting conditions in Remote Config. (#13976)

# 11.5.0
- [fixed] Mark two internal properties as `atomic` to prevent concurrency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,22 @@ NS_SWIFT_NAME(RemoteConfig)
- (void)ensureInitializedWithCompletionHandler:
(void (^_Nonnull)(NSError *_Nullable initializationError))completionHandler;
#pragma mark - Fetch

#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000)
/// Fetches Remote Config data with a callback. Call `activate()` to make fetched data
/// available to your app.
///
/// Note: This method uses a Firebase Installations token to identify the app instance, and once
/// it's called, it periodically sends data to the Firebase backend. (see
/// `Installations.authToken(completion:)`).
/// To stop the periodic sync, call `Installations.delete(completion:)`
/// and avoid calling this method again.
///
/// @param completionHandler Fetch operation callback with status and error parameters.
- (void)fetchWithCompletionHandler:
(void (^_Nullable NS_SWIFT_SENDABLE)(FIRRemoteConfigFetchStatus status,
NSError *_Nullable error))completionHandler;
#else
/// Fetches Remote Config data with a callback. Call `activate()` to make fetched data
/// available to your app.
///
Expand All @@ -248,7 +264,27 @@ NS_SWIFT_NAME(RemoteConfig)
/// @param completionHandler Fetch operation callback with status and error parameters.
- (void)fetchWithCompletionHandler:(void (^_Nullable)(FIRRemoteConfigFetchStatus status,
NSError *_Nullable error))completionHandler;
#endif

#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000)
/// Fetches Remote Config data and sets a duration that specifies how long config data lasts.
/// Call `activateWithCompletion:` to make fetched data available to your app.
///
/// Note: This method uses a Firebase Installations token to identify the app instance, and once
/// it's called, it periodically sends data to the Firebase backend. (see
/// `Installations.authToken(completion:)`).
/// To stop the periodic sync, call `Installations.delete(completion:)`
/// and avoid calling this method again.
///
/// @param expirationDuration Override the (default or optionally set `minimumFetchInterval`
/// property in RemoteConfigSettings) `minimumFetchInterval` for only the current request, in
/// seconds. Setting a value of 0 seconds will force a fetch to the backend.
/// @param completionHandler Fetch operation callback with status and error parameters.
- (void)fetchWithExpirationDuration:(NSTimeInterval)expirationDuration
completionHandler:(void (^_Nullable NS_SWIFT_SENDABLE)(
FIRRemoteConfigFetchStatus status,
NSError *_Nullable error))completionHandler;
#else
/// Fetches Remote Config data and sets a duration that specifies how long config data lasts.
/// Call `activateWithCompletion:` to make fetched data available to your app.
///
Expand All @@ -265,7 +301,23 @@ NS_SWIFT_NAME(RemoteConfig)
- (void)fetchWithExpirationDuration:(NSTimeInterval)expirationDuration
completionHandler:(void (^_Nullable)(FIRRemoteConfigFetchStatus status,
NSError *_Nullable error))completionHandler;
#endif

#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000)
/// Fetches Remote Config data and if successful, activates fetched data. Optional completion
/// handler callback is invoked after the attempted activation of data, if the fetch call succeeded.
///
/// Note: This method uses a Firebase Installations token to identify the app instance, and once
/// it's called, it periodically sends data to the Firebase backend. (see
/// `Installations.authToken(completion:)`).
/// To stop the periodic sync, call `Installations.delete(completion:)`
/// and avoid calling this method again.
///
/// @param completionHandler Fetch operation callback with status and error parameters.
- (void)fetchAndActivateWithCompletionHandler:
(void (^_Nullable NS_SWIFT_SENDABLE)(FIRRemoteConfigFetchAndActivateStatus status,
NSError *_Nullable error))completionHandler;
#else
/// Fetches Remote Config data and if successful, activates fetched data. Optional completion
/// handler callback is invoked after the attempted activation of data, if the fetch call succeeded.
///
Expand All @@ -279,14 +331,23 @@ NS_SWIFT_NAME(RemoteConfig)
- (void)fetchAndActivateWithCompletionHandler:
(void (^_Nullable)(FIRRemoteConfigFetchAndActivateStatus status,
NSError *_Nullable error))completionHandler;
#endif

#pragma mark - Apply

#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000)
/// Applies Fetched Config data to the Active Config, causing updates to the behavior and appearance
/// of the app to take effect (depending on how config data is used in the app).
/// @param completion Activate operation callback with changed and error parameters.
- (void)activateWithCompletion:
(void (^_Nullable NS_SWIFT_SENDABLE)(BOOL changed, NSError *_Nullable error))completion;
#else
/// Applies Fetched Config data to the Active Config, causing updates to the behavior and appearance
/// of the app to take effect (depending on how config data is used in the app).
/// @param completion Activate operation callback with changed and error parameters.
- (void)activateWithCompletion:(void (^_Nullable)(BOOL changed,
NSError *_Nullable error))completion;
#endif

#pragma mark - Get Config
/// Enables access to configuration values by using object subscripting syntax.
Expand Down

0 comments on commit f94a964

Please sign in to comment.