@@ -298,7 +298,7 @@ - (void)refreshInstallationsTokenWithCompletionHandler:
298
298
[installations authTokenWithCompletion: installationsTokenHandler];
299
299
}
300
300
301
- - (void ) setRequestBody {
301
+ - (NSData *) createRequestBody {
302
302
[self refreshInstallationsTokenWithCompletionHandler: ^(FIRRemoteConfigFetchStatus status,
303
303
NSError *_Nullable error) {
304
304
if (status != FIRRemoteConfigFetchStatusSuccess) {
@@ -315,14 +315,13 @@ - (void)setRequestBody {
315
315
NSString *namespace = [_namespace substringToIndex: [_namespace rangeOfString: @" :" ].location];
316
316
NSString *postBody = [NSString
317
317
stringWithFormat: @" {project:'%@ ', namespace:'%@ ', lastKnownVersionNumber:'%@ ', appId:'%@ ', "
318
- @" sdkVersion:'%@ '}" ,
318
+ @" sdkVersion:'%@ ', appInstanceId:' %@ ' }" ,
319
319
[self ->_options GCMSenderID ], namespace, _configFetch.templateVersionNumber,
320
- _options.googleAppID, FIRRemoteConfigPodVersion ()];
320
+ _options.googleAppID, FIRRemoteConfigPodVersion (),
321
+ _settings.configInstallationsIdentifier];
321
322
NSData *postData = [postBody dataUsingEncoding: NSUTF8StringEncoding];
322
323
NSError *compressionError;
323
- NSData *compressedContent = [NSData gul_dataByGzippingData: postData error: &compressionError];
324
-
325
- [_request setHTTPBody: compressedContent];
324
+ return [NSData gul_dataByGzippingData: postData error: &compressionError];
326
325
}
327
326
328
327
// / Creates request.
@@ -665,7 +664,8 @@ - (void)beginRealtimeStream {
665
664
666
665
if (canMakeConnection) {
667
666
strongSelf->_isRequestInProgress = true ;
668
- [strongSelf setRequestBody ];
667
+ NSData *compressedContent = [strongSelf createRequestBody ];
668
+ [strongSelf->_request setHTTPBody: compressedContent];
669
669
strongSelf->_dataTask = [strongSelf->_session dataTaskWithRequest: strongSelf->_request];
670
670
[strongSelf->_dataTask resume ];
671
671
}
0 commit comments