verifyHashForZipUpdate -> verifyHashForDiffUpdate

This commit is contained in:
Geoffrey Goh
2016-02-19 10:58:04 -08:00
parent 1d45e99fd1
commit e8307d6501
5 changed files with 17 additions and 14 deletions

View File

@@ -111,9 +111,9 @@ failCallback:(void (^)(NSError *err))failCallback;
error:(NSError **)error;
+ (NSString *)findMainBundleInFolder:(NSString *)folderPath
error:(NSError **)error;
+ (BOOL)verifyHashForZipUpdate:(NSString *)finalUpdateFolder
expectedHash:(NSString *)expectedHash
error:(NSError **)error;
+ (BOOL)verifyHashForDiffUpdate:(NSString *)finalUpdateFolder
expectedHash:(NSString *)expectedHash
error:(NSError **)error;
@end

View File

@@ -257,8 +257,9 @@ NSString * const UnzippedFolderName = @"unzipped";
}
NSString *diffManifestFilePath = [unzippedFolderPath stringByAppendingPathComponent:DiffManifestFileName];
BOOL isDiffUpdate = [[NSFileManager defaultManager] fileExistsAtPath:diffManifestFilePath];
if ([[NSFileManager defaultManager] fileExistsAtPath:diffManifestFilePath]) {
if (isDiffUpdate) {
// Copy the current package to the new package.
NSString *currentPackageFolderPath = [self getCurrentPackageFolderPath:&error];
if (error) {
@@ -368,9 +369,9 @@ NSString * const UnzippedFolderName = @"unzipped";
}
}
if (![CodePushUpdateUtils verifyHashForZipUpdate:newUpdateFolderPath
expectedHash:newUpdateHash
error:&error]) {
if (isDiffUpdate && ![CodePushUpdateUtils verifyHashForDiffUpdate:newUpdateFolderPath
expectedHash:newUpdateHash
error:&error]) {
if (error) {
failCallback(error);
return;

View File

@@ -127,9 +127,9 @@
return nil;
}
+ (BOOL)verifyHashForZipUpdate:(NSString *)finalUpdateFolder
expectedHash:(NSString *)expectedHash
error:(NSError **)error
+ (BOOL)verifyHashForDiffUpdate:(NSString *)finalUpdateFolder
expectedHash:(NSString *)expectedHash
error:(NSError **)error
{
NSMutableArray *updateContentsManifest = [NSMutableArray array];
[self addContentsOfFolderToManifest:finalUpdateFolder