fix mandatory install mode logging
This commit is contained in:
Родитель
2d8e93168a
Коммит
f1e07746e2
|
@ -184,8 +184,8 @@ var CodePush = (function () {
|
|||
CodePushUtil.logError("An error occurred during sync.", error);
|
||||
syncCallback && syncCallback(SyncStatus.ERROR);
|
||||
};
|
||||
var onInstallSuccess = function () {
|
||||
switch (syncOptions.installMode) {
|
||||
var onInstallSuccess = function (appliedWhen) {
|
||||
switch (appliedWhen) {
|
||||
case InstallMode.ON_NEXT_RESTART:
|
||||
CodePushUtil.logMessage("Update is installed and will be run on the next app restart.");
|
||||
break;
|
||||
|
|
|
@ -92,12 +92,12 @@ var LocalPackage = (function (_super) {
|
|||
CodePushUtil.logMessage("Install succeeded.");
|
||||
var installModeToUse = _this.isMandatory ? installOptions.mandatoryInstallMode : installOptions.installMode;
|
||||
if (installModeToUse === InstallMode.IMMEDIATE) {
|
||||
installSuccess && installSuccess();
|
||||
installSuccess && installSuccess(installModeToUse);
|
||||
cordova.exec(function () { }, function () { }, "CodePush", "install", [deployDir.fullPath,
|
||||
installModeToUse.toString(), installOptions.minimumBackgroundDuration.toString()]);
|
||||
}
|
||||
else {
|
||||
cordova.exec(function () { installSuccess && installSuccess(); }, function () { installError && installError(); }, "CodePush", "install", [deployDir.fullPath,
|
||||
cordova.exec(function () { installSuccess && installSuccess(installModeToUse); }, function () { installError && installError(); }, "CodePush", "install", [deployDir.fullPath,
|
||||
installModeToUse.toString(), installOptions.minimumBackgroundDuration.toString()]);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -94,7 +94,7 @@ interface ILocalPackage extends IPackage {
|
|||
* @param installError Optional callback inovoked in case of an error.
|
||||
* @param installOptions Optional parameter used for customizing the installation behavior.
|
||||
*/
|
||||
install(installSuccess: SuccessCallback<void>, errorCallback?: ErrorCallback, installOptions?: InstallOptions): void;
|
||||
install(installSuccess: SuccessCallback<InstallMode>, errorCallback?: ErrorCallback, installOptions?: InstallOptions): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -307,7 +307,7 @@ interface InstallOptions {
|
|||
* If installMode === ON_NEXT_RESUME, the minimum amount of time (in seconds) which needs to pass with the app in the background before an update install occurs when the app is resumed.
|
||||
*/
|
||||
minimumBackgroundDuration?: number;
|
||||
|
||||
|
||||
/**
|
||||
* Used to specify the InstallMode used for the install operation if the update is mandatory. This is optional and defaults to InstallMode.IMMEDIATE.
|
||||
*/
|
||||
|
|
|
@ -300,8 +300,8 @@ class CodePush implements CodePushCordovaPlugin {
|
|||
syncCallback && syncCallback(SyncStatus.ERROR);
|
||||
};
|
||||
|
||||
var onInstallSuccess = () => {
|
||||
switch (syncOptions.installMode) {
|
||||
var onInstallSuccess = (appliedWhen: InstallMode) => {
|
||||
switch (appliedWhen) {
|
||||
case InstallMode.ON_NEXT_RESTART:
|
||||
CodePushUtil.logMessage("Update is installed and will be run on the next app restart.");
|
||||
break;
|
||||
|
|
|
@ -49,7 +49,7 @@ class LocalPackage extends Package implements ILocalPackage {
|
|||
* @param installError Optional callback inovoked in case of an error.
|
||||
* @param installOptions Optional parameter used for customizing the installation behavior.
|
||||
*/
|
||||
public install(installSuccess: SuccessCallback<void>, errorCallback?: ErrorCallback, installOptions?: InstallOptions) {
|
||||
public install(installSuccess: SuccessCallback<InstallMode>, errorCallback?: ErrorCallback, installOptions?: InstallOptions) {
|
||||
try {
|
||||
CodePushUtil.logMessage("Installing update");
|
||||
|
||||
|
@ -106,7 +106,7 @@ class LocalPackage extends Package implements ILocalPackage {
|
|||
}
|
||||
}
|
||||
|
||||
private finishInstall(deployDir: DirectoryEntry, installOptions: InstallOptions, installSuccess: SuccessCallback<void>, installError: ErrorCallback): void {
|
||||
private finishInstall(deployDir: DirectoryEntry, installOptions: InstallOptions, installSuccess: SuccessCallback<InstallMode>, installError: ErrorCallback): void {
|
||||
LocalPackage.getCurrentOrDefaultPackage((oldPackage: LocalPackage) => {
|
||||
LocalPackage.backupPackageInformationFile((backupError: Error) => {
|
||||
backupError && CodePushUtil.logMessage("First update: back up package information skipped. ");
|
||||
|
@ -120,12 +120,12 @@ class LocalPackage extends Package implements ILocalPackage {
|
|||
var installModeToUse: InstallMode = this.isMandatory ? installOptions.mandatoryInstallMode : installOptions.installMode;
|
||||
if (installModeToUse === InstallMode.IMMEDIATE) {
|
||||
/* invoke success before navigating */
|
||||
installSuccess && installSuccess();
|
||||
installSuccess && installSuccess(installModeToUse);
|
||||
/* no need for callbacks, the javascript context will reload */
|
||||
cordova.exec(() => { }, () => { }, "CodePush", "install", [deployDir.fullPath,
|
||||
cordova.exec(() => { }, () => { }, "CodePush", "install", [deployDir.fullPath,
|
||||
installModeToUse.toString(), installOptions.minimumBackgroundDuration.toString()]);
|
||||
} else {
|
||||
cordova.exec(() => { installSuccess && installSuccess(); }, () => { installError && installError(); }, "CodePush", "install", [deployDir.fullPath,
|
||||
cordova.exec(() => { installSuccess && installSuccess(installModeToUse); }, () => { installError && installError(); }, "CodePush", "install", [deployDir.fullPath,
|
||||
installModeToUse.toString(), installOptions.minimumBackgroundDuration.toString()]);
|
||||
}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче