Skip to content

Commit

Permalink
Fixes for userAgent being unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
arnab-p committed May 5, 2021
1 parent dc8c68f commit 28f04f1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Example/Rudder/_AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[builder withRecordScreenViews:NO];
[RSClient getInstance:WRITE_KEY config:[builder build]];



// [[[RSClient sharedInstance] getContext] putDeviceToken:[self getDeviceToken]];
// [[[RSClient sharedInstance] getContext] putAdvertisementId:[self getIDFA]];

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ RudderStack is available through [CocoaPods](https://cocoapods.org) and [Carthag
### CocoaPods
To install it, simply add the following line to your Podfile:
```xcode
pod 'Rudder', '1.0.12'
pod 'Rudder', '1.0.13'
```

### Carthage
And for Carthage support add the following line to your `Cartfile`
```xcode
github "rudderlabs/rudder-sdk-ios" "v1.0.12"
github "rudderlabs/rudder-sdk-ios" "v1.0.13"
```

Remember to include the following code in all `.m` and `.h` files where you want to refer to or use Rudder SDK classes
Expand Down
4 changes: 2 additions & 2 deletions Rudder.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Rudder'
s.version = "1.0.12"
s.version = "1.0.13"
s.summary = "Privacy and Security focused Segment-alternative. iOS SDK"
s.description = <<-DESC
Rudder is a platform for collecting, storing and routing customer event data to dozens of tools. Rudder is open-source, can run in your cloud environment (AWS, GCP, Azure or even your data-centre) and provides a powerful transformation framework to process your event data on the fly.
Expand All @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.license = { :type => "Apache", :file => "LICENSE" }
s.author = { "Rudderstack" => "arnab@rudderlabs.com" }
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/rudderlabs/rudder-sdk-ios.git", :tag => "v1.0.12" }
s.source = { :git => "https://github.com/rudderlabs/rudder-sdk-ios.git", :tag => "v1.0.13" }

s.ios.deployment_target = '8.0'

Expand Down
2 changes: 1 addition & 1 deletion Rudder/RSConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ @implementation RSConstants
NSString *const RSControlPlaneUrl = @"https://api.rudderlabs.com";
bool const RSTrackLifeCycleEvents = YES;
bool const RSRecordScreenViews = NO;
NSString *const RS_VERSION = @"1.0.12";
NSString *const RS_VERSION = @"1.0.13";
@end
10 changes: 8 additions & 2 deletions Rudder/RSContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ - (instancetype)init
[webView loadHTMLString:@"<html></html>" baseURL:nil];

[webView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id __nullable userAgent, NSError * __nullable error) {
self->_userAgent = userAgent;
if (userAgent != NULL) {
NSLog(@"Retrieved userAgent: %@", userAgent);
self->_userAgent = userAgent;
}
}];
});
_locale = [RSUtils getLocale];
Expand Down Expand Up @@ -142,7 +145,10 @@ - (void)updateExternalIds:(NSMutableArray *)externalIds {
[tempDict setObject:[_library dict] forKey:@"library"];
[tempDict setObject:[_os dict] forKey:@"os"];
[tempDict setObject:[_screen dict] forKey:@"screen"];
[tempDict setObject:_userAgent ?: @"unknown" forKey:@"userAgent"];
if (_userAgent) {
[tempDict setObject:_userAgent forKey:@"userAgent"];
}

[tempDict setObject:_locale forKey:@"locale"];
[tempDict setObject:[_device dict] forKey:@"device"];
[tempDict setObject:[_network dict] forKey:@"network"];
Expand Down

0 comments on commit 28f04f1

Please sign in to comment.