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

Commit 14c2530

Browse files
Hunter-Dolanitoys
authored andcommitted
Move the install button on the update dialog to the right of the ignore button (#1232)
1 parent d34e8d0 commit 14c2530

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

CodePush.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -385,21 +385,17 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
385385

386386
return await new Promise((resolve, reject) => {
387387
let message = null;
388-
const dialogButtons = [{
389-
text: null,
390-
onPress:() => {
391-
doDownloadAndInstall()
392-
.then(resolve, reject);
393-
}
394-
}];
388+
let installButtonText = null;
389+
390+
const dialogButtons = [];
395391

396392
if (remotePackage.isMandatory) {
397393
message = syncOptions.updateDialog.mandatoryUpdateMessage;
398-
dialogButtons[0].text = syncOptions.updateDialog.mandatoryContinueButtonLabel;
394+
installButtonText = syncOptions.updateDialog.mandatoryContinueButtonLabel;
399395
} else {
400396
message = syncOptions.updateDialog.optionalUpdateMessage;
401-
dialogButtons[0].text = syncOptions.updateDialog.optionalInstallButtonLabel;
402-
// Since this is an optional update, add another button
397+
installButtonText = syncOptions.updateDialog.optionalInstallButtonLabel;
398+
// Since this is an optional update, add a button
403399
// to allow the end-user to ignore it
404400
dialogButtons.push({
405401
text: syncOptions.updateDialog.optionalIgnoreButtonLabel,
@@ -409,6 +405,16 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
409405
}
410406
});
411407
}
408+
409+
// Since the install button should be placed to the
410+
// right of any other button, add it last
411+
dialogButtons.push({
412+
text: installButtonText,
413+
onPress:() => {
414+
doDownloadAndInstall()
415+
.then(resolve, reject);
416+
}
417+
})
412418

413419
// If the update has a description, and the developer
414420
// explicitly chose to display it, then set that as the message

0 commit comments

Comments
 (0)