|
28 | 28 | static NSString *const kRCNGroupPrefix = @"frc.group.";
|
29 | 29 | static NSString *const kRCNUserDefaultsKeyNamelastETag = @"lastETag";
|
30 | 30 | static NSString *const kRCNUserDefaultsKeyNameLastSuccessfulFetchTime = @"lastSuccessfulFetchTime";
|
31 |
| -static NSString *const kRCNAnlyticsFirstOpenTimePropertyName = @"_fot"; |
| 31 | +static NSString *const kRCNAnalyticsFirstOpenTimePropertyName = @"_fot"; |
32 | 32 | static const int kRCNExponentialBackoffMinimumInterval = 60 * 2; // 2 mins.
|
33 | 33 | static const int kRCNExponentialBackoffMaximumInterval = 60 * 60 * 4; // 4 hours.
|
34 | 34 |
|
@@ -362,20 +362,19 @@ - (NSString *)nextRequestWithUserProperties:(NSDictionary *)userProperties {
|
362 | 362 | NSError *error;
|
363 | 363 |
|
364 | 364 | // Extract first open time from user properties and send as a separate field
|
365 |
| - NSNumber *firstOpenTime = [userProperties valueForKey:kRCNAnlyticsFirstOpenTimePropertyName]; |
366 |
| - if (firstOpenTime) { |
| 365 | + NSNumber *firstOpenTime = userProperties[kRCNAnalyticsFirstOpenTimePropertyName]; |
| 366 | + NSMutableDictionary *remainingUserProperties = [userProperties mutableCopy]; |
| 367 | + if (firstOpenTime != nil) { |
367 | 368 | NSDate *date = [NSDate dateWithTimeIntervalSince1970:([firstOpenTime longValue] / 1000)];
|
368 | 369 | NSISO8601DateFormatter *formatter = [[NSISO8601DateFormatter alloc] init];
|
369 | 370 | NSString *firstOpenTimeISOString = [formatter stringFromDate:date];
|
370 | 371 | ret = [ret stringByAppendingString:[NSString stringWithFormat:@", first_open_time:'%@'",
|
371 | 372 | firstOpenTimeISOString]];
|
372 | 373 |
|
373 |
| - NSMutableDictionary *userPropertiesCopy = [userProperties mutableCopy]; |
374 |
| - [userPropertiesCopy removeObjectForKey:kRCNAnlyticsFirstOpenTimePropertyName]; |
375 |
| - userProperties = userPropertiesCopy; |
| 374 | + [remainingUserProperties removeObjectForKey:kRCNAnalyticsFirstOpenTimePropertyName]; |
376 | 375 | }
|
377 |
| - if (userProperties.count > 0) { |
378 |
| - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userProperties |
| 376 | + if (remainingUserProperties.count > 0) { |
| 377 | + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:remainingUserProperties |
379 | 378 | options:0
|
380 | 379 | error:&error];
|
381 | 380 | if (!error) {
|
|
0 commit comments