mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-10 07:10:36 +08:00
isRunningBinary
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
static BOOL didRollback = NO;
|
||||
static BOOL isRunningBinaryVersion = NO;
|
||||
static BOOL testConfigurationFlag = NO;
|
||||
|
||||
// These constants represent valid deployment statuses
|
||||
@@ -62,6 +63,7 @@ static NSString *const PackageIsPendingKey = @"isPending";
|
||||
|
||||
if (error || !packageFile) {
|
||||
NSLog(logMessageFormat, binaryJsBundleUrl);
|
||||
isRunningBinaryVersion = YES;
|
||||
return binaryJsBundleUrl;
|
||||
}
|
||||
|
||||
@@ -73,6 +75,7 @@ static NSString *const PackageIsPendingKey = @"isPending";
|
||||
NSDictionary *currentPackageMetadata = [CodePushPackage getCurrentPackage:&error];
|
||||
if (error || !currentPackageMetadata) {
|
||||
NSLog(logMessageFormat, binaryJsBundleUrl);
|
||||
isRunningBinaryVersion = YES;
|
||||
return binaryJsBundleUrl;
|
||||
}
|
||||
|
||||
@@ -82,6 +85,7 @@ static NSString *const PackageIsPendingKey = @"isPending";
|
||||
// Return package file because it is newer than the app store binary's JS bundle
|
||||
NSURL *packageUrl = [[NSURL alloc] initFileURLWithPath:packageFile];
|
||||
NSLog(logMessageFormat, packageUrl);
|
||||
isRunningBinaryVersion = NO;
|
||||
return packageUrl;
|
||||
} else {
|
||||
#ifndef DEBUG
|
||||
@@ -89,6 +93,7 @@ static NSString *const PackageIsPendingKey = @"isPending";
|
||||
#endif
|
||||
|
||||
NSLog(logMessageFormat, binaryJsBundleUrl);
|
||||
isRunningBinaryVersion = YES;
|
||||
return binaryJsBundleUrl;
|
||||
}
|
||||
}
|
||||
@@ -557,9 +562,7 @@ RCT_EXPORT_METHOD(getNewStatusReport:(RCTPromiseResolveBlock)resolve
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NSError *error;
|
||||
NSString *currentPackageHash = [CodePushPackage getCurrentPackageHash:&error];
|
||||
if (error || currentPackageHash == nil) {
|
||||
if (isRunningBinaryVersion) {
|
||||
// Check if the current appVersion has been reported. Use date as the binary identifier to
|
||||
// handle binary releases that do not modify the appVersion.
|
||||
NSURL *binaryJsBundleUrl = [CodePush bundleURL];
|
||||
|
||||
@@ -40,8 +40,9 @@ import java.util.zip.ZipFile;
|
||||
|
||||
public class CodePush {
|
||||
|
||||
private static boolean testConfigurationFlag = false;
|
||||
private static boolean didRollback = false;
|
||||
private static boolean isRunningBinaryVersion = false;
|
||||
private static boolean testConfigurationFlag = false;
|
||||
|
||||
private boolean didUpdate = false;
|
||||
|
||||
@@ -143,6 +144,7 @@ public class CodePush {
|
||||
if (packageFilePath == null) {
|
||||
// There has not been any downloaded updates.
|
||||
CodePushUtils.logBundleUrl(binaryJsBundleUrl);
|
||||
isRunningBinaryVersion = true;
|
||||
return binaryJsBundleUrl;
|
||||
}
|
||||
|
||||
@@ -158,6 +160,7 @@ public class CodePush {
|
||||
binaryModifiedDateDuringPackageInstall == binaryResourcesModifiedTime &&
|
||||
(this.isUsingTestConfiguration() || this.appVersion.equals(packageAppVersion))) {
|
||||
CodePushUtils.logBundleUrl(packageFilePath);
|
||||
isRunningBinaryVersion = false;
|
||||
return packageFilePath;
|
||||
} else {
|
||||
// The binary version is newer.
|
||||
@@ -167,6 +170,7 @@ public class CodePush {
|
||||
}
|
||||
|
||||
CodePushUtils.logBundleUrl(binaryJsBundleUrl);
|
||||
isRunningBinaryVersion = true;
|
||||
return binaryJsBundleUrl;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
@@ -488,9 +492,7 @@ public class CodePush {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String currentPackageHash = null;
|
||||
currentPackageHash = codePushPackage.getCurrentPackageHash();
|
||||
if (currentPackageHash == null) {
|
||||
if (isRunningBinaryVersion) {
|
||||
// Check if the current appVersion has been reported.
|
||||
String binaryIdentifier = "" + getBinaryResourcesModifiedTime();
|
||||
if (isDeploymentStatusNotYetReported(binaryIdentifier)) {
|
||||
|
||||
Reference in New Issue
Block a user