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

Add deviceLocale to constants

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