Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
50b3f3825e
@ -106,12 +106,13 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
|
|||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
NSMutableDictionary *packageInfo = [[defaults dictionaryForKey:rnHotUpdatePackageInfoKey] mutableCopy];
|
NSMutableDictionary *packageInfo = [[defaults dictionaryForKey:rnHotUpdatePackageInfoKey] mutableCopy];
|
||||||
|
|
||||||
NSDictionary *ret = @{ @"downloadRootDir": [RCTHotUpdate downloadDir],
|
NSMutableDictionary *ret = [@{} mutableCopy];
|
||||||
@"packageVersion": [infoDictionary objectForKey:@"CFBundleShortVersionString"],
|
ret[@"downloadRootDir"] = [RCTHotUpdate downloadDir];
|
||||||
@"currentVersion": [packageInfo objectForKey:paramCurrentVersion],
|
ret[@"packageVersion"] = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
|
||||||
@"isFirstTime": [packageInfo objectForKey:paramIsFirstTime],
|
ret[@"currentVersion"] = [packageInfo objectForKey:paramCurrentVersion];
|
||||||
@"isRolledBack": [packageInfo objectForKey:paramIsRolledBack]
|
ret[@"isFirstTime"] = [packageInfo objectForKey:paramIsFirstTime];
|
||||||
};
|
ret[@"isRolledBack"] = [packageInfo objectForKey:paramIsRolledBack];
|
||||||
|
|
||||||
if (packageInfo) {
|
if (packageInfo) {
|
||||||
// clear isFirstTime and isRolledBack
|
// clear isFirstTime and isRolledBack
|
||||||
packageInfo[paramIsFirstTime] = @(NO);
|
packageInfo[paramIsFirstTime] = @(NO);
|
||||||
@ -131,20 +132,6 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(getVersionInfo:(RCTResponseSenderBlock)callback)
|
|
||||||
{
|
|
||||||
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
|
||||||
|
|
||||||
NSString *appVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
|
|
||||||
NSString *buildVersion = [infoDictionary objectForKey:@"CFBundleVersion"];
|
|
||||||
|
|
||||||
NSDictionary *versionInfo = @{AppVersionKey:appVersion, BuildVersionKey:buildVersion};
|
|
||||||
if (callback) {
|
|
||||||
callback(@[versionInfo]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary *)options
|
RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary *)options
|
||||||
resolver:(RCTPromiseResolveBlock)resolve
|
resolver:(RCTPromiseResolveBlock)resolve
|
||||||
rejecter:(RCTPromiseRejectBlock)reject)
|
rejecter:(RCTPromiseRejectBlock)reject)
|
||||||
|
@ -58,6 +58,11 @@
|
|||||||
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler
|
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler
|
||||||
{
|
{
|
||||||
dispatch_async(_opQueue, ^{
|
dispatch_async(_opQueue, ^{
|
||||||
|
|
||||||
|
if ([[NSFileManager defaultManager] fileExistsAtPath:destination]) {
|
||||||
|
[[NSFileManager defaultManager] removeItemAtPath:destination error:nil];
|
||||||
|
}
|
||||||
|
|
||||||
[SSZipArchive unzipFileAtPath:path toDestination:destination progressHandler:^(NSString *entry, unz_file_info zipInfo, long entryNumber, long total) {
|
[SSZipArchive unzipFileAtPath:path toDestination:destination progressHandler:^(NSString *entry, unz_file_info zipInfo, long entryNumber, long total) {
|
||||||
progressHandler(entry, entryNumber, total);
|
progressHandler(entry, entryNumber, total);
|
||||||
} completionHandler:^(NSString *path, BOOL succeeded, NSError *error) {
|
} completionHandler:^(NSString *path, BOOL succeeded, NSError *error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user