Skip to content

Commit 8770f20

Browse files
committed
Merge pull request #264 from Microsoft/getBundleUrl
Introduce simpler getBundleUrl
2 parents 39132b0 + 1b3dac9 commit 8770f20

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ Constructs the CodePush client runtime and includes methods for integrating Code
771771

772772
##### Methods
773773

774+
- __getBundleUrl()__ - Returns the path to the most recent version of your app's JS bundle file, assuming that the resource name is `index.android.bundle`. If your app is using a different bundle name, then use the overloaded version of this method which allows specifying it. This method has the same resolution behavior as the Objective-C equivalent described above.
775+
774776
- __getBundleUrl(String bundleName)__ - Returns the path to the most recent version of your app's JS bundle file, using the specified resource name (e.g. `index.android.bundle`). This method has the same resolution behavior as the Objective-C equivalent described above.
775777

776778
- __getReactPackage()__ - Returns a `ReactPackage` object that should be added to your `ReactInstanceManager` via its `addPackage` method. Without this, the `react-native-code-push` JS module won't be available to your script.

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

+5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class CodePush implements ReactPackage {
5151
private static final String ASSETS_BUNDLE_PREFIX = "assets://";
5252
private static final String BINARY_MODIFIED_TIME_KEY = "binaryModifiedTime";
5353
private final String CODE_PUSH_PREFERENCES = "CodePush";
54+
private static final String DEFAULT_JS_BUNDLE_NAME = "index.android.bundle";
5455
private final String DOWNLOAD_PROGRESS_EVENT_NAME = "CodePushDownloadProgress";
5556
private final String FAILED_UPDATES_KEY = "CODE_PUSH_FAILED_UPDATES";
5657
private final String PACKAGE_HASH_KEY = "packageHash";
@@ -135,6 +136,10 @@ private long getBinaryResourcesModifiedTime() {
135136
}
136137
}
137138

139+
public static String getBundleUrl() {
140+
return getBundleUrl(DEFAULT_JS_BUNDLE_NAME);
141+
}
142+
138143
public static String getBundleUrl(String assetsBundleFileName) {
139144
if (currentInstance == null) {
140145
throw new CodePushNotInitializedException("A CodePush instance has not been created yet. Have you added it to your app's list of ReactPackages?");

0 commit comments

Comments
 (0)