Skip to content

Commit cfd5fdc

Browse files
authored
[Config] Move away from private typedef (1) (#14255)
1 parent 1098342 commit cfd5fdc

File tree

5 files changed

+33
-16
lines changed

5 files changed

+33
-16
lines changed

FirebaseRemoteConfig/Sources/Private/RCNConfigFetch.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@
2727

2828
NS_ASSUME_NONNULL_BEGIN
2929

30-
/// Completion handler invoked after a fetch that contains the updated keys
31-
typedef void (^RCNConfigFetchCompletion)(FIRRemoteConfigFetchStatus status,
32-
FIRRemoteConfigUpdate *update,
33-
NSError *error);
34-
3530
@interface RCNConfigFetch : NSObject
3631

3732
- (instancetype)init NS_UNAVAILABLE;
@@ -58,7 +53,9 @@ typedef void (^RCNConfigFetchCompletion)(FIRRemoteConfigFetchStatus status,
5853
/// @param fetchAttemptNumber The number of the fetch attempt.
5954
/// @param completionHandler Callback handler.
6055
- (void)realtimeFetchConfigWithNoExpirationDuration:(NSInteger)fetchAttemptNumber
61-
completionHandler:(RCNConfigFetchCompletion)completionHandler;
56+
completionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
57+
FIRRemoteConfigUpdate *update,
58+
NSError *error))completionHandler;
6259

6360
/// Add the ability to update NSURLSession's timeout after a session has already been created.
6461
- (void)recreateNetworkSession;

FirebaseRemoteConfig/Sources/RCNConfigFetch.m

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ - (void)fetchConfigWithExpirationDuration:(NSTimeInterval)expirationDuration
199199
#pragma mark - Fetch helpers
200200

