mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-14 09:59:12 +08:00
Renaming restartPendingUpdate
This commit is contained in:
@@ -6,7 +6,7 @@ var packageMixins = require("./package-mixins")(NativeCodePush);
|
||||
var requestFetchAdapter = require("./request-fetch-adapter.js");
|
||||
var Sdk = require("code-push/script/acquisition-sdk").AcquisitionManager;
|
||||
|
||||
function checkForUpdate(deploymentKey) {
|
||||
function checkForUpdate(deploymentKey = null) {
|
||||
var config;
|
||||
var sdk;
|
||||
|
||||
@@ -274,12 +274,15 @@ function sync(options = {}, syncStatusChangeCallback, downloadProgressCallback)
|
||||
});
|
||||
};
|
||||
|
||||
codePush.installPendingUpdate();
|
||||
|
||||
var CodePush = {
|
||||
checkForUpdate: checkForUpdate,
|
||||
getConfiguration: getConfiguration,
|
||||
getCurrentPackage: getCurrentPackage,
|
||||
log: log,
|
||||
notifyApplicationReady: NativeCodePush.notifyApplicationReady,
|
||||
restartPendingUpdate: NativeCodePush.restartPendingUpdate,
|
||||
setUpTestDependencies: setUpTestDependencies,
|
||||
sync: sync,
|
||||
InstallMode: {
|
||||
|
||||
@@ -346,14 +346,14 @@ RCT_EXPORT_METHOD(notifyApplicationReady:(RCTPromiseResolveBlock)resolve
|
||||
resolve([NSNull null]);
|
||||
}
|
||||
|
||||
// This version of restart app is exposed solely for immediately installed
|
||||
// This function is exposed solely for immediately installed
|
||||
// update support, and shouldn't be consumed directly by user code.
|
||||
RCT_EXPORT_METHOD(restartForImmedidateUpdate:(int)rollbackTimeout)
|
||||
RCT_EXPORT_METHOD(restartImmedidateUpdate:(int)rollbackTimeout)
|
||||
{
|
||||
[self initializeUpdateWithRollbackTimeout:rollbackTimeout needsRestart:YES];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(restartForPendingUpdate)
|
||||
RCT_EXPORT_METHOD(restartPendingUpdate)
|
||||
{
|
||||
[self checkForPendingUpdate:YES];
|
||||
}
|
||||
|
||||
@@ -124,16 +124,16 @@ When you require the `react-native-code-push` module, that object provides the f
|
||||
|
||||
* [checkForUpdate](#codepushcheckforupdate): 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.
|
||||
* [getCurrentPackage](#codepushgetcurrentpackage): Gets information about the currently installed package (e.g. description, installation time)
|
||||
* [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
|
||||
* [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.
|
||||
* [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
|
||||
|
||||
#### codePush.checkForUpdate
|
||||
|
||||
```javascript
|
||||
codePush.checkForUpdate(deploymentKey: String): Promise<RemotePackage>;
|
||||
codePush.checkForUpdate(deploymentKey: String = null): Promise<RemotePackage>;
|
||||
```
|
||||
|
||||
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.
|
||||
Queries the CodePush service for an update using the deployment configured either 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.
|
||||
|
||||
`checkForUpdate` returns a Promise that resolves to one of two values:
|
||||
|
||||
|
||||
@@ -40,12 +40,8 @@ module.exports = (NativeCodePush) => {
|
||||
.then(function() {
|
||||
updateInstalledCallback && updateInstalledCallback();
|
||||
if (installMode == NativeCodePush.codePushInstallModeImmediate) {
|
||||
NativeCodePush.restartForImmedidateUpdate(rollbackTimeout);
|
||||
} else {
|
||||
this.restart = function () {
|
||||
NaviteCodePush.restartForPendingUpdate();
|
||||
}
|
||||
}
|
||||
NativeCodePush.restartImmedidateUpdate(rollbackTimeout);
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user