forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCodePushConfig.m
85 lines (68 loc) · 2.24 KB
/
CodePushConfig.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#import "CodePush.h"
NSMutableDictionary *configuration;
@implementation CodePushConfig
+ (void)initialize
{
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *appVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
NSString *buildVersion = [infoDictionary objectForKey:(NSString *)kCFBundleVersionKey];
NSString *deploymentKey = [infoDictionary objectForKey:@"CodePushDeploymentKey"];
NSString *serverUrl = [infoDictionary objectForKey:@"CodePushServerUrl"];
if (!serverUrl) {
serverUrl = @"https://codepush.azurewebsites.net/";
}
NSString *rootComponent = [infoDictionary objectForKey:@"CFBundleName"];
configuration = [[NSMutableDictionary alloc]
initWithObjectsAndKeys:
appVersion,@"appVersion",
buildVersion,@"buildVersion",
deploymentKey,@"deploymentKey",
serverUrl,@"serverUrl",
rootComponent,@"rootComponent",
nil];
}
+ (void)setDeploymentKey:(NSString *)deploymentKey
{
[configuration setValue:deploymentKey forKey:@"deploymentKey"];
}
+ (NSString *)getDeploymentKey
{
return [configuration objectForKey:@"deploymentKey"];
}
+ (void)setServerUrl:(NSString *)serverUrl
{
[configuration setValue:serverUrl forKey:@"serverUrl"];
}
+ (NSString *)getServerUrl
{
return [configuration objectForKey:@"serverUrl"];
}
+ (void)setAppVersion:(NSString *)appVersion
{
[configuration setValue:appVersion forKey:@"appVersion"];
}
+ (NSString *)getAppVersion
{
return [configuration objectForKey:@"appVersion"];
}
+ (void)setBuildVersion:(NSString *)buildVersion
{
[configuration setValue:buildVersion forKey:@"buildVersion"];
}
+ (NSString *)getBuildVersion
{
return [configuration objectForKey:@"buildVersion"];
}
+ (void)setRootComponent:(NSString *)rootComponent
{
[configuration setValue:rootComponent forKey:@"rootComponent"];
}
+ (NSString *)getRootComponent
{
return [configuration objectForKey:@"rootComponent"];
}
+ (NSDictionary *) getConfiguration
{
return configuration;
}
@end