From 2354553ac34815b0e1a5b784a6ee04bdc503aaf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Lo=CC=81pez-Romero=20Guijarro?= Date: Wed, 27 Sep 2017 16:30:40 +0200 Subject: [PATCH] fix: logic difference with Android 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 #35 Android-iOS logic difference --- Source/LaunchGate.swift | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Source/LaunchGate.swift b/Source/LaunchGate.swift index 2ec0215..75fcd15 100755 --- a/Source/LaunchGate.swift +++ b/Source/LaunchGate.swift @@ -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") } }