@srcpush/react-native-code-push 1.0.3-develop.1 → 1.0.3-feat-new-architecture.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CodePush.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { AcquisitionManager as Sdk } from "code-push/script/acquisition-sdk";
2
2
  import { Alert } from "./AlertAdapter";
3
3
  import requestFetchAdapter from "./request-fetch-adapter";
4
- import { AppState, Platform } from "react-native";
4
+ import { AppState, Platform, TurboModuleRegistry } from "react-native";
5
5
  import log from "./logging";
6
6
  import hoistStatics from 'hoist-non-react-statics';
7
7
 
8
- let NativeCodePush = require("react-native").NativeModules.CodePush;
8
+ let NativeCodePush = (TurboModuleRegistry?.get('CodePush')) || require("react-native").NativeModules.CodePush;
9
9
  const PackageMixins = require("./package-mixins")(NativeCodePush);
10
10
 
11
11
  async function checkForUpdate(deploymentKey = null, handleBinaryVersionMismatchCallback = null) {
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- #### [Sign up With Source Push](https://console.srcpush.com/register) to use Source Push SDK
1
+ #### [Sign up With Source Push](https://console.srcpush.com/register) to use CodePush SDK
2
2
 
3
3
  # React Native SDK for Source Push (CodePush compatible service)
4
4
 
5
- This plugin provides client-side integration for the [Source Push service](https://srcpush.com/), allowing you to easily add a dynamic update experience to your React Native app(s).
5
+ This plugin provides client-side integration for the [CodePush service](https://srcpush.com/), allowing you to easily add a dynamic update experience to your React Native app(s).
6
6
 
7
7
  <!-- React Native Catalog -->
8
8
 
@@ -34,20 +34,20 @@ This plugin provides client-side integration for the [Source Push service](https
34
34
 
35
35
  A React Native app is composed of JavaScript files and any accompanying [images](https://reactnative.dev/docs/image), which are bundled together by the [metro bundler](https://github.com/facebook/metro) and distributed as part of a platform-specific binary (i.e. an `.ipa` or `.apk` file). Once the app is released, updating either the JavaScript code (e.g. making bug fixes, adding new features) or image assets, requires you to recompile and redistribute the entire binary, which of course, includes any review time associated with the store(s) you are publishing to.
36
36
 
37
- The Source Push plugin helps get product improvements in front of your end users instantly, by keeping your JavaScript and images synchronized with updates you release to the Source Push server. This way, your app gets the benefits of an offline mobile experience, as well as the "web-like" agility of side-loading updates as soon as they are available. It's a win-win!
37
+ The CodePush plugin helps get product improvements in front of your end users instantly, by keeping your JavaScript and images synchronized with updates you release to the CodePush server. This way, your app gets the benefits of an offline mobile experience, as well as the "web-like" agility of side-loading updates as soon as they are available. It's a win-win!
38
38
 
39
- In order to ensure that your end users always have a functioning version of your app, the Source Push plugin maintains a copy of the previous update, so that in the event that you accidentally push an update which includes a crash, it can automatically roll back. This way, you can rest assured that your newfound release agility won't result in users becoming blocked before you have a chance to roll back on the server. It's a win-win-win!
39
+ In order to ensure that your end users always have a functioning version of your app, the CodePush plugin maintains a copy of the previous update, so that in the event that you accidentally push an update which includes a crash, it can automatically roll back. This way, you can rest assured that your newfound release agility won't result in users becoming blocked before you have a chance to roll back on the server. It's a win-win-win!
40
40
 
41
- *Note: Any product changes which touch native code (e.g. modifying your `AppDelegate.m`/`MainActivity.java` file, adding a new plugin) cannot be distributed via Source Push, and therefore, must be updated via the appropriate store(s).*
41
+ *Note: Any product changes which touch native code (e.g. modifying your `AppDelegate.m`/`MainActivity.java` file, adding a new plugin) cannot be distributed via CodePush, and therefore, must be updated via the appropriate store(s).*
42
42
 
43
43
  ## Supported React Native platforms
44
44
 
45
45
  * iOS (7+)
46
46
  * Android (4.1+) on TLS 1.2 compatible devices
47
47
 
48
- We try our best to maintain backwards compatibility of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the Source Push plugin in order to support the exact version of React Native you are using. The following table outlines which Source Push plugin versions officially support the respective React Native versions:
48
+ We try our best to maintain backwards compatibility of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the CodePush plugin in order to support the exact version of React Native you are using. The following table outlines which CodePush plugin versions officially support the respective React Native versions:
49
49
 
50
- | React Native version(s) | Supporting Source Push version(s) |
50
+ | React Native version(s) | Supporting CodePush version(s) |
51
51
  |-------------------------|---------------------------------------------------------------------------------------------|
52
52
  | <v0.76 | Use [microsoft/code-push-react-native](https://github.com/microsoft/react-native-code-push) |
53
53
  | v0.76, v0.77, 0.78 | v1.0+ *(Support both New and Old Architectures)* |
@@ -56,7 +56,7 @@ We work hard to respond to new RN releases, but they do occasionally break us. W
56
56
 
57
57
  ### Supported Components
58
58
 
59
- When using the React Native assets system (i.e. using the `require("./foo.png")` syntax), the following list represents the set of core components (and props) that support having their referenced images and videos updated via Source Push:
59
+ When using the React Native assets system (i.e. using the `require("./foo.png")` syntax), the following list represents the set of core components (and props) that support having their referenced images and videos updated via CodePush:
60
60
 
61
61
  | Component | Prop(s) |
62
62
  |-------------------------------------------------|------------------------------------------|
@@ -67,16 +67,16 @@ When using the React Native assets system (i.e. using the `require("./foo.png")`
67
67
  | `ToolbarAndroid` <br />*(React Native 0.21.0+)* | `actions[].icon`, `logo`, `overflowIcon` |
68
68
  | `Video` | `source` |
69
69
 
70
- The following list represents the set of components (and props) that don't currently support their assets being updated via Source Push, due to their dependency on static images and videos (i.e. using the `{ uri: "foo" }` syntax):
70
+ The following list represents the set of components (and props) that don't currently support their assets being updated via CodePush, due to their dependency on static images and videos (i.e. using the `{ uri: "foo" }` syntax):
71
71
 
72
72
  | Component | Prop(s) |
73
73
  |-------------|----------------------------------------------------------------------|
74
74
  | `SliderIOS` | `maximumTrackImage`, `minimumTrackImage`, `thumbImage`, `trackImage` |
75
75
  | `Video` | `source` |
76
76
 
77
- As new core components are released, which support referencing assets, we'll update this list to ensure users know what exactly they can expect to update using Source Push.
77
+ As new core components are released, which support referencing assets, we'll update this list to ensure users know what exactly they can expect to update using CodePush.
78
78
 
79
- *Note: Source Push only works with Video components when using `require` in the source prop. For example:*
79
+ *Note: CodePush only works with Video components when using `require` in the source prop. For example:*
80
80
 
81
81
  ```javascript
82
82
  <Video source={require("./foo.mp4")} />
@@ -84,13 +84,13 @@ As new core components are released, which support referencing assets, we'll upd
84
84
 
85
85
  ## Getting Started
86
86
 
87
- After you've created an account on [Source Push](https://console.srcpush.com/register), you can start Source Push-ifying your React Native app by running the following command from within your app's root directory:
87
+ After you've created an account on [Source Push](https://console.srcpush.com/register), you can start CodePush-ifying your React Native app by running the following command from within your app's root directory:
88
88
 
89
89
  ```shell
90
90
  npm install --save @srcpush/react-native-code-push
91
91
  ```
92
92
 
93
- As with all other React Native plugins, the integration experience is different for iOS and Android, so perform the following setup steps depending on which platform(s) you are targeting. Note, if you are targeting both platforms it is recommended to create separate Source Push applications for each platform.
93
+ As with all other React Native plugins, the integration experience is different for iOS and Android, so perform the following setup steps depending on which platform(s) you are targeting. Note, if you are targeting both platforms it is recommended to create separate CodePush applications for each platform.
94
94
 
95
95
  *NOTE: This guide assumes you have used the `@react-native-community/cli init` command to initialize your React Native project.*
96
96
 
@@ -101,13 +101,13 @@ Then continue with installing the native module
101
101
 
102
102
  ## Plugin Usage
103
103
 
104
- With the Source Push plugin downloaded and linked, and your app asking Source Push where to get the right JS bundle from, the only thing left is to add the necessary code to your app to control the following policies:
104
+ With the CodePush plugin downloaded and linked, and your app asking CodePush where to get the right JS bundle from, the only thing left is to add the necessary code to your app to control the following policies:
105
105
 
106
106
  1. When (and how often) to check for an update? (for example app start, in response to clicking a button in a settings page, periodically at some fixed interval)
107
107
 
108
108
  2. When an update is available, how to present it to the end user?
109
109
 
110
- The simplest way to do this is to "Source Push-ify" your app's root component. To do so, you can choose one of the following two options:
110
+ The simplest way to do this is to "CodePush-ify" your app's root component. To do so, you can choose one of the following two options:
111
111
 
112
112
  * **Option 1: Wrap your root component with the `codePush` higher-order component:**
113
113
 
package/SECURITY.md CHANGED
@@ -1,16 +1,20 @@
1
+ <!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
2
+
1
3
  ## Security
2
4
 
3
- Source Push takes the security of our software products and services seriously.
5
+ Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
4
6
 
5
- If you believe you have found a security vulnerability in this repository, please report it to us as described below.
7
+ If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
6
8
 
7
9
  ## Reporting Security Issues
8
10
 
9
11
  **Please do not report security vulnerabilities through public GitHub issues.**
10
12
 
11
- Instead, please report them to us via email at [security@srcpush.com](mailto:security@srcpush.com).
13
+ Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
14
+
15
+ If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
12
16
 
13
- You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
17
+ You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
14
18
 
15
19
  Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
16
20
 
@@ -22,4 +26,16 @@ Please include the requested information listed below (as much as you can provid
22
26
  * Proof-of-concept or exploit code (if possible)
23
27
  * Impact of the issue, including how an attacker might exploit the issue
24
28
 
25
- This information will help us triage your report more quickly.
29
+ This information will help us triage your report more quickly.
30
+
31
+ If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
32
+
33
+ ## Preferred Languages
34
+
35
+ We prefer all communications to be in English.
36
+
37
+ ## Policy
38
+
39
+ Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
40
+
41
+ <!-- END MICROSOFT SECURITY.MD BLOCK -->
@@ -40,6 +40,16 @@ android {
40
40
  defaultConfig {
41
41
  consumerProguardFiles 'proguard-rules.pro'
42
42
  }
43
+
44
+ sourceSets {
45
+ main {
46
+ if (IS_NEW_ARCHITECTURE_ENABLED) {
47
+ java.srcDirs += ['src/newarch/java']
48
+ } else {
49
+ java.srcDirs += ['src/oldarch/java']
50
+ }
51
+ }
52
+ }
43
53
  }
44
54
 
45
55
  dependencies {
@@ -46,7 +46,7 @@ import java.util.Map;
46
46
  import java.util.UUID;
47
47
 
48
48
  @OptIn(markerClass = UnstableReactNativeAPI.class)
49
- public class CodePushNativeModule extends BaseJavaModule {
49
+ public class CodePushNativeModule extends CodePushNativeModuleSpec {
50
50
  private String mBinaryContentsHash = null;
51
51
  private String mClientUniqueId = null;
52
52
  private LifecycleEventListener mLifecycleEventListener = null;
@@ -82,6 +82,11 @@ public class CodePushNativeModule extends BaseJavaModule {
82
82
 
83
83
  @Override
84
84
  public Map<String, Object> getConstants() {
85
+ return getTypedExportedConstants();
86
+ }
87
+
88
+ @Override
89
+ public Map<String, Object> getTypedExportedConstants() {
85
90
  final Map<String, Object> constants = new HashMap<>();
86
91
 
87
92
  constants.put("codePushInstallModeImmediate", CodePushInstallMode.IMMEDIATE.getValue());
@@ -500,8 +505,9 @@ public class CodePushNativeModule extends BaseJavaModule {
500
505
  }
501
506
  }
502
507
 
508
+ @Override
503
509
  @ReactMethod
504
- public void getUpdateMetadata(final int updateState, final Promise promise) {
510
+ public void getUpdateMetadata(final double updateState, final Promise promise) {
505
511
  AsyncTask<Void, Void, Void> asyncTask = new AsyncTask<Void, Void, Void>() {
506
512
  @Override
507
513
  protected Void doInBackground(Void... params) {
@@ -520,11 +526,11 @@ public class CodePushNativeModule extends BaseJavaModule {
520
526
  currentUpdateIsPending = mSettingsManager.isPendingUpdate(currentHash);
521
527
  }
522
528
 
523
- if (updateState == CodePushUpdateState.PENDING.getValue() && !currentUpdateIsPending) {
529
+ if ((int)updateState == CodePushUpdateState.PENDING.getValue() && !currentUpdateIsPending) {
524
530
  // The caller wanted a pending update
525
531
  // but there isn't currently one.
526
532
  promise.resolve(null);
527
- } else if (updateState == CodePushUpdateState.RUNNING.getValue() && currentUpdateIsPending) {
533
+ } else if ((int)updateState == CodePushUpdateState.RUNNING.getValue() && currentUpdateIsPending) {
528
534
  // The caller wants the running update, but the current
529
535
  // one is pending, so we need to grab the previous.
530
536
  JSONObject previousPackage = mUpdateManager.getPreviousPackage();
@@ -625,8 +631,9 @@ public class CodePushNativeModule extends BaseJavaModule {
625
631
  asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
626
632
  }
627
633
 
634
+ @Override
628
635
  @ReactMethod
629
- public void installUpdate(final ReadableMap updatePackage, final int installMode, final int minimumBackgroundDuration, final Promise promise) {
636
+ public void installUpdate(final ReadableMap updatePackage, final double installMode, final double minimumBackgroundDuration, final Promise promise) {
630
637
  AsyncTask<Void, Void, Void> asyncTask = new AsyncTask<Void, Void, Void>() {
631
638
  @Override
632
639
  protected Void doInBackground(Void... params) {
@@ -640,17 +647,17 @@ public class CodePushNativeModule extends BaseJavaModule {
640
647
  mSettingsManager.savePendingUpdate(pendingHash, /* isLoading */false);
641
648
  }
642
649
 
643
- if (installMode == CodePushInstallMode.ON_NEXT_RESUME.getValue() ||
650
+ if ((int)installMode == CodePushInstallMode.ON_NEXT_RESUME.getValue() ||
644
651
  // We also add the resume listener if the installMode is IMMEDIATE, because
645
652
  // if the current activity is backgrounded, we want to reload the bundle when
646
653
  // it comes back into the foreground.
647
- installMode == CodePushInstallMode.IMMEDIATE.getValue() ||
648
- installMode == CodePushInstallMode.ON_NEXT_SUSPEND.getValue()) {
654
+ (int)installMode == CodePushInstallMode.IMMEDIATE.getValue() ||
655
+ (int)installMode == CodePushInstallMode.ON_NEXT_SUSPEND.getValue()) {
649
656
 
650
657
  // Store the minimum duration on the native module as an instance
651
658
  // variable instead of relying on a closure below, so that any
652
659
  // subsequent resume-based installs could override it.
653
- CodePushNativeModule.this.mMinimumBackgroundDuration = minimumBackgroundDuration;
660
+ CodePushNativeModule.this.mMinimumBackgroundDuration = (int)minimumBackgroundDuration;
654
661
 
655
662
  if (mLifecycleEventListener == null) {
656
663
  // Ensure we do not add the listener twice.
@@ -672,7 +679,7 @@ public class CodePushNativeModule extends BaseJavaModule {
672
679
  // the foreground, so explicitly wait for it to be backgrounded first
673
680
  if (lastPausedDate != null) {
674
681
  long durationInBackground = (new Date().getTime() - lastPausedDate.getTime()) / 1000;
675
- if (installMode == CodePushInstallMode.IMMEDIATE.getValue()
682
+ if ((int)installMode == CodePushInstallMode.IMMEDIATE.getValue()
676
683
  || durationInBackground >= CodePushNativeModule.this.mMinimumBackgroundDuration) {
677
684
  CodePushUtils.log("Loading bundle on resume");
678
685
  restartAppInternal(false);
@@ -686,8 +693,8 @@ public class CodePushNativeModule extends BaseJavaModule {
686
693
  // resumed, we can detect how long it was in the background.
687
694
  lastPausedDate = new Date();
688
695
 
689
- if (installMode == CodePushInstallMode.ON_NEXT_SUSPEND.getValue() && mSettingsManager.isPendingUpdate(null)) {
690
- appSuspendHandler.postDelayed(loadBundleRunnable, minimumBackgroundDuration * 1000);
696
+ if ((int)installMode == CodePushInstallMode.ON_NEXT_SUSPEND.getValue() && mSettingsManager.isPendingUpdate(null)) {
697
+ appSuspendHandler.postDelayed(loadBundleRunnable, (int)minimumBackgroundDuration * 1000);
691
698
  }
692
699
  }
693
700
 
@@ -700,7 +707,11 @@ public class CodePushNativeModule extends BaseJavaModule {
700
707
  }
701
708
  }
702
709
 
703
- promise.resolve("");
710
+ if ((int)installMode == CodePushInstallMode.IMMEDIATE.getValue()) {
711
+ loadBundle();
712
+ }
713
+
714
+ promise.resolve(null);
704
715
  } catch(CodePushUnknownException e) {
705
716
  CodePushUtils.log(e);
706
717
  promise.reject(e);
@@ -822,13 +833,15 @@ public class CodePushNativeModule extends BaseJavaModule {
822
833
  mCodePush.clearUpdates();
823
834
  }
824
835
 
836
+ @Override
825
837
  @ReactMethod
826
838
  public void addListener(String eventName) {
827
839
  // Set up any upstream listeners or background tasks as necessary
828
840
  }
829
841
 
842
+ @Override
830
843
  @ReactMethod
831
- public void removeListeners(Integer count) {
844
+ public void removeListeners(double count) {
832
845
  // Remove upstream listeners, stop unnecessary background tasks
833
846
  }
834
847
 
@@ -0,0 +1,9 @@
1
+ package com.microsoft.codepush.react;
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext;
4
+
5
+ public abstract class CodePushNativeModuleSpec extends NativeRNCodePushSpec {
6
+ public CodePushNativeModuleSpec(ReactApplicationContext reactContext) {
7
+ super(reactContext);
8
+ }
9
+ }
@@ -0,0 +1,34 @@
1
+ package com.microsoft.codepush.react;
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext;
4
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
5
+ import com.facebook.react.bridge.Promise;
6
+ import com.facebook.react.bridge.ReadableMap;
7
+
8
+ public abstract class CodePushNativeModuleSpec extends ReactContextBaseJavaModule {
9
+ public CodePushNativeModuleSpec(ReactApplicationContext reactContext) {
10
+ super(reactContext);
11
+ }
12
+
13
+ public abstract void allow(Promise promise);
14
+ public abstract void clearPendingRestart(Promise promise);
15
+ public abstract void disallow(Promise promise);
16
+ public abstract void restartApp(boolean onlyIfUpdateIsPending, Promise promise);
17
+ public abstract void downloadUpdate(ReadableMap updatePackage, boolean notifyProgress, Promise promise);
18
+ public abstract void getConfiguration(Promise promise);
19
+ public abstract void getUpdateMetadata(double updateState, Promise promise);
20
+ public abstract void getNewStatusReport(Promise promise);
21
+ public abstract void installUpdate(ReadableMap updatePackage, double installMode, double minimumBackgroundDuration, Promise promise);
22
+ public abstract void isFailedUpdate(String packageHash, Promise promise);
23
+ public abstract void isFirstRun(String packageHash, Promise promise);
24
+ public abstract void notifyApplicationReady(Promise promise);
25
+ public abstract void recordStatusReported(ReadableMap statusReport);
26
+ public abstract void saveStatusReportForRetry(ReadableMap statusReport);
27
+ public abstract void downloadAndReplaceCurrentBundle(String remoteBundleUrl);
28
+ public abstract void clearUpdates();
29
+ public abstract void getLatestRollbackInfo(Promise promise);
30
+ public abstract void setLatestRollbackInfo(String packageHash, Promise promise);
31
+ public abstract void addListener(String eventName);
32
+ public abstract void removeListeners(double count);
33
+ public abstract java.util.Map<String, Object> getTypedExportedConstants();
34
+ }
@@ -1,16 +1,16 @@
1
1
  ### Resource Configuration
2
2
 
3
- Since `autolinking` uses `react-native.config.js` to link plugins, constructors are specified in that file. But you can override custom variables to manage the Source Push plugin by placing these values in string resources.
3
+ Since `autolinking` uses `react-native.config.js` to link plugins, constructors are specified in that file. But you can override custom variables to manage the CodePush plugin by placing these values in string resources.
4
4
 
5
5
  - **Public Key** - used for bundle verification in the Code Signing Feature. Please refer to [Code Signing](setup-android.md#code-signing-setup) section for more details about the Code Signing Feature.
6
- To set the public key, you should add the content of the public key to `strings.xml` with name `CodePushPublicKey`. Source Push automatically gets this property and enables the Code Signing feature. For example:
6
+ To set the public key, you should add the content of the public key to `strings.xml` with name `CodePushPublicKey`. CodePush automatically gets this property and enables the Code Signing feature. For example:
7
7
 
8
8
  ```xml
9
9
  <string moduleConfig="true" name="CodePushPublicKey">your-public-key</string>
10
10
  ```
11
11
 
12
- - **Server Url** - used for specifying Source Push Server Url.
13
- The Default value: "<https://api.srcpush.com>" is overridden by adding your path to `strings.xml` with name `CodePushServerUrl`. Source Push automatically gets this property and will use this path to send requests. For example:
12
+ - **Server Url** - used for specifying CodePush Server Url.
13
+ The Default value: "<https://api.srcpush.com>" is overridden by adding your path to `strings.xml` with name `CodePushServerUrl`. CodePush automatically gets this property and will use this path to send requests. For example:
14
14
 
15
15
  ```xml
16
16
  <string moduleConfig="true" name="CodePushServerUrl">https://api.srcpush.com</string>
@@ -22,21 +22,21 @@ The Java API is made available by importing the `com.microsoft.codepush.react.Co
22
22
 
23
23
  #### CodePush
24
24
 
25
- Constructs the Source Push client runtime and represents the `ReactPackage` instance that you add to you app's list of packages.
25
+ Constructs the CodePush client runtime and represents the `ReactPackage` instance that you add to you app's list of packages.
26
26
 
27
27
  ##### Constructors
28
28
 
29
- - **CodePush(String deploymentKey, Activity mainActivity)** - Creates a new instance of the Source Push runtime, that will be used to query the service for updates via the provided deployment key. The `mainActivity` parameter should always be set to `this` when configuring your React packages list inside the `MainActivity` class. This constructor puts the Source Push runtime into "release mode", so if you want to enable debugging behavior, use the following constructor instead.
29
+ - **CodePush(String deploymentKey, Activity mainActivity)** - Creates a new instance of the CodePush runtime, that will be used to query the service for updates via the provided deployment key. The `mainActivity` parameter should always be set to `this` when configuring your React packages list inside the `MainActivity` class. This constructor puts the CodePush runtime into "release mode", so if you want to enable debugging behavior, use the following constructor instead.
30
30
 
31
- - **CodePush(String deploymentKey, Activity mainActivity, bool isDebugMode)** - Equivalent to the previous constructor but allows you to specify whether you want the Source Push runtime to be in debug mode or not. When using this constructor, the `isDebugMode` parameter should always be set to `BuildConfig.DEBUG` in order to stay synchronized with your build type. When putting Source Push into debug mode, the following behaviors are enabled:
31
+ - **CodePush(String deploymentKey, Activity mainActivity, bool isDebugMode)** - Equivalent to the previous constructor but allows you to specify whether you want the CodePush runtime to be in debug mode or not. When using this constructor, the `isDebugMode` parameter should always be set to `BuildConfig.DEBUG` in order to stay synchronized with your build type. When putting CodePush into debug mode, the following behaviors are enabled:
32
32
 
33
- 1. Old Source Push updates aren't deleted from storage whenever a new binary is deployed to the emulator/device. This behavior enables you to deploy new binaries, without bumping the version during development, and without continuously getting the same update every time your app calls `sync`.
33
+ 1. Old CodePush updates aren't deleted from storage whenever a new binary is deployed to the emulator/device. This behavior enables you to deploy new binaries, without bumping the version during development, and without continuously getting the same update every time your app calls `sync`.
34
34
 
35
- 2. The local cache that the React Native runtime maintains in debug mode is deleted whenever a Source Push update is installed. This ensures that when the app is restarted after an update is applied, you will see the expected changes. As soon as [this PR](https://github.com/facebook/react-native/pull/4738) is merged, we won't need to do this anymore.
35
+ 2. The local cache that the React Native runtime maintains in debug mode is deleted whenever a CodePush update is installed. This ensures that when the app is restarted after an update is applied, you will see the expected changes. As soon as [this PR](https://github.com/facebook/react-native/pull/4738) is merged, we won't need to do this anymore.
36
36
 
37
37
  - **CodePush(String deploymentKey, Context context, boolean isDebugMode, Integer publicKeyResourceDescriptor)** - Equivalent to the previous constructor, but allows you to specify the public key resource descriptor needed to read public key content. Please refer to [Code Signing](setup-android.md#code-signing-setup) section for more details about the Code Signing Feature.
38
38
 
39
- - **CodePush(String deploymentKey, Context context, boolean isDebugMode, String serverUrl)** Constructor allows you to specify Source Push Server Url. The Default value: `"https://api.srcpush.com"` is overridden by value specified in `serverUrl`.
39
+ - **CodePush(String deploymentKey, Context context, boolean isDebugMode, String serverUrl)** Constructor allows you to specify CodePush Server Url. The Default value: `"https://api.srcpush.com"` is overridden by value specified in `serverUrl`.
40
40
 
41
41
  ##### Public Methods
42
42
 
package/docs/api-ios.md CHANGED
@@ -8,15 +8,15 @@ Contains static methods for retreiving the `NSURL` that represents the most rece
8
8
 
9
9
  The `CodePush` class' methods can be thought of as composite resolvers which always load the appropriate bundle, in order to accommodate the following scenarios:
10
10
 
11
- 1. When an end-user installs your app from the store (like `1.0.0`), they will get the JS bundle that is contained within the binary. This is the behavior you would get without using Source Push, but we make sure it doesn't break :)
11
+ 1. When an end-user installs your app from the store (like `1.0.0`), they will get the JS bundle that is contained within the binary. This is the behavior you would get without using CodePush, but we make sure it doesn't break :)
12
12
 
13
- 2. As soon as you begin releasing Source Push updates, your end-users will get the JS bundle that represents the latest release for the configured deployment. This is the behavior that allows you to iterate beyond what you shipped to the store.
13
+ 2. As soon as you begin releasing CodePush updates, your end-users will get the JS bundle that represents the latest release for the configured deployment. This is the behavior that allows you to iterate beyond what you shipped to the store.
14
14
 
15
- 3. As soon as you release an update to the app store (like `1.1.0`), and your end-users update it, they will once again get the JS bundle that is contained within the binary. This behavior ensures that Source Push updates that targetted a previous binary version aren't used (since we don't know if they would work), and your end-users always have a working version of your app.
15
+ 3. As soon as you release an update to the app store (like `1.1.0`), and your end-users update it, they will once again get the JS bundle that is contained within the binary. This behavior ensures that CodePush updates that targetted a previous binary version aren't used (since we don't know if they would work), and your end-users always have a working version of your app.
16
16
 
17
- 4. Repeat #2 and #3 as the Source Push releases and app store releases continue on into infinity (and beyond?)
17
+ 4. Repeat #2 and #3 as the CodePush releases and app store releases continue on into infinity (and beyond?)
18
18
 
19
- Because of this behavior, you can safely deploy updates to both the app store(s) and Source Push as necesary, and rest assured that your end-users will always get the most recent version.
19
+ Because of this behavior, you can safely deploy updates to both the app store(s) and CodePush as necesary, and rest assured that your end-users will always get the most recent version.
20
20
 
21
21
  ##### Methods
22
22
 
package/docs/api-js.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## API Reference
2
2
 
3
- The Source Push plugin is made up of two components:
3
+ The CodePush plugin is made up of two components:
4
4
 
5
5
  1. A JavaScript module, which can be imported/required, and allows the app to interact with the service during runtime (for example check for updates, inspect the metadata about the currently running app update).
6
6
 
@@ -14,23 +14,23 @@ When you require `react-native-code-push`, the module object provides the follow
14
14
 
15
15
  * [allowRestart](#codepushallowrestart): Re-allows programmatic restarts to occur as a result of an update being installed, and optionally, immediately restarts the app if a pending update had attempted to restart the app while restarts were disallowed. This is an advanced API and is only necessary if your app explicitly disallowed restarts via the `disallowRestart` method.
16
16
 
17
- * [checkForUpdate](#codepushcheckforupdate): Asks the Source Push service whether the configured app deployment has an update available.
17
+ * [checkForUpdate](#codepushcheckforupdate): Asks the CodePush service whether the configured app deployment has an update available.
18
18
 
19
- * [disallowRestart](#codepushdisallowrestart): Temporarily disallows any programmatic restarts to occur as a result of a Source Push update being installed. This is an advanced API, and is useful when a component within your app (for example an onboarding process) needs to ensure that no end-user interruptions can occur during its lifetime.
19
+ * [disallowRestart](#codepushdisallowrestart): Temporarily disallows any programmatic restarts to occur as a result of a CodePush update being installed. This is an advanced API, and is useful when a component within your app (for example an onboarding process) needs to ensure that no end-user interruptions can occur during its lifetime.
20
20
 
21
- * [getCurrentPackage](#codepushgetcurrentpackage): Retrieves the metadata about the currently installed update (like description, installation time, size). *NOTE: As of `v1.10.3-beta` of the Source Push module, this method is deprecated in favor of [`getUpdateMetadata`](#codepushgetupdatemetadata)*.
21
+ * [getCurrentPackage](#codepushgetcurrentpackage): Retrieves the metadata about the currently installed update (like description, installation time, size). *NOTE: As of `v1.10.3-beta` of the CodePush module, this method is deprecated in favor of [`getUpdateMetadata`](#codepushgetupdatemetadata)*.
22
22
 
23
23
  * [getUpdateMetadata](#codepushgetupdatemetadata): Retrieves the metadata for an installed update (like description, mandatory).
24
24
 
25
- * [notifyAppReady](#codepushnotifyappready): Notifies the Source Push runtime that an installed update is considered successful. If you are manually checking for and installing updates (i.e. not using the [sync](#codepushsync) method to handle it all for you), then this method **MUST** be called; otherwise Source Push will treat the update as failed and rollback to the previous version when the app next restarts.
25
+ * [notifyAppReady](#codepushnotifyappready): Notifies the CodePush runtime that an installed update is considered successful. If you are manually checking for and installing updates (i.e. not using the [sync](#codepushsync) method to handle it all for you), then this method **MUST** be called; otherwise CodePush will treat the update as failed and rollback to the previous version when the app next restarts.
26
26
 
27
27
  * [restartApp](#codepushrestartapp): Immediately restarts the app. If there is an update pending, it will be immediately displayed to the end user. Otherwise, calling this method simply has the same behavior as the end user killing and restarting the process.
28
28
 
29
- * [sync](#codepushsync): Allows checking for an update, downloading it and installing it, all with a single call. Unless you need custom UI and/or behavior, we recommend most developers to use this method when integrating Source Push into their apps
29
+ * [sync](#codepushsync): Allows checking for an update, downloading it and installing it, all with a single call. Unless you need custom UI and/or behavior, we recommend most developers to use this method when integrating CodePush into their apps
30
30
 
31
- * [clearUpdates](#clearupdates): Clear all downloaded Source Push updates. This is useful when switching to a different deployment which may have an older release than the current package.
31
+ * [clearUpdates](#clearupdates): Clear all downloaded CodePush updates. This is useful when switching to a different deployment which may have an older release than the current package.
32
32
 
33
- _Note: we don’t recommend to use this method in scenarios other than that (Source Push will call this method automatically when needed in other cases) as it could lead to unpredictable behavior._
33
+ _Note: we don’t recommend to use this method in scenarios other than that (CodePush will call this method automatically when needed in other cases) as it could lead to unpredictable behavior._
34
34
 
35
35
  #### codePush
36
36
 
@@ -162,7 +162,7 @@ Called when the sync process moves from one stage to another in the overall upda
162
162
 
163
163
  ##### codePushDownloadDidProgress (event hook)
164
164
 
165
- Called periodically when an available update is being downloaded from the Source Push server. The method is called with a `DownloadProgress` object, which contains the following two properties:
165
+ Called periodically when an available update is being downloaded from the CodePush server. The method is called with a `DownloadProgress` object, which contains the following two properties:
166
166
 
167
167
  * __totalBytes__ *(Number)* - The total number of bytes expected to be received for this update (i.e. the size of the set of files which changed from the previous release).
168
168
 
@@ -176,15 +176,15 @@ codePush.allowRestart(): void;
176
176
 
177
177
  Re-allows programmatic restarts to occur, that would have otherwise been rejected due to a previous call to `disallowRestart`. If `disallowRestart` was never called in the first place, then calling this method will simply result in a no-op.
178
178
 
179
- If a Source Push update is currently pending, which attempted to restart the app (for example it used `InstallMode.IMMEDIATE`), but was blocked due to `disallowRestart` having been called, then calling `allowRestart` will result in an immediate restart. This allows the update to be applied as soon as possible, without interrupting the end user during critical workflows (for example an onboarding process).
179
+ If a CodePush update is currently pending, which attempted to restart the app (for example it used `InstallMode.IMMEDIATE`), but was blocked due to `disallowRestart` having been called, then calling `allowRestart` will result in an immediate restart. This allows the update to be applied as soon as possible, without interrupting the end user during critical workflows (for example an onboarding process).
180
180
 
181
181
  For example, calling `allowRestart` would trigger an immediate restart if either of the three scenarios mentioned in the [`disallowRestart` docs](#codepushdisallowrestart) occured after `disallowRestart` was called. However, calling `allowRestart` wouldn't trigger a restart if the following were true:
182
182
 
183
- 1. No Source Push updates were installed since the last time `disallowRestart` was called, and therefore, there isn't any need to restart anyways.
183
+ 1. No CodePush updates were installed since the last time `disallowRestart` was called, and therefore, there isn't any need to restart anyways.
184
184
 
185
- 2. There is currently a pending Source Push update, but it was installed via `InstallMode.ON_NEXT_RESTART`, and therefore, doesn't require a programmatic restart.
185
+ 2. There is currently a pending CodePush update, but it was installed via `InstallMode.ON_NEXT_RESTART`, and therefore, doesn't require a programmatic restart.
186
186
 
187
- 3. There is currently a pending Source Push update, but it was installed via `InstallMode.ON_NEXT_RESUME` and the app hasn't been put into the background yet, and therefore, there isn't a need to programmatically restart yet.
187
+ 3. There is currently a pending CodePush update, but it was installed via `InstallMode.ON_NEXT_RESUME` and the app hasn't been put into the background yet, and therefore, there isn't a need to programmatically restart yet.
188
188
 
189
189
  4. No calls to `restartApp` were made since the last time `disallowRestart` was called.
190
190
 
@@ -198,7 +198,7 @@ See [disallowRestart](#codepushdisallowrestart) for an example of how this metho
198
198
  codePush.checkForUpdate(deploymentKey: String = null, handleBinaryVersionMismatchCallback: (update: RemotePackage) => void): Promise<RemotePackage>;
199
199
  ```
200
200
 
201
- Queries the Source Push service to see whether the configured app deployment has an update available. By default, it will use the deployment key that is configured in your `Info.plist` file (iOS), or `MainActivity.java` file (Android), but you can override that by specifying a value via the optional `deploymentKey` parameter. This can be useful when you want to dynamically "redirect" a user to a specific deployment, such as allowing "early access" via an easter egg or a user setting switch.
201
+ Queries the CodePush service to see whether the configured app deployment has an update available. By default, it will use the deployment key that is configured in your `Info.plist` file (iOS), or `MainActivity.java` file (Android), but you can override that by specifying a value via the optional `deploymentKey` parameter. This can be useful when you want to dynamically "redirect" a user to a specific deployment, such as allowing "early access" via an easter egg or a user setting switch.
202
202
 
203
203
  Second optional parameter `handleBinaryVersionMismatchCallback` is an optional callback function that can be used to notify user if there are any binary update.
204
204
  E.g. consider a use-case where currently installed binary version is 1.0.1 with label(codepush label) v1. Later native code was changed in the dev cycle and binary version was updated to 1.0.2. When code-push update check is triggered we ignore updates having binary version mismatch (because the update is not targeting to the binary version of currently installed app). In this case installed app (1.0.1) will ignore the update targeting version 1.0.2. You can use `handleBinaryVersionMismatchCallback` to provide a hook to handle such situations.
@@ -240,15 +240,15 @@ codePush.disallowRestart(): void;
240
240
 
241
241
  Temporarily disallows programmatic restarts to occur as a result of either of following scenarios:
242
242
 
243
- 1. A Source Push update is installed using `InstallMode.IMMEDIATE`
244
- 2. A Source Push update is installed using `InstallMode.ON_NEXT_RESUME` and the app is resumed from the background (optionally being throttled by the `minimumBackgroundDuration` property)
243
+ 1. A CodePush update is installed using `InstallMode.IMMEDIATE`
244
+ 2. A CodePush update is installed using `InstallMode.ON_NEXT_RESUME` and the app is resumed from the background (optionally being throttled by the `minimumBackgroundDuration` property)
245
245
  3. The `restartApp` method was called
246
246
 
247
247
  *NOTE: #1 and #2 effectively work by calling `restartApp` for you, so you can think of `disallowRestart` as blocking any call to `restartApp`, regardless if your app calls it directly or indirectly.*
248
248
 
249
249
  After calling this method, any calls to `sync` would still be allowed to check for an update, download it and install it, but an attempt to restart the app would be queued until `allowRestart` is called. This way, the restart request is captured and can be "flushed" whenever you want to allow it to occur.
250
250
 
251
- This is an advanced API, and is primarily useful when individual components within your app (like an onboarding process) need to ensure that no end-user interruptions can occur during their lifetime, while continuing to allow the app to keep syncing with the Source Push server at its own pace and using whatever install modes are appropriate. This has the benefit of allowing the app to discover and download available updates as soon as possible, while also preventing any disruptions during key end-user experiences.
251
+ This is an advanced API, and is primarily useful when individual components within your app (like an onboarding process) need to ensure that no end-user interruptions can occur during their lifetime, while continuing to allow the app to keep syncing with the CodePush server at its own pace and using whatever install modes are appropriate. This has the benefit of allowing the app to discover and download available updates as soon as possible, while also preventing any disruptions during key end-user experiences.
252
252
 
253
253
  As an alternative, you could also choose to simply use `InstallMode.ON_NEXT_RESTART` whenever calling `sync` (which will never attempt to programmatically restart the app), and then explicity calling `restartApp` at points in your app that you know it is "safe" to do so. `disallowRestart` provides an alternative approach to this when the code that synchronizes with the CodePush server is separate from the code/components that want to enforce a no-restart policy.
254
254
 
@@ -4,7 +4,7 @@
4
4
  >
5
5
  > Complete demo configured with "multi-deployment testing" feature is [here](https://github.com/microsoft/react-native-code-push/files/1314118/rncp1004.zip).
6
6
 
7
- The [Android Gradle plugin](https://google.github.io/android-gradle-dsl/current/index.html) allows you to define custom config settings for each "build type" (like debug, release). This mechanism allows you to easily configure your debug builds to use your Source Push staging deployment key and your release builds to use your Source Push production deployment key.
7
+ The [Android Gradle plugin](https://google.github.io/android-gradle-dsl/current/index.html) allows you to define custom config settings for each "build type" (like debug, release). This mechanism allows you to easily configure your debug builds to use your CodePush staging deployment key and your release builds to use your CodePush production deployment key.
8
8
 
9
9
  *NOTE: As a reminder, you can retrieve these keys by running `srcpush deployment ls <appName> -k` from your terminal.*
10
10
 
@@ -22,7 +22,7 @@ To set this up, perform the following steps:
22
22
  buildTypes {
23
23
  debug {
24
24
  ...
25
- // Note: Source Push updates should not be tested in Debug mode as they are overriden by the RN packager. However, because Source Push checks for updates in all modes, we must supply a key.
25
+ // Note: CodePush updates should not be tested in Debug mode as they are overriden by the RN packager. However, because CodePush checks for updates in all modes, we must supply a key.
26
26
  resValue "string", "CodePushDeploymentKey", '""'
27
27
  ...
28
28
  }
@@ -7,7 +7,7 @@
7
7
  > * **without using cocoa pods**: [link](https://github.com/microsoft/react-native-code-push/files/1259957/rncp976.copy.zip)
8
8
  > * **using cocoa pods**: [link](https://github.com/microsoft/react-native-code-push/files/1172217/rncp893.copy.zip)
9
9
 
10
- Xcode allows you to define custom build settings for each "configuration" (like debug, release), which can then be referenced as the value of keys within the `Info.plist` file (like the `CodePushDeploymentKey` setting). This mechanism allows you to easily configure your builds to produce binaries, which are configured to synchronize with different Source Push deployments.
10
+ Xcode allows you to define custom build settings for each "configuration" (like debug, release), which can then be referenced as the value of keys within the `Info.plist` file (like the `CodePushDeploymentKey` setting). This mechanism allows you to easily configure your builds to produce binaries, which are configured to synchronize with different CodePush deployments.
11
11
 
12
12
  To set this up, perform the following steps:
13
13
 
@@ -3,7 +3,7 @@
3
3
  * [Plugin Installation and Configuration for React Native 0.76 version and above](#plugin-installation-and-configuration-for-react-native-060-version-and-above-android)
4
4
  * [Code Signing setup](#code-signing-setup)
5
5
 
6
- In order to integrate Source Push into your Android project, please perform the following steps:
6
+ In order to integrate CodePush into your Android project, please perform the following steps:
7
7
 
8
8
  ### Plugin Installation and Configuration for React Native 0.76 version and above (Android)
9
9
 
@@ -15,7 +15,7 @@ In order to integrate Source Push into your Android project, please perform the
15
15
  ...
16
16
  ```
17
17
 
18
- 2. Update the `MainApplication` file to use Source Push via the following changes:
18
+ 2. Update the `MainApplication` file to use CodePush via the following changes:
19
19
 
20
20
  For React Native 0.76 and above: update the `MainApplication.kt`
21
21
 
@@ -35,7 +35,7 @@ In order to integrate Source Push into your Android project, please perform the
35
35
  }
36
36
 
37
37
  // 2. Override the getJSBundleFile method in order to let
38
- // the Source Push runtime determine where to get the JS
38
+ // the CodePush runtime determine where to get the JS
39
39
  // bundle location from on each app start
40
40
  override fun getJSBundleFile(): String {
41
41
  return CodePush.getJSBundleFile()
@@ -46,7 +46,7 @@ In order to integrate Source Push into your Android project, please perform the
46
46
 
47
47
  3. Add the Deployment key to `strings.xml`:
48
48
 
49
- To let the Source Push runtime know which deployment it should query for updates, open your app's `strings.xml` file and
49
+ To let the CodePush runtime know which deployment it should query for updates, open your app's `strings.xml` file and
50
50
  add a new string named `CodePushDeploymentKey`, whose value is the key of the deployment you want to configure this app against
51
51
  (like the key for the `Staging` deployment for the `FooBar` app). You can retrieve this value by running `srcpush deployment ls <appName> -k`
52
52
  in the Source Push CLI (the `-k` or `--displayKeys` flag is necessary since keys aren't displayed by default) or take in [Source Push UI](https://console.srcpush.com/applications)
@@ -55,7 +55,7 @@ The "friendly name" is intended only for authenticated management usage from the
55
55
 
56
56
  ![Deployment list](https://cloud.githubusercontent.com/assets/116461/11601733/13011d5e-9a8a-11e5-9ce2-b100498ffb34.png)
57
57
 
58
- In order to effectively make use of the `Staging` and `Production` deployments that were created along with your Source Push app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of Source Push into production.
58
+ In order to effectively make use of the `Staging` and `Production` deployments that were created along with your CodePush app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of CodePush into production.
59
59
 
60
60
  Your `strings.xml` should look like this:
61
61
 
@@ -68,11 +68,11 @@ The "friendly name" is intended only for authenticated management usage from the
68
68
 
69
69
  *Note: If you need to dynamically use a different deployment, you can also override your deployment key in JS code using [Code-Push options](./api-js.md#CodePushOptions)*
70
70
 
71
- In order to effectively make use of the `Staging` and `Production` deployments that were created along with your Source Push app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of Source Push into production.
71
+ In order to effectively make use of the `Staging` and `Production` deployments that were created along with your CodePush app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of CodePush into production.
72
72
 
73
73
  ### Code Signing setup
74
74
 
75
- You can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant Source Push documentation section](https://docs.srcpush.com).
75
+ You can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant code-push documentation section](https://github.com/microsoft/code-push/tree/v3.0.1/cli#code-signing).
76
76
  In order to use Public Key for Code Signing you need to do following steps:
77
77
 
78
78
  Add `CodePushPublicKey` string item to `/path_to_your_app/android/app/src/main/res/values/strings.xml`. It may look like this:
package/docs/setup-ios.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## iOS Setup
2
2
 
3
- Once you've acquired the Source Push plugin, you need to integrate it into the Xcode project of your React Native app and configure it correctly. To do this, take the following steps:
3
+ Once you've acquired the CodePush plugin, you need to integrate it into the Xcode project of your React Native app and configure it correctly. To do this, take the following steps:
4
4
 
5
5
  ### Plugin Installation and Configuration for React Native 0.76 version and above (iOS)
6
6
 
@@ -9,7 +9,7 @@ Once you've acquired the Source Push plugin, you need to integrate it into the X
9
9
  2. Change bundleUrl on AppDelegate file.
10
10
 
11
11
  **If you're using objective-c:**
12
- 1. Open up the `AppDelegate.m` file, and add an import statement for the Source Push headers:
12
+ 1. Open up the `AppDelegate.m` file, and add an import statement for the CodePush headers:
13
13
 
14
14
  ```objective-c
15
15
  #import <CodePush/CodePush.h>
@@ -27,11 +27,11 @@ Once you've acquired the Source Push plugin, you need to integrate it into the X
27
27
  return [CodePush bundleURL];
28
28
  ```
29
29
 
30
- This change configures your app to always load the most recent version of your app's JS bundle. On the first launch, this will correspond to the file that was compiled with the app. However, after an update has been pushed via Source Push, this will return the location of the most recently installed update.
30
+ This change configures your app to always load the most recent version of your app's JS bundle. On the first launch, this will correspond to the file that was compiled with the app. However, after an update has been pushed via CodePush, this will return the location of the most recently installed update.
31
31
 
32
32
  *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*
33
33
 
34
- Typically, you're only going to want to use Source Push 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 Source Push, 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.
34
+ 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.
35
35
 
36
36
  Your `sourceURLForBridge` method should look like this:
37
37
 
@@ -47,7 +47,7 @@ Once you've acquired the Source Push plugin, you need to integrate it into the X
47
47
  ```
48
48
 
49
49
  **If you're using Swift:**
50
- 1. Open up the `AppDelegate.swift` file, and add an import statement for the Source Push headers:
50
+ 1. Open up the `AppDelegate.swift` file, and add an import statement for the CodePush headers:
51
51
 
52
52
  ```swift
53
53
  import CodePush
@@ -79,20 +79,20 @@ Once you've acquired the Source Push plugin, you need to integrate it into the X
79
79
 
80
80
  4. Add the Deployment key to `Info.plist`:
81
81
 
82
- To let the Source Push runtime know which deployment it should query for updates against, open your app's `Info.plist`
82
+ To let the CodePush runtime know which deployment it should query for updates against, open your app's `Info.plist`
83
83
  file and add a new entry named `CodePushDeploymentKey`, whose value is the key of the deployment you want to configure
84
84
  this app against (like the key for the `Staging` deployment for the `FooBar` app). You can retrieve this value by running `srcpush deployment ls <appName> -k` in the Source Push CLI (the `-k` or `--displayKeys` flag is necessary since keys aren't displayed by default) or take in [Source Push UI](https://console.srcpush.com/applications) and copying the value of the `Key` column which corresponds to the deployment you want to use (see below). Note that using the deployment's name (like Staging) will not work.
85
85
  That "friendly name" is intended only for authenticated management usage from the CLI, and not for public consumption within your app.
86
86
 
87
87
  ![Deployment list](https://cloud.githubusercontent.com/assets/116461/11601733/13011d5e-9a8a-11e5-9ce2-b100498ffb34.png)
88
88
 
89
- In order to effectively make use of the `Staging` and `Production` deployments that were created along with your Source Push app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of Source Push into production.
89
+ In order to effectively make use of the `Staging` and `Production` deployments that were created along with your CodePush app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of CodePush into production.
90
90
 
91
91
  *Note: If you need to dynamically use a different deployment, you can also override your deployment key in JS code using [Code-Push options](./api-js.md#CodePushOptions)*
92
92
 
93
93
  ### HTTP exception domains configuration (iOS)
94
94
 
95
- Source Push plugin makes HTTPS requests to the following domains:
95
+ CodePush plugin makes HTTPS requests to the following domains:
96
96
 
97
97
  - api.srcpush.com
98
98
  - blob.srcpush.com
@@ -124,7 +124,7 @@ Before doing anything, please [read the docs][ats] first.
124
124
 
125
125
  ### Code Signing setup
126
126
 
127
- You can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant Source Push documentation section](https://docs.srcpush.com).
127
+ You can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant code-push documentation section](https://github.com/microsoft/code-push/tree/v3.0.1/cli#code-signing).
128
128
 
129
129
  In order to configure Public Key for bundle verification you need to add record in `Info.plist` with name `CodePushPublicKey` and string value of public key content. Example:
130
130
 
@@ -1,12 +1,12 @@
1
1
  ## Windows Setup
2
2
 
3
- Once you've acquired the Source Push plugin, you need to integrate it into the Visual Studio project of your React Native app and configure it correctly. To do this, take the following steps:
3
+ Once you've acquired the CodePush plugin, you need to integrate it into the Visual Studio project of your React Native app and configure it correctly. To do this, take the following steps:
4
4
 
5
5
  ### Plugin Installation and Configuration for React Native Windows 0.63.6 version and above
6
6
 
7
7
  #### Plugin Installation (Windows-npx)
8
8
 
9
- Once the plugin has been downloaded, run `npx react-native autolink-windows` in your application's root directory to automatically add the Source Push c++ project to your application's windows solution file.
9
+ Once the plugin has been downloaded, run `npx react-native autolink-windows` in your application's root directory to automatically add the CodePush c++ project to your application's windows solution file.
10
10
 
11
11
  #### Plugin Configuration (Windows)
12
12
 
@@ -78,7 +78,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
78
78
 
79
79
  #### Plugin Configuration (Windows)
80
80
 
81
- After installing the plugin, you need to configure your app to consult Source Push for the location of your JS bundle, since it will "take control" of managing the current and all future versions. To do this, update the `MainReactNativeHost.cs` file to use Source Push via the following changes:
81
+ After installing the plugin, you need to configure your app to consult CodePush for the location of your JS bundle, since it will "take control" of managing the current and all future versions. To do this, update the `MainReactNativeHost.cs` file to use CodePush via the following changes:
82
82
 
83
83
  ```c#
84
84
  ...
@@ -90,10 +90,10 @@ class MainReactNativeHost : ReactNativeHost
90
90
  // 2. Declare a private instance variable for the CodePushModule instance.
91
91
  private CodePushReactPackage codePushReactPackage;
92
92
 
93
- // 3. Update the JavaScriptBundleFile property to initalize the Source Push runtime,
93
+ // 3. Update the JavaScriptBundleFile property to initalize the CodePush runtime,
94
94
  // specifying the right deployment key, then use it to return the bundle URL from
95
- // Source Push instead of statically from the binary. If you don't already have your
96
- // deployment key, you can run "srcpush deployment ls <appName> -k" to retrieve it.
95
+ // CodePush instead of statically from the binary. If you don't already have your
96
+ // deployment key, you can run "appcenter codepush deployment list -a <ownerName>/<appName> -k" to retrieve it.
97
97
  protected override string JavaScriptBundleFile
98
98
  {
99
99
  get
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srcpush/react-native-code-push",
3
- "version": "1.0.3-develop.1",
3
+ "version": "1.0.3-feat-new-architecture.1",
4
4
  "description": "React Native plugin for the CodePush service",
5
5
  "main": "CodePush.js",
6
6
  "typings": "typings/react-native-code-push.d.ts",
@@ -81,5 +81,13 @@
81
81
  "postlink": "node node_modules/@srcpush/react-native-code-push/scripts/postlink/run",
82
82
  "postunlink": "node node_modules/@srcpush/react-native-code-push/scripts/postunlink/run"
83
83
  }
84
+ },
85
+ "codegenConfig": {
86
+ "name": "RNCodePush",
87
+ "type": "modules",
88
+ "jsSrcsDir": "src",
89
+ "android": {
90
+ "javaPackageName": "com.microsoft.codepush.react"
91
+ }
84
92
  }
85
93
  }
@@ -0,0 +1,39 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ getConstants(): {
6
+ codePushInstallModeImmediate: number;
7
+ codePushInstallModeOnNextRestart: number;
8
+ codePushInstallModeOnNextResume: number;
9
+ codePushInstallModeOnNextSuspend: number;
10
+ codePushUpdateStateRunning: number;
11
+ codePushUpdateStatePending: number;
12
+ codePushUpdateStateLatest: number;
13
+ };
14
+
15
+ allow(): Promise<void>;
16
+ clearPendingRestart(): Promise<void>;
17
+ disallow(): Promise<void>;
18
+ restartApp(onlyIfUpdateIsPending: boolean): Promise<void>;
19
+ downloadUpdate(updatePackage: Object, notifyProgress: boolean): Promise<Object>;
20
+ getConfiguration(): Promise<Object>;
21
+ getUpdateMetadata(updateState: number): Promise<Object>;
22
+ getNewStatusReport(): Promise<Object>;
23
+ installUpdate(updatePackage: Object, installMode: number, minimumBackgroundDuration: number): Promise<void>;
24
+ isFailedUpdate(packageHash: string): Promise<boolean>;
25
+ isFirstRun(packageHash: string): Promise<boolean>;
26
+ notifyApplicationReady(): Promise<void>;
27
+ recordStatusReported(statusReport: Object): void;
28
+ saveStatusReportForRetry(statusReport: Object): void;
29
+ downloadAndReplaceCurrentBundle(remoteBundleUrl: string): void;
30
+ clearUpdates(): void;
31
+ getLatestRollbackInfo(): Promise<Object>;
32
+ setLatestRollbackInfo(packageHash: string): Promise<void>;
33
+
34
+ // Events
35
+ addListener(eventName: string): void;
36
+ removeListeners(count: number): void;
37
+ }
38
+
39
+ export default TurboModuleRegistry.get<Spec>('CodePush');