mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-14 02:14:52 +08:00
iOS implementation of minimumBackgroundDuration
This commit is contained in:
@@ -239,6 +239,7 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
|
||||
ignoreFailedUpdates: true,
|
||||
installMode: CodePush.InstallMode.ON_NEXT_RESTART,
|
||||
mandatoryInstallMode: CodePush.InstallMode.IMMEDIATE,
|
||||
minimumBackgroundDuration: 0,
|
||||
updateDialog: null,
|
||||
...options
|
||||
};
|
||||
@@ -273,7 +274,11 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
|
||||
if (resolvedInstallMode == CodePush.InstallMode.ON_NEXT_RESTART) {
|
||||
log("Update is installed and will be run on the next app restart.");
|
||||
} else {
|
||||
log("Update is installed and will be run when the app next resumes.");
|
||||
if (syncOptions.minimumBackgroundDuration > 0) {
|
||||
log(`Update is installed and will be run after the app has been in the background for at least ${syncOptions.minimumBackgroundDuration} seconds.`);
|
||||
} else {
|
||||
log("Update is installed and will be run when the app next resumes.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CodePush.SyncStatus.UNKNOWN_ERROR:
|
||||
@@ -302,7 +307,7 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
|
||||
resolvedInstallMode = localPackage.isMandatory ? syncOptions.mandatoryInstallMode : syncOptions.installMode;
|
||||
|
||||
syncStatusChangeCallback(CodePush.SyncStatus.INSTALLING_UPDATE);
|
||||
await localPackage.install(resolvedInstallMode, () => {
|
||||
await localPackage.install(resolvedInstallMode, syncOptions.minimumBackgroundDuration, () => {
|
||||
syncStatusChangeCallback(CodePush.SyncStatus.UPDATE_INSTALLED);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user