@@ -128,32 +128,32 @@ + (NSURL *)bundleURLForResource:(NSString *)resourceName
128
128
bundleResourceExtension = resourceExtension;
129
129
bundleResourceSubdirectory = resourceSubdirectory;
130
130
bundleResourceBundle = resourceBundle;
131
-
131
+
132
132
[self ensureBinaryBundleExists ];
133
-
133
+
134
134
NSString *logMessageFormat = @" Loading JS bundle from %@ " ;
135
-
135
+
136
136
NSError *error;
137
137
NSString *packageFile = [CodePushPackage getCurrentPackageBundlePath: &error];
138
138
NSURL *binaryBundleURL = [self binaryBundleURL ];
139
-
139
+
140
140
if (error || !packageFile) {
141
141
CPLog (logMessageFormat, binaryBundleURL);
142
142
isRunningBinaryVersion = YES ;
143
143
return binaryBundleURL;
144
144
}
145
-
145
+
146
146
NSString *binaryAppVersion = [[CodePushConfig current ] appVersion ];
147
147
NSDictionary *currentPackageMetadata = [CodePushPackage getCurrentPackage: &error];
148
148
if (error || !currentPackageMetadata) {
149
149
CPLog (logMessageFormat, binaryBundleURL);
150
150
isRunningBinaryVersion = YES ;
151
151
return binaryBundleURL;
152
152
}
153
-
153
+
154
154
NSString *packageDate = [currentPackageMetadata objectForKey: BinaryBundleDateKey];
155
155
NSString *packageAppVersion = [currentPackageMetadata objectForKey: AppVersionKey];
156
-
156
+
157
157
if ([[CodePushUpdateUtils modifiedDateStringOfFileAtURL: binaryBundleURL] isEqualToString: packageDate] && ([CodePush isUsingTestConfiguration ] ||[binaryAppVersion isEqualToString: packageAppVersion])) {
158
158
// Return package file because it is newer than the app store binary's JS bundle
159
159
NSURL *packageUrl = [[NSURL alloc ] initFileURLWithPath: packageFile];
@@ -165,11 +165,11 @@ + (NSURL *)bundleURLForResource:(NSString *)resourceName
165
165
#ifndef DEBUG
166
166
isRelease = YES ;
167
167
#endif
168
-
168
+
169
169
if (isRelease || ![binaryAppVersion isEqualToString: packageAppVersion]) {
170
170
[CodePush clearUpdates ];
171
171
}
172
-
172
+
173
173
CPLog (logMessageFormat, binaryBundleURL);
174
174
isRunningBinaryVersion = YES ;
175
175
return binaryBundleURL;
0 commit comments