Commit 31ff0194 authored by Gant Laborde's avatar Gant Laborde Committed by GitHub

Merge pull request #59 from mehcode/timezone

Add timezone
parents 67c64581 6a4e226a
...@@ -141,6 +141,12 @@ RCT_EXPORT_MODULE() ...@@ -141,6 +141,12 @@ RCT_EXPORT_MODULE()
return country; return country;
} }
- (NSString*) timezone
{
NSTimeZone *currentTimeZone = [NSTimeZone localTimeZone];
return currentTimeZone.name;
}
- (NSDictionary *)constantsToExport - (NSDictionary *)constantsToExport
{ {
UIDevice *currentDevice = [UIDevice currentDevice]; UIDevice *currentDevice = [UIDevice currentDevice];
...@@ -162,6 +168,7 @@ RCT_EXPORT_MODULE() ...@@ -162,6 +168,7 @@ RCT_EXPORT_MODULE()
@"buildNumber": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"], @"buildNumber": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"],
@"systemManufacturer": @"Apple", @"systemManufacturer": @"Apple",
@"userAgent": self.userAgent, @"userAgent": self.userAgent,
@"timezone": self.timezone,
}; };
} }
......
...@@ -91,6 +91,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { ...@@ -91,6 +91,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
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")); constants.put("userAgent", System.getProperty("http.agent"));
constants.put("timezone", TimeZone.getDefault().getID());
return constants; return constants;
} }
} }
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