Commit 35b083d2 authored by Hamza Sharawi's avatar Hamza Sharawi

Add deviceLocale to constants

parent 75c40b63
...@@ -120,6 +120,12 @@ RCT_EXPORT_MODULE() ...@@ -120,6 +120,12 @@ RCT_EXPORT_MODULE()
return deviceName; return deviceName;
} }
- (NSString*) deviceLocale
{
NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
return language;
}
- (NSDictionary *)constantsToExport - (NSDictionary *)constantsToExport
{ {
UIDevice *currentDevice = [UIDevice currentDevice]; UIDevice *currentDevice = [UIDevice currentDevice];
...@@ -133,6 +139,7 @@ RCT_EXPORT_MODULE() ...@@ -133,6 +139,7 @@ RCT_EXPORT_MODULE()
@"model": self.deviceName, @"model": self.deviceName,
@"deviceId": self.deviceId, @"deviceId": self.deviceId,
@"deviceName": currentDevice.name, @"deviceName": currentDevice.name,
@"deviceLocale": self.deviceLocale,
@"uniqueId": uniqueId, @"uniqueId": uniqueId,
@"bundleId": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"], @"bundleId": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"],
@"appVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"appVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
......
...@@ -64,6 +64,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { ...@@ -64,6 +64,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
constants.put("systemVersion", Build.VERSION.RELEASE); constants.put("systemVersion", Build.VERSION.RELEASE);
constants.put("model", Build.MODEL); constants.put("model", Build.MODEL);
constants.put("deviceId", Build.BOARD); constants.put("deviceId", Build.BOARD);
constants.put("deviceLocale", this.reactContext.getResources().getConfiguration().locale.toString());
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);
......
...@@ -37,5 +37,8 @@ module.exports = { ...@@ -37,5 +37,8 @@ module.exports = {
}, },
getDeviceName: function() { getDeviceName: function() {
return RNDeviceInfo.deviceName; return RNDeviceInfo.deviceName;
},
getDeviceLocale: function() {
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