Skip to content

Commit

Permalink
fix: logic difference with Android
Browse files Browse the repository at this point in the history
There is a slight difference in the operation comparing to Gandalf: the alert has more priority over the optionalUpdate in Gandalf and in the LaunchGate it is just the opposite.

Fixes dtrenz#35 Android-iOS logic difference
  • Loading branch information
RLRG committed Sep 27, 2017
1 parent a592e20 commit 2354553
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Source/LaunchGate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,19 @@ open class LaunchGate {
- dialogManager: Manager object for the various alert dialogs
*/
func displayDialogIfNecessary(_ config: LaunchGateConfiguration, dialogManager: DialogManager) {
if let reqUpdate = config.requiredUpdate, let appVersion = currentAppVersion() {
if shouldShowRequiredUpdateDialog(reqUpdate, appVersion: appVersion) {
dialogManager.displayRequiredUpdateDialog(reqUpdate, updateURL: updateURL)
}
} else if let optUpdate = config.optionalUpdate, let appVersion = currentAppVersion() {
if shouldShowOptionalUpdateDialog(optUpdate, appVersion: appVersion) {
dialogManager.displayOptionalUpdateDialog(optUpdate, updateURL: updateURL)
}
} else if let alert = config.alert {
if shouldShowAlertDialog(alert) {
dialogManager.displayAlertDialog(alert, blocking: alert.blocking)
}
if let reqUpdate = config.requiredUpdate,
let appVersion = currentAppVersion(),
shouldShowRequiredUpdateDialog(reqUpdate, appVersion: appVersion) {
dialogManager.displayRequiredUpdateDialog(reqUpdate, updateURL: updateURL)
} else if let alert = config.alert,
shouldShowAlertDialog(alert) {
dialogManager.displayAlertDialog(alert, blocking: alert.blocking)
} else if let optUpdate = config.optionalUpdate,
let appVersion = currentAppVersion(),
shouldShowOptionalUpdateDialog(optUpdate, appVersion: appVersion) {
dialogManager.displayOptionalUpdateDialog(optUpdate, updateURL: updateURL)
} else {
print("LaunchGate - No action is required")
}
}

Expand Down

0 comments on commit 2354553

Please sign in to comment.