diff --git a/README.md b/README.md index 0706622..95848ce 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ We try our best to maintain backwards compatability of our plugin with previous | <0.14.0 | **Unsupported** | | v0.14.0 | v1.3.0 *(introduced Android support)* | | v0.15.0-v0.18.0 | v1.4.0-v1.6.0 *(introduced iOS asset support)* | -| v0.19.0-v0.22.0 | v1.7.0+ *(introduced Android asset support)* | -| v0.23.0+ | TBD :) We work hard to respond to new RN releases, but they do occasionally break us. We will update this chart with each RN release, so that users can check to see what our "official" support is. +| v0.19.0-v0.23.0 | v1.7.0+ *(introduced Android asset support)* | +| v0.24.0+ | TBD :) We work hard to respond to new RN releases, but they do occasionally break us. We will update this chart with each RN release, so that users can check to see what our "official" support is. ## Supported Components @@ -119,7 +119,7 @@ We hope to eventually remove the need for steps #2-4, but in the meantime, RNPM 1. Add the CodePush plugin dependency to your `Podfile`, pointing at the path where NPM installed it ```ruby - pod 'CodePush', :path => './node_modules/react-native-code-push` + pod 'CodePush', :path => './node_modules/react-native-code-push' ``` 2. Run `pod install` diff --git a/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java b/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java index 0e0bae1..77425ae 100644 --- a/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +++ b/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java @@ -149,7 +149,7 @@ public class CodePush implements ReactPackage { long binaryResourcesModifiedTime = this.getBinaryResourcesModifiedTime(); try { - String packageFilePath = this.codePushPackage.getCurrentPackageBundlePath(); + String packageFilePath = codePushPackage.getCurrentPackageBundlePath(this.assetsBundleFileName); if (packageFilePath == null) { // There has not been any downloaded updates. CodePushUtils.logBundleUrl(binaryJsBundleUrl); @@ -586,7 +586,7 @@ public class CodePush implements ReactPackage { public void downloadAndReplaceCurrentBundle(String remoteBundleUrl) { if (isUsingTestConfiguration()) { try { - codePushPackage.downloadAndReplaceCurrentBundle(remoteBundleUrl); + codePushPackage.downloadAndReplaceCurrentBundle(remoteBundleUrl, assetsBundleFileName); } catch (IOException e) { throw new CodePushUnknownException("Unable to replace current bundle", e); } @@ -633,4 +633,4 @@ public class CodePush implements ReactPackage { public List createViewManagers(ReactApplicationContext reactApplicationContext) { return new ArrayList<>(); } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/com/microsoft/codepush/react/CodePushPackage.java b/android/app/src/main/java/com/microsoft/codepush/react/CodePushPackage.java index a9483b4..fb048c3 100644 --- a/android/app/src/main/java/com/microsoft/codepush/react/CodePushPackage.java +++ b/android/app/src/main/java/com/microsoft/codepush/react/CodePushPackage.java @@ -31,7 +31,6 @@ public class CodePushPackage { private final String RELATIVE_BUNDLE_PATH_KEY = "bundlePath"; private final String STATUS_FILE = "codepush.json"; private final String UNZIPPED_FOLDER_NAME = "unzipped"; - private final String UPDATE_BUNDLE_FILE_NAME = "app.jsbundle"; private String documentsDirectory; @@ -95,7 +94,7 @@ public class CodePushPackage { return getPackageFolderPath(packageHash); } - public String getCurrentPackageBundlePath() { + public String getCurrentPackageBundlePath(String bundleFileName) { String packageFolder = getCurrentPackageFolderPath(); if (packageFolder == null) { return null; @@ -104,7 +103,7 @@ public class CodePushPackage { WritableMap currentPackage = getCurrentPackage(); String relativeBundlePath = CodePushUtils.tryGetString(currentPackage, RELATIVE_BUNDLE_PATH_KEY); if (relativeBundlePath == null) { - return CodePushUtils.appendPathComponent(packageFolder, UPDATE_BUNDLE_FILE_NAME); + return CodePushUtils.appendPathComponent(packageFolder, bundleFileName); } else { return CodePushUtils.appendPathComponent(packageFolder, relativeBundlePath); } @@ -246,7 +245,7 @@ public class CodePushPackage { String relativeBundlePath = CodePushUpdateUtils.findJSBundleInUpdateContents(newUpdateFolderPath, expectedBundleFileName); if (relativeBundlePath == null) { - throw new CodePushInvalidUpdateException("Update is invalid - no files with extension .bundle, .js or .jsbundle were found in the update package."); + throw new CodePushInvalidUpdateException("Update is invalid - A JS bundle file named \"" + expectedBundleFileName + "\" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary."); } else { if (FileUtils.fileAtPathExists(newUpdateMetadataPath)) { File metadataFileFromOldUpdate = new File(newUpdateMetadataPath); @@ -270,7 +269,7 @@ public class CodePushPackage { } } else { // File is a jsbundle, move it to a folder with the packageHash as its name - FileUtils.moveFile(downloadFile, newUpdateFolderPath, UPDATE_BUNDLE_FILE_NAME); + FileUtils.moveFile(downloadFile, newUpdateFolderPath, expectedBundleFileName); } // Save metadata to the folder. @@ -307,7 +306,7 @@ public class CodePushPackage { updateCurrentPackageInfo(info); } - public void downloadAndReplaceCurrentBundle(String remoteBundleUrl) throws IOException { + public void downloadAndReplaceCurrentBundle(String remoteBundleUrl, String bundleFileName) throws IOException { URL downloadUrl; HttpURLConnection connection = null; BufferedInputStream bin = null; @@ -317,7 +316,7 @@ public class CodePushPackage { downloadUrl = new URL(remoteBundleUrl); connection = (HttpURLConnection) (downloadUrl.openConnection()); bin = new BufferedInputStream(connection.getInputStream()); - File downloadFile = new File(getCurrentPackageBundlePath()); + File downloadFile = new File(getCurrentPackageBundlePath(bundleFileName)); downloadFile.delete(); fos = new FileOutputStream(downloadFile); bout = new BufferedOutputStream(fos, DOWNLOAD_BUFFER_SIZE); diff --git a/ios/CodePush/CodePushPackage.m b/ios/CodePush/CodePushPackage.m index a0658cc..cba883f 100644 --- a/ios/CodePush/CodePushPackage.m +++ b/ios/CodePush/CodePushPackage.m @@ -207,7 +207,9 @@ static NSString *const UnzippedFolderName = @"unzipped"; if (relativeBundlePath) { [mutableUpdatePackage setValue:relativeBundlePath forKey:RelativeBundlePathKey]; } else { - error = [CodePushErrorUtils errorWithMessage:@"Update is invalid - no files with extension .jsbundle or .bundle were found in the update package."]; + NSString *errorMessage = [NSString stringWithFormat:@"Update is invalid - A JS bundle file named \"%@\" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact same JS bundle file name that was shipped with your app's binary.", expectedBundleFileName]; + + error = [CodePushErrorUtils errorWithMessage:errorMessage]; failCallback(error); return;