Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit c1187db

Browse files
committed
minor tweaks
1 parent 525e160 commit c1187db

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

CodePush.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async function checkForUpdate(deploymentKey = null) {
4040
* to send the app version to the server, since we are interested
4141
* in any updates for current app store version, regardless of hash.
4242
*/
43-
const queryPackage;
43+
let queryPackage;
4444
if (localPackage && localPackage.appVersion && semver.compare(localPackage.appVersion, config.appVersion) === 0) {
4545
queryPackage = localPackage;
4646
} else {
@@ -70,7 +70,7 @@ async function checkForUpdate(deploymentKey = null) {
7070
* because we want to avoid having to install diff updates against the binary's
7171
* version, which we can't do yet on Android.
7272
*/
73-
if (!update || update.updateAppVersion || localPackage && (update.packageHash === localPackage.packageHash) || config.packageHash === localPackage.packageHash) {
73+
if (!update || update.updateAppVersion || localPackage && (update.packageHash === localPackage.packageHash) || localPackage && config.packageHash === localPackage.packageHash) {
7474
if (update && update.updateAppVersion) {
7575
log("An update is available but it is targeting a newer binary version than you are currently running.");
7676
}

ios/CodePush/CodePush.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ failCallback:(void (^)(NSError *err))failCallback;
116116
error:(NSError **)error;
117117

118118
+ (NSString *)getAssetsFolderName;
119-
+ (NSString *)getDefaultJsBundleName;
120-
121119
+ (NSString *)getHashForBinaryContents:(NSURL *)binaryBundleUrl
122120
error:(NSError **)error;
123121

ios/CodePush/CodePushPackage.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ + (void)downloadPackage:(NSDictionary *)updatePackage
294294
}
295295

296296
[[NSFileManager defaultManager] copyItemAtPath:[[CodePush binaryBundleURL] path]
297-
toPath:[newUpdateCodePushPath stringByAppendingPathComponent:[CodePushUpdateUtils getDefaultJsBundleName]]
297+
toPath:[newUpdateCodePushPath stringByAppendingPathComponent:[[CodePush binaryBundleURL] lastPathComponent]]
298298
error:&error];
299299
if (error) {
300300
failCallback(error);

ios/CodePush/CodePushUpdateUtils.m

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ @implementation CodePushUpdateUtils
55

66
NSString * const AssetsFolderName = @"assets";
77
NSString * const BinaryHashKey = @"CodePushBinaryHash";
8-
NSString * const DefaultJsBundleName = @"main.jsbundle";
98
NSString * const ManifestFolderPrefix = @"CodePush";
109

1110
// These variables are used to cache the hash of the binary contents in memory.
1211
static NSString *binaryHash = nil;
13-
static BOOL didLoadBinaryHash = false;
12+
static BOOL didLoadBinaryHash = NO;
1413

1514
+ (void)addContentsOfFolderToManifest:(NSString *)folderPath
1615
pathPrefix:(NSString *)pathPrefix
@@ -160,16 +159,11 @@ + (NSString *)getAssetsFolderName
160159
return AssetsFolderName;
161160
}
162161

163-
+ (NSString *)getDefaultJsBundleName
164-
{
165-
return DefaultJsBundleName;
166-
}
167-
168162
+ (NSString *)getHashForBinaryContents:(NSURL *)binaryBundleUrl
169163
error:(NSError **)error
170164
{
171165
if (!didLoadBinaryHash) {
172-
didLoadBinaryHash = true;
166+
didLoadBinaryHash = YES;
173167

174168
// Get the cached hash from user preferences if it exists.
175169
NSString *binaryModifiedDate = [self modifiedDateStringOfFileAtURL:binaryBundleUrl];
@@ -199,7 +193,7 @@ + (NSString *)getHashForBinaryContents:(NSURL *)binaryBundleUrl
199193

200194
NSData *jsBundleContents = [NSData dataWithContentsOfURL:binaryBundleUrl];
201195
NSString *jsBundleContentsHash = [self computeHashForData:jsBundleContents];
202-
[manifest addObject:[[NSString stringWithFormat:@"%@/%@", [self getManifestFolderPrefix], [self getDefaultJsBundleName]] stringByAppendingString:jsBundleContentsHash]];
196+
[manifest addObject:[[NSString stringWithFormat:@"%@/%@:", [self getManifestFolderPrefix], [binaryBundleUrl lastPathComponent]] stringByAppendingString:jsBundleContentsHash]];
203197
binaryHash = [self computeFinalHashFromManifest:manifest error:error];
204198

205199
// Cache the hash in user preferences. This assumes that the modified date for the

0 commit comments

Comments
 (0)