Skip to content

Commit 22d6edd

Browse files
committed
synchronous access to env
1 parent 4c6c3ca commit 22d6edd

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

RNEnvironmentManagerIOS/RNEnvironmentManagerIOS.m

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,9 @@ @implementation RNEnvironmentManagerIOS
55

66
RCT_EXPORT_MODULE()
77

8-
RCT_EXPORT_METHOD(get:(NSString *)name callback:(RCTResponseSenderBlock)callback) {
9-
@try {
10-
NSDictionary *env = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"environment" ofType:@"plist"]];
11-
if ([env objectForKey:name]) {
12-
callback(@[[NSNull null], env[name]]);
13-
} else {
14-
callback(@[[NSNull null], [NSNull null]]);
15-
}
16-
}
17-
@catch (NSException *exception) {
18-
callback(@[exception.reason, [NSNull null]]);
19-
}
20-
}
21-
22-
RCT_EXPORT_METHOD(getAll:(RCTResponseSenderBlock)callback) {
23-
@try {
24-
NSDictionary *env = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"environment" ofType:@"plist"]];
25-
callback(@[[NSNull null], env]);
26-
}
27-
@catch (NSException *exception) {
28-
callback(@[exception.reason, [NSNull null]]);
29-
}
8+
- (NSDictionary *)constantsToExport
9+
{
10+
return [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"environment" ofType:@"plist"]];
3011
}
3112

3213
@end

0 commit comments

Comments
 (0)