From 8dc41fa7652318bc692cedba05de6e7de837d0dc Mon Sep 17 00:00:00 2001 From: Joe Noon Date: Fri, 8 Jan 2016 16:59:45 -0800 Subject: [PATCH 01/11] alternative way to set property This is the only other way I can think of. re #139 and #140 --- CodePush.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CodePush.m b/CodePush.m index bba73ed..c4946c7 100644 --- a/CodePush.m +++ b/CodePush.m @@ -230,7 +230,7 @@ static NSString *const PackageIsPendingKey = @"isPending"; // file (since Chrome wouldn't support it). Otherwise, update // the current bundle URL to point at the latest update if ([CodePush isUsingTestConfiguration] || ![_bridge.bundleURL.scheme hasPrefix:@"http"]) { - _bridge.bundleURL = [CodePush bundleURL]; + [_bridge setValue:[CodePush bundleURL] forKey:@"bundleURL"]; } [_bridge reload]; @@ -492,4 +492,4 @@ RCT_EXPORT_METHOD(downloadAndReplaceCurrentBundle:(NSString *)remoteBundleUrl) } } -@end \ No newline at end of file +@end From 042bf050e6c6f461b1dcac37ca1c8b4a53b03824 Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Sat, 9 Jan 2016 12:56:27 -0800 Subject: [PATCH 02/11] Bumping version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a937e37..d90622c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-code-push", - "version": "1.5.2-beta", + "version": "1.5.3-beta", "description": "React Native plugin for the CodePush service", "main": "CodePush.js", "homepage": "https://microsoft.github.io/code-push", From e62b8522cd47e51596af5902db4547ecbe65e073 Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Wed, 13 Jan 2016 12:59:36 -0800 Subject: [PATCH 03/11] Adding detail around store version --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 34965bb..273ba2e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # React Native Plugin for CodePush -This plugin provides client-side integration for the [CodePush service](https://microsoft.github.io/code-push), allowing you to easily add a dynamic update experience to your React Native app(s). +This plugin provides client-side integration for the [CodePush service](http://codepush.tools), allowing you to easily add a dynamic update experience to your React Native app(s). * [How does it work?](#how-does-it-work) * [Supported React Native Platforms](#supported-react-native-platforms) @@ -38,7 +38,7 @@ In order to ensure that your end users always have a functioning version of your ## Getting Started -Once you've followed the general-purpose ["getting started"](http://microsoft.github.io/code-push/docs/getting-started.html) instructions for setting up your CodePush account, you can start CodePush-ifying your React Native app by running the following command from within your app's root directory: +Once you've followed the general-purpose ["getting started"](http://codepush.tools/docs/getting-started.html) instructions for setting up your CodePush account, you can start CodePush-ifying your React Native app by running the following command from within your app's root directory: ``` npm install --save react-native-code-push @@ -105,8 +105,10 @@ To let the CodePush runtime know which deployment it should query for updates ag ![Deployment list](https://cloud.githubusercontent.com/assets/116461/11601733/13011d5e-9a8a-11e5-9ce2-b100498ffb34.png) -2. In your app's `Info.plist` make sure your `CFBundleShortVersionString` value is a valid [semver](http://semver.org/) version (e.g. 1.0.0 not 1.0) +2. In your app's `Info.plist` make sure your `Bundle versions string, short` (aka `CFBundleShortVersionString`) value is a valid [semver](http://semver.org/) version (e.g. 1.0.0 not 1.0) + ![Bundle version](https://cloud.githubusercontent.com/assets/116461/12307416/f9b82688-b9f3-11e5-839a-f1c6b4acd093.png) + ## Android Setup In order to integrate CodePush into your Android project, perform the following steps: @@ -211,8 +213,10 @@ Once your app has been configured and distributed to your users, and you've made 1. Execute `react-native bundle` (passing the appropriate parameters, see example below) in order to generate the updated JS bundle for your app. You can place this file wherever you want via the `--bundle-output` flag, since the exact location isn't relevant for CodePush purposes. It's important, however, that you set `--dev false` so that your JS code is optimized appropriately and any "yellow box" warnings won't be displayed. -2. Execute `code-push release --deploymentName ` in order to publish the generated JS bundle to the server. The `` parameter should equal the value you provided to the `--bundle-output` flag in step #1. Additionally, the `` parameter should equal the exact app store version (i.e. the semver version end users would see when installing it) you want this CodePush update to target. +2. Execute `code-push release --deploymentName ` in order to publish the generated JS bundle to the server. The `` parameter should equal the value you provided to the `--bundle-output` flag in step #1. Additionally, the `` parameter should equal the [**exact app store version**](http://microsoft.github.io/code-push/docs/cli.html#app-store-version-parameter) (i.e. the semver version end users would see when installing it) you want this CodePush update to target. + For more info regarding the `release` command and its parameters, refer to the [CLI documentation](http://codepush.tools/docs/cli.html). + Example Usage: ``` @@ -243,8 +247,10 @@ If you are using the new React Native [assets system](https://facebook.github.io --dev false ``` -3. Execute `code-push release`, passing the path to the directory you created in #1 as the "package" parameter (e.g. `code-push release Foo ./release 1.0.0`). The code-push CLI will automatically handle zipping up the contents for you, so don't worry about handling that yourself. +3. Execute `code-push release`, passing the path to the directory you created in #1 as the ["package"](http://codepush.tools/docs/cli.html#package-parameter) parameter, and the [**exact app version**](http://microsoft.github.io/code-push/docs/cli.html#app-store-version-parameter) that this update is targetting as the ["appStoreVersion"]((http://microsoft.github.io/code-push/docs/cli.html#app-store-version-parameter) parameter (e.g. `code-push release Foo ./release 1.0.0`). The code-push CLI will automatically handle zipping up the contents for you, so don't worry about handling that yourself. + For more info regarding the `release` command and its parameters, refer to the [CLI documentation](http://codepush.tools/docs/cli.html). + Additionally, the CodePush client supports differential updates, so even though you are releasing your JS bundle and assets on every update, your end users will only actually download the files they need. The service handles this automatically so that you can focus on creating awesome apps and we can worry about optimizing end user downloads. *Note: Releasing assets via CodePush is currently only supported on iOS, and requires that you're using React Native v0.15.0+ and CodePush 1.4.0+. If you are using assets and an older version of the CodePush plugin, you should not release updates via CodePush, because it will break your app's ability to load images from the binary. Please test and release appropriately!* From e4e9a082b6fc41a637d873ab9428d24356c76832 Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Wed, 13 Jan 2016 13:03:32 -0800 Subject: [PATCH 04/11] Updating links --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 273ba2e..66e05a7 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ Once your app has been configured and distributed to your users, and you've made 1. Execute `react-native bundle` (passing the appropriate parameters, see example below) in order to generate the updated JS bundle for your app. You can place this file wherever you want via the `--bundle-output` flag, since the exact location isn't relevant for CodePush purposes. It's important, however, that you set `--dev false` so that your JS code is optimized appropriately and any "yellow box" warnings won't be displayed. -2. Execute `code-push release --deploymentName ` in order to publish the generated JS bundle to the server. The `` parameter should equal the value you provided to the `--bundle-output` flag in step #1. Additionally, the `` parameter should equal the [**exact app store version**](http://microsoft.github.io/code-push/docs/cli.html#app-store-version-parameter) (i.e. the semver version end users would see when installing it) you want this CodePush update to target. +2. Execute `code-push release --deploymentName ` in order to publish the generated JS bundle to the server. The `` parameter should equal the value you provided to the `--bundle-output` flag in step #1. Additionally, the `` parameter should equal the [**exact app store version**](http://codepush.tools/docs/cli.html#app-store-version-parameter) (i.e. the semver version end users would see when installing it) you want this CodePush update to target. For more info regarding the `release` command and its parameters, refer to the [CLI documentation](http://codepush.tools/docs/cli.html). @@ -247,7 +247,7 @@ If you are using the new React Native [assets system](https://facebook.github.io --dev false ``` -3. Execute `code-push release`, passing the path to the directory you created in #1 as the ["package"](http://codepush.tools/docs/cli.html#package-parameter) parameter, and the [**exact app version**](http://microsoft.github.io/code-push/docs/cli.html#app-store-version-parameter) that this update is targetting as the ["appStoreVersion"]((http://microsoft.github.io/code-push/docs/cli.html#app-store-version-parameter) parameter (e.g. `code-push release Foo ./release 1.0.0`). The code-push CLI will automatically handle zipping up the contents for you, so don't worry about handling that yourself. +3. Execute `code-push release`, passing the path to the directory you created in #1 as the ["package"](http://codepush.tools/docs/cli.html#package-parameter) parameter, and the [**exact app version**](http://codepush.tools/docs/cli.html#app-store-version-parameter) that this update is targetting as the ["appStoreVersion"]((http://codepush.tools/docs/cli.html#app-store-version-parameter) parameter (e.g. `code-push release Foo ./release 1.0.0`). The code-push CLI will automatically handle zipping up the contents for you, so don't worry about handling that yourself. For more info regarding the `release` command and its parameters, refer to the [CLI documentation](http://codepush.tools/docs/cli.html). From a4d75b02c1b44d324a2968a1b657f4ad5ad0ac2b Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Wed, 13 Jan 2016 17:47:49 -0800 Subject: [PATCH 05/11] Fixing links --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 66e05a7..99ba5b6 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ Once your app has been configured and distributed to your users, and you've made 2. Execute `code-push release --deploymentName ` in order to publish the generated JS bundle to the server. The `` parameter should equal the value you provided to the `--bundle-output` flag in step #1. Additionally, the `` parameter should equal the [**exact app store version**](http://codepush.tools/docs/cli.html#app-store-version-parameter) (i.e. the semver version end users would see when installing it) you want this CodePush update to target. - For more info regarding the `release` command and its parameters, refer to the [CLI documentation](http://codepush.tools/docs/cli.html). + For more info regarding the `release` command and its parameters, refer to the [CLI documentation](http://codepush.tools/docs/cli.html#releasing-app-updates). Example Usage: @@ -247,9 +247,9 @@ If you are using the new React Native [assets system](https://facebook.github.io --dev false ``` -3. Execute `code-push release`, passing the path to the directory you created in #1 as the ["package"](http://codepush.tools/docs/cli.html#package-parameter) parameter, and the [**exact app version**](http://codepush.tools/docs/cli.html#app-store-version-parameter) that this update is targetting as the ["appStoreVersion"]((http://codepush.tools/docs/cli.html#app-store-version-parameter) parameter (e.g. `code-push release Foo ./release 1.0.0`). The code-push CLI will automatically handle zipping up the contents for you, so don't worry about handling that yourself. +3. Execute `code-push release`, passing the path to the directory you created in #1 as the ["package"](http://codepush.tools/docs/cli.html#package-parameter) parameter, and the [**exact app version**](http://codepush.tools/docs/cli.html#app-store-version-parameter) that this update is targetting as the ["appStoreVersion"](http://codepush.tools/docs/cli.html#app-store-version-parameter) parameter (e.g. `code-push release Foo ./release 1.0.0`). The code-push CLI will automatically handle zipping up the contents for you, so don't worry about handling that yourself. - For more info regarding the `release` command and its parameters, refer to the [CLI documentation](http://codepush.tools/docs/cli.html). + For more info regarding the `release` command and its parameters, refer to the [CLI documentation](http://codepush.tools/docs/cli.html#releasing-app-updates). Additionally, the CodePush client supports differential updates, so even though you are releasing your JS bundle and assets on every update, your end users will only actually download the files they need. The service handles this automatically so that you can focus on creating awesome apps and we can worry about optimizing end user downloads. From aaa060a790fa4cbe5fe1590366b6a6a83bedb81e Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Thu, 14 Jan 2016 14:59:16 -0500 Subject: [PATCH 06/11] Add missing slash --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 99ba5b6..aead1f0 100644 --- a/README.md +++ b/README.md @@ -243,7 +243,7 @@ If you are using the new React Native [assets system](https://facebook.github.io --platform ios \ --entry-file index.ios.js \ --bundle-output ./release/main.jsbundle \ - --assets-dest ./release + --assets-dest ./release \ --dev false ``` From 033d8afe4fad28c95ff284f4be89d0d1147dd744 Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Sat, 16 Jan 2016 13:20:23 -0800 Subject: [PATCH 07/11] Adding iOS debug detail --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index aead1f0..4476ce7 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,16 @@ This change configures your app to always load the most recent version of your a *NOTE: The `bundleURL` method assumes your app's JS bundle is named `main.jsbundle`. If you have configured your app to use a different file name, simply call the `bundleURLForResource:` method (which assumes you're using the `.jsbundle` extension) or `bundleURLForResource:withExtension:` method instead, in order to overwrite that default behavior* +Typically, you're only going to want to use CodePush to resolve your JS bundle within release builds, and therefore, we recommend using the `DEBUG` pre-processor macro to dynamically switch between using the packager server and CodePush, depending on whether you are debugging or not. This will make it much simpler to ensure you get the right behavior you want in production, while still being able to use the Chrome Dev Tools, live reload, etc. at debug-time. + +``` +#ifdef DEBUG + jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; +#else + jsCodeLocation = [CodePush bundleURL]; +#endif +``` + To let the CodePush runtime know which deployment it should query for updates against, perform the following steps: 1. Open your app's `Info.plist` file and add a new entry named `CodePushDeploymentKey`, whose value is the key of the deployment you want to configure this app against (e.g. the key for the `Staging` deployment for the `FooBar` app). You can retrieve this value by running `code-push deployment ls ` in the CodePush CLI, and copying the value of the `Deployment Key` column which corresponds to the deployment you want to use (see below). Note that using the deployment's name (e.g. Staging) will not work. That "friendly name" is intended only for authenticated management usage from the CLI, and not for public consumption within your app. From fcd8015a42c04553486b0df79addf225213781b7 Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Sat, 16 Jan 2016 13:23:31 -0800 Subject: [PATCH 08/11] Adding variable declaration line --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4476ce7..38eed28 100644 --- a/README.md +++ b/README.md @@ -99,9 +99,11 @@ This change configures your app to always load the most recent version of your a *NOTE: The `bundleURL` method assumes your app's JS bundle is named `main.jsbundle`. If you have configured your app to use a different file name, simply call the `bundleURLForResource:` method (which assumes you're using the `.jsbundle` extension) or `bundleURLForResource:withExtension:` method instead, in order to overwrite that default behavior* -Typically, you're only going to want to use CodePush to resolve your JS bundle within release builds, and therefore, we recommend using the `DEBUG` pre-processor macro to dynamically switch between using the packager server and CodePush, depending on whether you are debugging or not. This will make it much simpler to ensure you get the right behavior you want in production, while still being able to use the Chrome Dev Tools, live reload, etc. at debug-time. +Typically, you're only going to want to use CodePush to resolve your JS bundle location within release builds, and therefore, we recommend using the `DEBUG` pre-processor macro to dynamically switch between using the packager server and CodePush, depending on whether you are debugging or not. This will make it much simpler to ensure you get the right behavior you want in production, while still being able to use the Chrome Dev Tools, live reload, etc. at debug-time. ``` +NSURL *jsCodeLocation; + #ifdef DEBUG jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; #else From ab07913c529ea687e50a5e99de8d002a5b6df48b Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Sat, 16 Jan 2016 13:28:28 -0800 Subject: [PATCH 09/11] Adding syntax identifiers --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 38eed28..c57d139 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ In order to ensure that your end users always have a functioning version of your Once you've followed the general-purpose ["getting started"](http://codepush.tools/docs/getting-started.html) instructions for setting up your CodePush account, you can start CodePush-ifying your React Native app by running the following command from within your app's root directory: -``` +```shell npm install --save react-native-code-push ``` @@ -79,19 +79,19 @@ Once your Xcode project has been setup to build/link the CodePush plugin, you ne 1. Open up the `AppDelegate.m` file, and add an import statement for the CodePush headers: - ``` + ```objective-c #import "CodePush.h" ``` 2. Find the following line of code, which loads your JS Bundle from the app binary for production releases: - ``` + ```objective-c jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; ``` 3. Replace it with this line: - ``` + ```objective-c jsCodeLocation = [CodePush bundleURL]; ``` @@ -101,7 +101,7 @@ This change configures your app to always load the most recent version of your a Typically, you're only going to want to use CodePush to resolve your JS bundle location within release builds, and therefore, we recommend using the `DEBUG` pre-processor macro to dynamically switch between using the packager server and CodePush, depending on whether you are debugging or not. This will make it much simpler to ensure you get the right behavior you want in production, while still being able to use the Chrome Dev Tools, live reload, etc. at debug-time. -``` +```objective-c NSURL *jsCodeLocation; #ifdef DEBUG @@ -207,13 +207,13 @@ The simplest way to do this is to perform the following in your app's root compo 1. Import the JavaScript module for CodePush: - ``` + ```javascript import CodePush from "react-native-code-push"; ``` 2. Call the `sync` method from within the `componentDidMount` lifecycle event, to initiate a background update on each app start: - ``` + ```javascript CodePush.sync(); ``` @@ -231,7 +231,7 @@ Once your app has been configured and distributed to your users, and you've made Example Usage: -``` +```shell react-native bundle --platform ios --entry-file index.ios.js --bundle-output codepush.js --dev false code-push release MyApp codepush.js 1.0.2 ``` @@ -250,7 +250,7 @@ If you are using the new React Native [assets system](https://facebook.github.io 2. When calling `react-native bundle`, specify that your assets and JS bundle go into the directory you created in #1, and that you want a non-dev build for your respective platform and entry file. For example, assuming you called this directory "release", you could run the following command: - ``` + ```shell react-native bundle \ --platform ios \ --entry-file index.ios.js \ From 9cd57f54b53b22f66fc561c55c7d5189ce02bc0e Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Sun, 17 Jan 2016 21:55:36 -0800 Subject: [PATCH 10/11] Updating Java example to set debug mode --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c57d139..5d49968 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ After installing the plugin and syncing your Android Studio project with Gradle, protected void onCreate(Bundle savedInstanceState) { ... // 3. Initialize CodePush with your deployment key and an instance of your MainActivity. - CodePush codePush = new CodePush("d73bf5d8-4fbd-4e55-a837-accd328a21ba", this); + CodePush codePush = new CodePush("d73bf5d8-4fbd-4e55-a837-accd328a21ba", this, BuildConfig.DEBUG); ... mReactInstanceManager = ReactInstanceManager.builder() .setApplication(getApplication()) From 915de445d93bbb38eefce615af48cc649f271dc3 Mon Sep 17 00:00:00 2001 From: Alexandre Moureaux Date: Mon, 18 Jan 2016 23:03:28 +0100 Subject: [PATCH 11/11] Fix typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d49968..0b5de52 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Once you've acquired the CodePush plugin, you need to integrate it into the Xcod ![Add CodePush to project](https://cloud.githubusercontent.com/assets/516559/10322414/7688748e-6c32-11e5-83c1-00d3e6758df4.png) 3. Select the project node in Xcode and select the "Build Phases" tab of your project configuration. -4. Drag `libCodePush.a` from `Libraries/CodePush.xcodeproj/Products` into the "Link Binary With Libraries" secton of your project's "Build Phases" configuration. +4. Drag `libCodePush.a` from `Libraries/CodePush.xcodeproj/Products` into the "Link Binary With Libraries" section of your project's "Build Phases" configuration. ![Link CodePush during build](https://cloud.githubusercontent.com/assets/516559/10322221/a75ea066-6c31-11e5-9d88-ff6f6a4d6968.png)