mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-11 08:04:23 +08:00
report acquisition status
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#import "CodePush.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@implementation CodePushConfig {
|
||||
NSMutableDictionary *_configDictionary;
|
||||
@@ -10,6 +11,7 @@ static NSString * const AppVersionConfigKey = @"appVersion";
|
||||
static NSString * const BuildVdersionConfigKey = @"buildVersion";
|
||||
static NSString * const DeploymentKeyConfigKey = @"deploymentKey";
|
||||
static NSString * const ServerURLConfigKey = @"serverUrl";
|
||||
static NSString * const ClientUniqueIDConfigKey = @"clientUniqueId";
|
||||
|
||||
+ (instancetype)current
|
||||
{
|
||||
@@ -31,6 +33,14 @@ static NSString * const ServerURLConfigKey = @"serverUrl";
|
||||
NSString *deploymentKey = [infoDictionary objectForKey:@"CodePushDeploymentKey"];
|
||||
NSString *serverURL = [infoDictionary objectForKey:@"CodePushServerURL"];
|
||||
|
||||
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString* clientUniqueId = [userDefaults stringForKey:ClientUniqueIDConfigKey];
|
||||
if (clientUniqueId == nil) {
|
||||
clientUniqueId = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
|
||||
[userDefaults setObject:clientUniqueId forKey:ClientUniqueIDConfigKey];
|
||||
[userDefaults synchronize];
|
||||
}
|
||||
|
||||
if (!serverURL) {
|
||||
serverURL = @"https://codepush.azurewebsites.net/";
|
||||
}
|
||||
@@ -40,6 +50,7 @@ static NSString * const ServerURLConfigKey = @"serverUrl";
|
||||
buildVersion,BuildVdersionConfigKey,
|
||||
serverURL,ServerURLConfigKey,
|
||||
deploymentKey,DeploymentKeyConfigKey,
|
||||
clientUniqueId,ClientUniqueIDConfigKey,
|
||||
nil];
|
||||
|
||||
return self;
|
||||
@@ -70,6 +81,11 @@ static NSString * const ServerURLConfigKey = @"serverUrl";
|
||||
return [_configDictionary objectForKey:ServerURLConfigKey];
|
||||
}
|
||||
|
||||
- (NSString *)clientUniqueId
|
||||
{
|
||||
return [_configDictionary objectForKey:ClientUniqueIDConfigKey];
|
||||
}
|
||||
|
||||
- (void)setDeploymentKey:(NSString *)deploymentKey
|
||||
{
|
||||
[_configDictionary setValue:deploymentKey forKey:DeploymentKeyConfigKey];
|
||||
|
||||
Reference in New Issue
Block a user