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

Commit 9ee4f05

Browse files
committed
Updating docs
1 parent 24d3ef7 commit 9ee4f05

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

CodePush.ios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ var testConfig;
123123
var testSdk;
124124

125125
// This function is only used for tests. Replaces the default SDK, configuration and native bridge
126-
function setUpTestDependencies(providedTestSdk, providedTestConfig, testNativeBridge){
126+
function setUpTestDependencies(providedTestSdk, providedTestConfig, testNativeBridge) {
127127
if (providedTestSdk) testSdk = providedTestSdk;
128128
if (providedTestConfig) testConfig = providedTestConfig;
129129
if (testNativeBridge) NativeCodePush = testNativeBridge;

README.md

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,15 @@ When you require the `react-native-code-push` module, that object provides the f
126126
* [getCurrentPackage](#codepushgetcurrentpackage): Gets information about the currently installed package (e.g. description, installation time)
127127
* [notifyApplicationReady](#codepushnotifyapplicationready): Notifies the CodePush runtime that an installed update is considered successful. This is an optional API, but is useful when you want to expicitly enable "rollback protection" in the event that an exception occurs in any code that you've deployed to production
128128
* [restartApp](#codepushrestartapp): Immediately restarts the app if a previously installed update is pending.
129-
* [setDeploymentKey](#codepushsetdeploymentkey): Dynamically updates the deployment key that the CodePush runtime will use to query for app updates.
130129
* [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
131130
132131
#### codePush.checkForUpdate
133132
134133
```javascript
135-
codePush.checkForUpdate(): Promise<RemotePackage>;
134+
codePush.checkForUpdate(deploymentKey: String): Promise<RemotePackage>;
136135
```
137136

138-
Queries the CodePush service for an update against the configured deployment. This method returns a promise which resolves to a `RemotePackage` that can be subsequently downloaded.
137+
Queries the CodePush service for an update from the deployment configured in your `Info.plist` file, or specified using the optional `deploymentKey` parameter. This method returns a promise which resolves to a `RemotePackage` that can be subsequently downloaded.
139138

140139
`checkForUpdate` returns a Promise that resolves to one of two values:
141140

@@ -188,27 +187,6 @@ Installs a pending update (if applicable) by immediately restarting the app, and
188187

189188
If your app doesn't have a pending update, then calling this method results in a no-op. Otherwise, calling it will restart the app and start the rollback timer based on the timeout value that was specified in the previous call to `sync` or `LocalPackage.install`.
190189

191-
#### codePush.setDeploymentKey
192-
193-
```javascript
194-
codePush.setDeploymentKey(deploymentKey: String): Promise<void>;
195-
```
196-
197-
Dynamically updates the deployment key that the CodePush runtime will use to query for app updates. This is beneficial if your app has a default deployment key which you added to your `Info.plist` file, but you want to dynamically change it at runtime based on some app-specific policy (e.g. you want to give early access to certain users, by pointing them at your staging deployment).
198-
199-
The method simply takes a string representing the new deployment, and returns a `Promise` that will resolve once the specified deployment key has been applied, and calls to `sync` and/or `checkForUpdate` could be successfully called.
200-
201-
Example Usage:
202-
203-
```javascript
204-
codePush.setDeploymentKey("SOME_VALID_KEY_VALUE").then(() => {
205-
// The following call to sync with query the updated
206-
// app deployment for an update
207-
codePush.sync();
208-
});
209-
210-
```
211-
212190
#### codePush.sync
213191

214192
```javascript
@@ -226,6 +204,7 @@ If you want to pivot whether you check and/or download an available update based
226204

227205
The method accepts an options object that allows you to customize numerous aspects of the default behavior, all of which provide sensible values by default:
228206

207+
* __deploymentKey__ (String) - Specifies the deployment key you want to query for an update against. By default, this value is derived from the `Info.plist` file, but this option allows you to override it from the script-side if you need to dynamically change your app's current deployment.
229208
* __ignoreFailedUpdates__ (Boolean) - Indicates whether you would like to automatically ignored updates which are available, but have been previously attemped to install, but failed. Defaults to `true`.
230209
* __installMode__ (CodePush.InstallMode) - Indicates whether you would like to restart the app immediately after the update has been installed, or wait until the next app resume or restart. Defaults to `CodePush.InstallMode.ON_NEXT_RESTART`
231210
* __rollbackTimeout__ (Number) - The number of seconds that you want the runtime to wait after an update has been installed before considering it failed and rolling it back. Defaults to `0`, which disables rollback protection.

0 commit comments

Comments
 (0)