mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-11 16:20:26 +08:00
Move the install button on the update dialog to the right of the ignore button (#1232)
This commit is contained in:
committed by
Artem Egorov
parent
d34e8d0dfb
commit
14c2530a5f
26
CodePush.js
26
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
|
||||
|
||||
Reference in New Issue
Block a user