Commit 4a235531 authored by Hamza Sharawi's avatar Hamza Sharawi

Fix merge conflicts

parents 5a87304c 3e420631
...@@ -116,6 +116,8 @@ console.log("App Version (Readable)", DeviceInfo.getReadableVersion()); // e.g. ...@@ -116,6 +116,8 @@ console.log("App Version (Readable)", DeviceInfo.getReadableVersion()); // e.g.
console.log("Device Name", DeviceInfo.getDeviceName()); // e.g. Becca's iPhone 6 console.log("Device Name", DeviceInfo.getDeviceName()); // e.g. Becca's iPhone 6
console.log("User Agent", DeviceInfo.getUserAgent()); // e.g. Dalvik/2.1.0 (Linux; U; Android 5.1; Google Nexus 4 - 5.1.0 - API 22 - 768x1280 Build/LMY47D)
console.log("Device Locale", DeviceInfo.getDeviceLocale()); // e.g en-US console.log("Device Locale", DeviceInfo.getDeviceLocale()); // e.g en-US
``` ```
...@@ -116,10 +116,16 @@ RCT_EXPORT_MODULE() ...@@ -116,10 +116,16 @@ RCT_EXPORT_MODULE()
deviceName = @"iPhone"; deviceName = @"iPhone";
} }
} }
return deviceName; return deviceName;
} }
- (NSString*) userAgent
{
UIWebView* webView = [[UIWebView alloc] initWithFrame:CGRectZero];
return [webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
}
- (NSString*) deviceLocale - (NSString*) deviceLocale
{ {
NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0]; NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
...@@ -145,6 +151,7 @@ RCT_EXPORT_MODULE() ...@@ -145,6 +151,7 @@ RCT_EXPORT_MODULE()
@"appVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"appVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
@"buildNumber": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"], @"buildNumber": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"],
@"systemManufacturer": @"Apple", @"systemManufacturer": @"Apple",
@"userAgent": self.userAgent,
}; };
} }
......
...@@ -68,6 +68,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { ...@@ -68,6 +68,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
constants.put("uniqueId", Secure.getString(this.reactContext.getContentResolver(), Secure.ANDROID_ID)); constants.put("uniqueId", Secure.getString(this.reactContext.getContentResolver(), Secure.ANDROID_ID));
constants.put("systemManufacturer", Build.MANUFACTURER); constants.put("systemManufacturer", Build.MANUFACTURER);
constants.put("bundleId", packageName); constants.put("bundleId", packageName);
constants.put("userAgent", System.getProperty("http.agent"));
return constants; return constants;
} }
} }
...@@ -38,6 +38,9 @@ module.exports = { ...@@ -38,6 +38,9 @@ module.exports = {
getDeviceName: function() { getDeviceName: function() {
return RNDeviceInfo.deviceName; return RNDeviceInfo.deviceName;
}, },
getUserAgent: function() {
return RNDeviceInfo.userAgent;
},
getDeviceLocale: function() { getDeviceLocale: function() {
return RNDeviceInfo.deviceLocale; return RNDeviceInfo.deviceLocale;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment