|
11 | 11 | #import "CountlyRemoteConfig.h" |
12 | 12 | #import "CountlyCommon.h" |
13 | 13 |
|
14 | | -NSString* const kCountlyReactNativeSDKVersion = @"20.04.5"; |
| 14 | +NSString* const kCountlyReactNativeSDKVersion = @"20.04.6"; |
15 | 15 | NSString* const kCountlyReactNativeSDKName = @"js-rnb-ios"; |
16 | 16 |
|
17 | 17 | CountlyConfig* config = nil; |
@@ -120,18 +120,6 @@ @implementation CountlyReactNative |
120 | 120 | }); |
121 | 121 | } |
122 | 122 |
|
123 | | -RCT_EXPORT_METHOD(setAutomaticViewTracking:(NSArray*)arguments) |
124 | | -{ |
125 | | - BOOL boolean = [[arguments objectAtIndex:0] boolValue]; |
126 | | - if(boolean) { |
127 | | - [self addCountlyFeature:CLYAutoViewTracking]; |
128 | | - } |
129 | | - else { |
130 | | - [self removeCountlyFeature:CLYAutoViewTracking]; |
131 | | - } |
132 | | - [Countly.sharedInstance setIsAutoViewTrackingActive:boolean]; |
133 | | -} |
134 | | - |
135 | 123 | RCT_EXPORT_METHOD(setLoggingEnabled:(NSArray*)arguments) |
136 | 124 | { |
137 | 125 | dispatch_async(dispatch_get_main_queue(), ^ { |
@@ -179,7 +167,10 @@ @implementation CountlyReactNative |
179 | 167 | dispatch_async(dispatch_get_main_queue(), ^ { |
180 | 168 |
|
181 | 169 | NSString* token = [arguments objectAtIndex:0]; |
182 | | - NSString* messagingMode = [arguments objectAtIndex:1]; |
| 170 | + NSString* messagingMode = @"1"; |
| 171 | + if(config.pushTestMode == nil || [config.pushTestMode isEqual: @""] || [config.pushTestMode isEqualToString:@"CLYPushTestModeTestFlightOrAdHoc"]) { |
| 172 | + messagingMode = @"0"; |
| 173 | + } |
183 | 174 | NSString *urlString = [ @"" stringByAppendingFormat:@"%@?device_id=%@&app_key=%@&token_session=1&test_mode=%@&ios_token=%@", config.host, [Countly.sharedInstance deviceID], config.appKey, messagingMode, token]; |
184 | 175 | NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; |
185 | 176 | [request setHTTPMethod:@"GET"]; |
@@ -433,6 +424,43 @@ + (void) log: (NSString *) theMessage{ |
433 | 424 | }); |
434 | 425 | } |
435 | 426 |
|
| 427 | +RCT_EXPORT_METHOD(setLocationInit:(NSArray*)arguments) |
| 428 | +{ |
| 429 | + dispatch_async(dispatch_get_main_queue(), ^ { |
| 430 | + if (config == nil){ |
| 431 | + config = CountlyConfig.new; |
| 432 | + } |
| 433 | + NSString* countryCode = [arguments objectAtIndex:0]; |
| 434 | + NSString* city = [arguments objectAtIndex:1]; |
| 435 | + NSString* locationString = [arguments objectAtIndex:2]; |
| 436 | + NSString* ipAddress = [arguments objectAtIndex:3]; |
| 437 | + |
| 438 | + if(locationString != nil && ![locationString isEqualToString:@"null"] && [locationString containsString:@","]){ |
| 439 | + @try{ |
| 440 | + NSArray *locationArray = [locationString componentsSeparatedByString:@","]; |
| 441 | + NSString* latitudeString = [locationArray objectAtIndex:0]; |
| 442 | + NSString* longitudeString = [locationArray objectAtIndex:1]; |
| 443 | + |
| 444 | + double latitudeDouble = [latitudeString doubleValue]; |
| 445 | + double longitudeDouble = [longitudeString doubleValue]; |
| 446 | + config.location = (CLLocationCoordinate2D){latitudeDouble,longitudeDouble}; |
| 447 | + } |
| 448 | + @catch(NSException *exception){ |
| 449 | + NSLog(@"[Countly] Invalid location: %@", locationString); |
| 450 | + } |
| 451 | + } |
| 452 | + if(city != nil && ![city isEqualToString:@"null"]) { |
| 453 | + config.city = city; |
| 454 | + } |
| 455 | + if(countryCode != nil && ![countryCode isEqualToString:@"null"]) { |
| 456 | + config.ISOCountryCode = countryCode; |
| 457 | + } |
| 458 | + if(ipAddress != nil && ![ipAddress isEqualToString:@"null"]) { |
| 459 | + config.IP = ipAddress; |
| 460 | + } |
| 461 | + }); |
| 462 | +} |
| 463 | + |
436 | 464 | RCT_EXPORT_METHOD(setLocation:(NSArray*)arguments) |
437 | 465 | { |
438 | 466 | dispatch_async(dispatch_get_main_queue(), ^ { |
@@ -886,8 +914,8 @@ + (void) log: (NSString *) theMessage{ |
886 | 914 | int responseCode = [[arguments objectAtIndex:1] intValue]; |
887 | 915 | int requestPayloadSize = [[arguments objectAtIndex:2] intValue]; |
888 | 916 | int responsePayloadSize = [[arguments objectAtIndex:3] intValue]; |
889 | | - int startTime = [[arguments objectAtIndex:4] intValue]; |
890 | | - int endTime = [[arguments objectAtIndex:5] intValue]; |
| 917 | + long long startTime = [[arguments objectAtIndex:4] longLongValue]; |
| 918 | + long long endTime = [[arguments objectAtIndex:5] longLongValue]; |
891 | 919 | [Countly.sharedInstance recordNetworkTrace: networkTraceKey requestPayloadSize: requestPayloadSize responsePayloadSize: responsePayloadSize responseStatusCode: responseCode startTime: startTime endTime: endTime]; |
892 | 920 |
|
893 | 921 | }); |
|
0 commit comments