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

Commit 8495e7d

Browse files
committed
Moving restartApp to LocalPackage
1 parent 9ee4f05 commit 8495e7d

File tree

4 files changed

+11
-22
lines changed

4 files changed

+11
-22
lines changed

CodePush.ios.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ var CodePush = {
280280
getCurrentPackage: getCurrentPackage,
281281
log: log,
282282
notifyApplicationReady: NativeCodePush.notifyApplicationReady,
283-
restartApp: NativeCodePush.restartApp,
284283
setUpTestDependencies: setUpTestDependencies,
285284
sync: sync,
286285
InstallMode: {

CodePush.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,18 +346,18 @@ - (void)startRollbackTimer:(int)rollbackTimeout
346346
resolve([NSNull null]);
347347
}
348348

349-
RCT_EXPORT_METHOD(restartApp)
350-
{
351-
[self checkForPendingUpdate:YES];
352-
}
353-
354349
// This version of restart app is exposed solely for immediately installed
355350
// update support, and shouldn't be consumed directly by user code.
356-
RCT_EXPORT_METHOD(restartAppInternal:(int)rollbackTimeout)
351+
RCT_EXPORT_METHOD(restartForImmedidateUpdate:(int)rollbackTimeout)
357352
{
358353
[self initializeUpdateWithRollbackTimeout:rollbackTimeout needsRestart:YES];
359354
}
360355

356+
RCT_EXPORT_METHOD(restartForPendingUpdate)
357+
{
358+
[self checkForPendingUpdate:YES];
359+
}
360+
361361
RCT_EXPORT_METHOD(setUsingTestFolder:(BOOL)shouldUseTestFolder)
362362
{
363363
usingTestFolder = shouldUseTestFolder;

README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ When you require the `react-native-code-push` module, that object provides the f
125125
* [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.
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
128-
* [restartApp](#codepushrestartapp): Immediately restarts the app if a previously installed update is pending.
129128
* [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
130129
131130
#### codePush.checkForUpdate
@@ -174,19 +173,6 @@ Notifies the CodePush runtime that an update is considered successful, and there
174173

175174
If the `rollbackTimeout` parameter was not specified, the CodePush runtime will not enforce any automatic rollback behavior, and therefore, calling this function is not required and will result in a no-op.
176175

177-
#### codePush.restartApp
178-
179-
```javascript
180-
codePush.restartApp(): void;
181-
```
182-
183-
Installs a pending update (if applicable) by immediately restarting the app, and optionally starting the rollback timer. This method is for advanced scenarios, and is useful when the following conditions are true:
184-
185-
1. Your app is specifying an install mode value of `ON_NEXT_RESTART` or `ON_NEXT_RESUME` when calling `sync` or `LocalPackage.install`, which has the effect of not applying your update until the app has been restarted (by either the end-user or OS)
186-
2. You have an app-specific user event (e.g. the end-user navigated back to the app's home page) that allows you to apply the update in an unobtrusive way, and potentially gets the update in front of the end-user sooner then waiting until the next restart.
187-
188-
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`.
189-
190176
#### codePush.sync
191177

192178
```javascript

package-mixins.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ module.exports = (NativeCodePush) => {
4040
.then(function() {
4141
updateInstalledCallback && updateInstalledCallback();
4242
if (installMode == NativeCodePush.codePushInstallModeImmediate) {
43-
NativeCodePush.restartAppInternal(rollbackTimeout);
43+
NativeCodePush.restartImmedidateUpdate(rollbackTimeout);
44+
} else {
45+
this.restart = function () {
46+
NaviteCodePush.restartForPendingUpdate();
47+
}
4448
}
4549
});
4650
}

0 commit comments

Comments
 (0)