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

Commit 511dbe9

Browse files
committed
update to master
2 parents e0ea757 + 587f9b2 commit 511dbe9

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ We try our best to maintain backwards compatability of our plugin with previous
4848
| <0.14.0 | **Unsupported** |
4949
| v0.14.0 | v1.3.0 *(introduced Android support)* |
5050
| v0.15.0-v0.18.0 | v1.4.0-v1.6.0 *(introduced iOS asset support)* |
51-
| v0.19.0-v0.22.0 | v1.7.0+ *(introduced Android asset support)* |
52-
| 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.
51+
| v0.19.0-v0.23.0 | v1.7.0+ *(introduced Android asset support)* |
52+
| 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.
5353

5454
## Supported Components
5555

@@ -119,7 +119,7 @@ We hope to eventually remove the need for steps #2-4, but in the meantime, RNPM
119119
1. Add the CodePush plugin dependency to your `Podfile`, pointing at the path where NPM installed it
120120

121121
```ruby
122-
pod 'CodePush', :path => './node_modules/react-native-code-push`
122+
pod 'CodePush', :path => './node_modules/react-native-code-push'
123123
```
124124

125125
2. Run `pod install`

android/app/src/main/java/com/microsoft/codepush/react/CodePush.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public String getBundleUrlInternal(String assetsBundleFileName) {
149149
long binaryResourcesModifiedTime = this.getBinaryResourcesModifiedTime();
150150

151151
try {
152-
String packageFilePath = this.codePushPackage.getCurrentPackageBundlePath();
152+
String packageFilePath = codePushPackage.getCurrentPackageBundlePath(this.assetsBundleFileName);
153153
if (packageFilePath == null) {
154154
// There has not been any downloaded updates.
155155
CodePushUtils.logBundleUrl(binaryJsBundleUrl);
@@ -586,7 +586,7 @@ public void restartApp(boolean onlyIfUpdateIsPending) {
586586
public void downloadAndReplaceCurrentBundle(String remoteBundleUrl) {
587587
if (isUsingTestConfiguration()) {
588588
try {
589-
codePushPackage.downloadAndReplaceCurrentBundle(remoteBundleUrl);
589+
codePushPackage.downloadAndReplaceCurrentBundle(remoteBundleUrl, assetsBundleFileName);
590590
} catch (IOException e) {
591591
throw new CodePushUnknownException("Unable to replace current bundle", e);
592592
}
@@ -633,4 +633,4 @@ public List<Class<? extends JavaScriptModule>> createJSModules() {
633633
public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
634634
return new ArrayList<>();
635635
}
636-
}
636+
}

android/app/src/main/java/com/microsoft/codepush/react/CodePushPackage.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public class CodePushPackage {
3131
private final String RELATIVE_BUNDLE_PATH_KEY = "bundlePath";
3232
private final String STATUS_FILE = "codepush.json";
3333
private final String UNZIPPED_FOLDER_NAME = "unzipped";
34-
private final String UPDATE_BUNDLE_FILE_NAME = "app.jsbundle";
3534

3635
private String documentsDirectory;
3736

@@ -95,7 +94,7 @@ public String getCurrentPackageFolderPath() {
9594
return getPackageFolderPath(packageHash);
9695
}
9796

98-
public String getCurrentPackageBundlePath() {
97+
public String getCurrentPackageBundlePath(String bundleFileName) {
9998
String packageFolder = getCurrentPackageFolderPath();
10099
if (packageFolder == null) {
101100
return null;
@@ -104,7 +103,7 @@ public String getCurrentPackageBundlePath() {
104103
WritableMap currentPackage = getCurrentPackage();
105104
String relativeBundlePath = CodePushUtils.tryGetString(currentPackage, RELATIVE_BUNDLE_PATH_KEY);
106105
if (relativeBundlePath == null) {
107-
return CodePushUtils.appendPathComponent(packageFolder, UPDATE_BUNDLE_FILE_NAME);
106+
return CodePushUtils.appendPathComponent(packageFolder, bundleFileName);
108107
} else {
109108
return CodePushUtils.appendPathComponent(packageFolder, relativeBundlePath);
110109
}
@@ -246,7 +245,7 @@ public void downloadPackage(ReadableMap updatePackage, String expectedBundleFile
246245
String relativeBundlePath = CodePushUpdateUtils.findJSBundleInUpdateContents(newUpdateFolderPath, expectedBundleFileName);
247246

248247
if (relativeBundlePath == null) {
249-
throw new CodePushInvalidUpdateException("Update is invalid - no files with extension .bundle, .js or .jsbundle were found in the update package.");
248+
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.");
250249
} else {
251250
if (FileUtils.fileAtPathExists(newUpdateMetadataPath)) {
252251
File metadataFileFromOldUpdate = new File(newUpdateMetadataPath);
@@ -270,7 +269,7 @@ public void downloadPackage(ReadableMap updatePackage, String expectedBundleFile
270269
}
271270
} else {
272271
// File is a jsbundle, move it to a folder with the packageHash as its name
273-
FileUtils.moveFile(downloadFile, newUpdateFolderPath, UPDATE_BUNDLE_FILE_NAME);
272+
FileUtils.moveFile(downloadFile, newUpdateFolderPath, expectedBundleFileName);
274273
}
275274

276275
// Save metadata to the folder.
@@ -307,7 +306,7 @@ public void rollbackPackage() {
307306
updateCurrentPackageInfo(info);
308307
}
309308

310-
public void downloadAndReplaceCurrentBundle(String remoteBundleUrl) throws IOException {
309+
public void downloadAndReplaceCurrentBundle(String remoteBundleUrl, String bundleFileName) throws IOException {
311310
URL downloadUrl;
312311
HttpURLConnection connection = null;
313312
BufferedInputStream bin = null;
@@ -317,7 +316,7 @@ public void downloadAndReplaceCurrentBundle(String remoteBundleUrl) throws IOExc
317316
downloadUrl = new URL(remoteBundleUrl);
318317
connection = (HttpURLConnection) (downloadUrl.openConnection());
319318
bin = new BufferedInputStream(connection.getInputStream());
320-
File downloadFile = new File(getCurrentPackageBundlePath());
319+
File downloadFile = new File(getCurrentPackageBundlePath(bundleFileName));
321320
downloadFile.delete();
322321
fos = new FileOutputStream(downloadFile);
323322
bout = new BufferedOutputStream(fos, DOWNLOAD_BUFFER_SIZE);

ios/CodePush/CodePushPackage.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ + (void)downloadPackage:(NSDictionary *)updatePackage
207207
if (relativeBundlePath) {
208208
[mutableUpdatePackage setValue:relativeBundlePath forKey:RelativeBundlePathKey];
209209
} else {
210-
error = [CodePushErrorUtils errorWithMessage:@"Update is invalid - no files with extension .jsbundle or .bundle were found in the update package."];
210+
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];
211+
212+
error = [CodePushErrorUtils errorWithMessage:errorMessage];
211213

212214
failCallback(error);
213215
return;

0 commit comments

Comments
 (0)