From 14c2530a5f41d3831cd99a777a935ad773f72ea7 Mon Sep 17 00:00:00 2001 From: Hunter Dolan Date: Fri, 30 Mar 2018 09:25:11 -0500 Subject: [PATCH] Move the install button on the update dialog to the right of the ignore button (#1232) --- CodePush.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/CodePush.js b/CodePush.js index 235abc1..81f0a3f 100644 --- a/CodePush.js +++ b/CodePush.js @@ -385,21 +385,17 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg return await new Promise((resolve, reject) => { let message = null; - const dialogButtons = [{ - text: null, - onPress:() => { - doDownloadAndInstall() - .then(resolve, reject); - } - }]; + let installButtonText = null; + + const dialogButtons = []; if (remotePackage.isMandatory) { message = syncOptions.updateDialog.mandatoryUpdateMessage; - dialogButtons[0].text = syncOptions.updateDialog.mandatoryContinueButtonLabel; + installButtonText = syncOptions.updateDialog.mandatoryContinueButtonLabel; } else { message = syncOptions.updateDialog.optionalUpdateMessage; - dialogButtons[0].text = syncOptions.updateDialog.optionalInstallButtonLabel; - // Since this is an optional update, add another button + installButtonText = syncOptions.updateDialog.optionalInstallButtonLabel; + // Since this is an optional update, add a button // to allow the end-user to ignore it dialogButtons.push({ text: syncOptions.updateDialog.optionalIgnoreButtonLabel, @@ -409,6 +405,16 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg } }); } + + // Since the install button should be placed to the + // right of any other button, add it last + dialogButtons.push({ + text: installButtonText, + onPress:() => { + doDownloadAndInstall() + .then(resolve, reject); + } + }) // If the update has a description, and the developer // explicitly chose to display it, then set that as the message