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

Commit 0c5cb64

Browse files
committed
Adding new option and fixing some naming
1 parent 9b68b54 commit 0c5cb64

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

CodePush.ios.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,17 @@ function sync(options = {}) {
110110
ignoreFailedUpdates: true,
111111

112112
mandatoryContinueButtonLabel: "Continue",
113-
mandatoryUpdateMessage: "An update is available that must be installed",
113+
mandatoryUpdateMessage: "An update is available that must be installed.",
114114

115115
optionalIgnoreButtonLabel: "Ignore",
116116
optionalInstallButtonLabel: "Install",
117117
optionalUpdateMessage: "An update is available. Would you like to install it?",
118118

119-
updateTitle: "Update available",
120119
rollbackTimeout: 0,
121120

121+
updateTitle: "Update available",
122+
useReleaseDescription: false,
123+
122124
...options
123125
};
124126

@@ -136,7 +138,7 @@ function sync(options = {}) {
136138
onPress: () => {
137139
remotePackage.download()
138140
.then((localPackage) => {
139-
resolve(CodePush.SyncStatus.APPLY_SUCCESS);
141+
resolve(CodePush.SyncStatus.UPDATE_DOWNLOADED);
140142
localPackage.apply(syncOptions.rollbackTimeout);
141143
}, reject);
142144
}
@@ -158,7 +160,13 @@ function sync(options = {}) {
158160
});
159161
}
160162

161-
AlertIOS.alert(syncOptions.updateTitle, message || remotePackage.description, dialogButtons);
163+
// If the update has a description, and the developer
164+
// explicitly chose to display it, then set that as the message
165+
if (syncOptions.useReleaseDescription && remotePackage.description) {
166+
message = remotePackage.description;
167+
}
168+
169+
AlertIOS.alert(syncOptions.updateTitle, message, dialogButtons);
162170
}
163171
}, reject);
164172
});
@@ -174,7 +182,7 @@ var CodePush = {
174182
SyncStatus: {
175183
NO_UPDATE_AVAILABLE: 0, // The running app is up-to-date
176184
UPDATE_IGNORED: 1, // The app had an optional update and the end-user chose to ignore it
177-
APPLY_SUCCESS: 2 // The app had an optional/mandatory update that was successfully downloaded and is about to be applied
185+
UPDATE_DOWNLOADED: 2 // The app had an optional/mandatory update that was successfully downloaded and is about to be applied
178186
}
179187
};
180188

0 commit comments

Comments
 (0)