@@ -127,7 +127,8 @@ - (void)dealloc {
127
127
#pragma mark - Fetch Config API
128
128
129
129
- (void )fetchConfigWithExpirationDuration : (NSTimeInterval )expirationDuration
130
- completionHandler : (FIRRemoteConfigFetchCompletion)completionHandler {
130
+ completionHandler : (FIRRemoteConfigFetchCompletion)completionHandler
131
+ excludeEtagHeaderForRealtime : (bool )excludeEtagHeaderForRealtime {
131
132
// Note: We expect the googleAppID to always be available.
132
133
BOOL hasDeviceContextChanged =
133
134
FIRRemoteConfigHasDeviceContextChanged (_settings.deviceContext , _options.googleAppID );
@@ -191,7 +192,8 @@ - (void)fetchConfigWithExpirationDuration:(NSTimeInterval)expirationDuration
191
192
withError: error];
192
193
}
193
194
strongSelf->_settings .isFetchInProgress = YES ;
194
- [strongSelf refreshInstallationsTokenWithCompletionHandler: completionHandler];
195
+ [strongSelf refreshInstallationsTokenWithCompletionHandler: completionHandler
196
+ excludeEtagHeaderForRealtime: excludeEtagHeaderForRealtime];
195
197
});
196
198
}
197
199
@@ -203,7 +205,8 @@ - (NSString *)FIRAppNameFromFullyQualifiedNamespace {
203
205
// / Refresh installation ID token before fetching config. installation ID is now mandatory for fetch
204
206
// / requests to work.(b/14751422).
205
207
- (void )refreshInstallationsTokenWithCompletionHandler :
206
- (FIRRemoteConfigFetchCompletion)completionHandler {
208
+ (FIRRemoteConfigFetchCompletion)completionHandler
209
+ excludeEtagHeaderForRealtime : (bool )excludeEtagHeaderForRealtime {
207
210
FIRInstallations *installations = [FIRInstallations
208
211
installationsWithApp: [FIRApp appNamed: [self FIRAppNameFromFullyQualifiedNamespace ]]];
209
212
if (!installations || !_options.GCMSenderID ) {
@@ -283,7 +286,8 @@ - (void)refreshInstallationsTokenWithCompletionHandler:
283
286
284
287
FIRLogInfo (kFIRLoggerRemoteConfig , @" I-RCN000022" , @" Success to get iid : %@ ." ,
285
288
strongSelfQueue->_settings .configInstallationsIdentifier );
286
- [strongSelf doFetchCall: completionHandler];
289
+ [strongSelf doFetchCall: completionHandler
290
+ excludeEtagHeaderForRealtime: excludeEtagHeaderForRealtime];
287
291
});
288
292
}];
289
293
};
@@ -292,10 +296,13 @@ - (void)refreshInstallationsTokenWithCompletionHandler:
292
296
[installations authTokenWithCompletion: installationsTokenHandler];
293
297
}
294
298
295
- - (void )doFetchCall : (FIRRemoteConfigFetchCompletion)completionHandler {
299
+ - (void )doFetchCall : (FIRRemoteConfigFetchCompletion)completionHandler
300
+ excludeEtagHeaderForRealtime : (bool )excludeEtagHeaderForRealtime {
296
301
[self getAnalyticsUserPropertiesWithCompletionHandler: ^(NSDictionary *userProperties) {
297
302
dispatch_async (self->_lockQueue , ^{
298
- [self fetchWithUserProperties: userProperties completionHandler: completionHandler];
303
+ [self fetchWithUserProperties: userProperties
304
+ completionHandler: completionHandler
305
+ excludeEtagHeaderForRealtime: excludeEtagHeaderForRealtime];
299
306
});
300
307
}];
301
308
}
@@ -322,7 +329,8 @@ - (void)reportCompletionOnHandler:(FIRRemoteConfigFetchCompletion)completionHand
322
329
}
323
330
324
331
- (void )fetchWithUserProperties : (NSDictionary *)userProperties
325
- completionHandler : (FIRRemoteConfigFetchCompletion)completionHandler {
332
+ completionHandler : (FIRRemoteConfigFetchCompletion)completionHandler
333
+ excludeEtagHeaderForRealtime : (bool )excludeEtagHeaderForRealtime {
326
334
FIRLogDebug (kFIRLoggerRemoteConfig , @" I-RCN000061" , @" Fetch with user properties initiated." );
327
335
328
336
NSString *postRequestString = [_settings nextRequestWithUserProperties: userProperties];
@@ -515,8 +523,10 @@ - (void)fetchWithUserProperties:(NSDictionary *)userProperties
515
523
516
524
FIRLogDebug (kFIRLoggerRemoteConfig , @" I-RCN000061" , @" Making remote config fetch." );
517
525
518
- NSURLSessionDataTask *dataTask = [self URLSessionDataTaskWithContent: compressedContent
519
- completionHandler: fetcherCompletion];
526
+ NSURLSessionDataTask *dataTask =
527
+ [self URLSessionDataTaskWithContent: compressedContent
528
+ completionHandler: fetcherCompletion
529
+ excludeEtagHeaderForRealtime: excludeEtagHeaderForRealtime];
520
530
[dataTask resume ];
521
531
}
522
532
@@ -556,7 +566,8 @@ - (NSURLSession *)newFetchSession {
556
566
557
567
- (NSURLSessionDataTask *)URLSessionDataTaskWithContent : (NSData *)content
558
568
completionHandler :
559
- (RCNConfigFetcherCompletion)fetcherCompletion {
569
+ (RCNConfigFetcherCompletion)fetcherCompletion
570
+ excludeEtagHeaderForRealtime : (bool )excludeEtagHeaderForRealtime {
560
571
NSURL *URL = [NSURL URLWithString: [self constructServerURL ]];
561
572
FIRLogDebug (kFIRLoggerRemoteConfig , @" I-RCN000046" , @" %@ " ,
562
573
[NSString stringWithFormat: @" Making config request: %@ " , [URL absoluteString ]]);
@@ -575,7 +586,7 @@ - (NSURLSessionDataTask *)URLSessionDataTaskWithContent:(NSData *)content
575
586
[URLRequest setValue: @" gzip" forHTTPHeaderField: kContentEncodingHeaderName ];
576
587
[URLRequest setValue: @" gzip" forHTTPHeaderField: kAcceptEncodingHeaderName ];
577
588
// Set the eTag from the last successful fetch, if available.
578
- if (_settings.lastETag ) {
589
+ if (_settings.lastETag && !excludeEtagHeaderForRealtime ) {
579
590
[URLRequest setValue: _settings.lastETag forHTTPHeaderField: kIfNoneMatchETagHeaderName ];
580
591
}
581
592
[URLRequest setHTTPBody: content];
0 commit comments