201201
- (void)realtimeFetchConfigWithNoExpirationDuration:(NSInteger)fetchAttemptNumber
202-
completionHandler:(RCNConfigFetchCompletion)completionHandler {
202+
completionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
203+
FIRRemoteConfigUpdate *update,
204+
NSError *error))completionHandler {
203205
// Note: We expect the googleAppID to always be available.
204206
BOOL hasDeviceContextChanged = [Device remoteConfigHasDeviceContextChanged:_settings.deviceContext
205207
projectIdentifier:_options.googleAppID];
@@ -246,7 +248,9 @@ - (NSString *)FIRAppNameFromFullyQualifiedNamespace {
246248
/// requests to work.(b/14751422).
247249
- (void)refreshInstallationsTokenWithFetchHeader:(NSString *)fetchTypeHeader
248250
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler
249-
updateCompletionHandler:(RCNConfigFetchCompletion)updateCompletionHandler {
251+
updateCompletionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
252+
FIRRemoteConfigUpdate *update,
253+
NSError *error))updateCompletionHandler {
250254
FIRInstallations *installations = [FIRInstallations
251255
installationsWithApp:[FIRApp appNamed:[self FIRAppNameFromFullyQualifiedNamespace]]];
252256
if (!installations || !_options.GCMSenderID) {
@@ -344,7 +348,9 @@ - (void)refreshInstallationsTokenWithFetchHeader:(NSString *)fetchTypeHeader
344348

345349
- (void)doFetchCall:(NSString *)fetchTypeHeader
346350
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler
347-
updateCompletionHandler:(RCNConfigFetchCompletion)updateCompletionHandler {
351+
updateCompletionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
352+
FIRRemoteConfigUpdate *update,
353+
NSError *error))updateCompletionHandler {
348354
[self getAnalyticsUserPropertiesWithCompletionHandler:^(NSDictionary *userProperties) {
349355
dispatch_async(self->_lockQueue, ^{
350356
[self fetchWithUserProperties:userProperties
@@ -380,7 +386,9 @@ - (void)reportCompletionWithStatus:(FIRRemoteConfigFetchStatus)status
380386
withUpdate:(FIRRemoteConfigUpdate *)update
381387
withError:(NSError *)error
382388
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler
383-
updateCompletionHandler:(RCNConfigFetchCompletion)updateCompletionHandler {
389+
updateCompletionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
390+
FIRRemoteConfigUpdate *update,
391+
NSError *error))updateCompletionHandler {
384392
if (completionHandler) {
385393
dispatch_async(dispatch_get_main_queue(), ^{
386394
completionHandler(status, error);
@@ -397,7 +405,9 @@ - (void)reportCompletionWithStatus:(FIRRemoteConfigFetchStatus)status
397405
- (void)fetchWithUserProperties:(NSDictionary *)userProperties
398406
fetchTypeHeader:(NSString *)fetchTypeHeader
399407
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler
400-
updateCompletionHandler:(RCNConfigFetchCompletion)updateCompletionHandler {
408+
updateCompletionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
409+
FIRRemoteConfigUpdate *update,
410+
NSError *error))updateCompletionHandler {
401411
FIRLogDebug(kFIRLoggerRemoteConfig, @"I-RCN000061", @"Fetch with user properties initiated.");
402412

403413
NSString *postRequestString = [_settings nextRequestWithUserProperties:userProperties];

FirebaseRemoteConfig/Tests/Swift/ObjC/FetchMocks.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020
@interface RCNConfigFetch (ExposedForTest)
2121
- (void)refreshInstallationsTokenWithFetchHeader:(NSString *)fetchTypeHeader
2222
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler
23-
updateCompletionHandler:(RCNConfigFetchCompletion)updateCompletionHandler;
23+
updateCompletionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
24+
FIRRemoteConfigUpdate *update,
25+
NSError *error))updateCompletionHandler;
2426
- (void)doFetchCall:(NSString *)fetchTypeHeader
2527
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler
26-
updateCompletionHandler:(RCNConfigFetchCompletion)updateCompletionHandler;
28+
updateCompletionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
29+
FIRRemoteConfigUpdate *update,
30+
NSError *error))updateCompletionHandler;
2731
@end
2832

2933
@implementation FetchMocks

FirebaseRemoteConfig/Tests/Unit/RCNPersonalizationTest.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ - (NSURLSessionDataTask *)URLSessionDataTaskWithContent:(NSData *)content
3939
- (void)fetchWithUserProperties:(NSDictionary *)userProperties
4040
fetchTypeHeader:(NSString *)fetchTypeHeader
4141
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler
42-
updateCompletionHandler:(RCNConfigFetchCompletion)updateCompletionHandler;
42+
updateCompletionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
43+
FIRRemoteConfigUpdate *update,
44+
NSError *error))updateCompletionHandler;
4345
@end
4446

4547
@interface RCNPersonalizationTest : XCTestCase {

FirebaseRemoteConfig/Tests/Unit/RCNRemoteConfigTest.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,15 @@ - (NSURLSessionDataTask *)URLSessionDataTaskWithContent:(NSData *)content
5555
- (void)fetchConfigWithExpirationDuration:(NSTimeInterval)expirationDuration
5656
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler;
5757
- (void)realtimeFetchConfigWithNoExpirationDuration:(NSInteger)fetchAttemptNumber
58-
completionHandler:(RCNConfigFetchCompletion)completionHandler;
58+
completionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
59+
FIRRemoteConfigUpdate *update,
60+
NSError *error))completionHandler;
5961
- (void)fetchWithUserProperties:(NSDictionary *)userProperties
6062
fetchTypeHeader:(NSString *)fetchTypeHeader
6163
completionHandler:(FIRRemoteConfigFetchCompletion)completionHandler
62-
updateCompletionHandler:(RCNConfigFetchCompletion)updateCompletionHandler;
64+
updateCompletionHandler:(void (^)(FIRRemoteConfigFetchStatus status,
65+
FIRRemoteConfigUpdate *update,
66+
NSError *error))updateCompletionHandler;
6367
- (NSString *)constructServerURL;
6468
- (NSURLSession *)currentNetworkSession;
6569
@end

0 commit comments

Comments
 (0)