From d2a70127169ec880c51b7d0fcdb4aa7f00a4845e Mon Sep 17 00:00:00 2001 From: jahorton Date: Wed, 3 Mar 2021 13:21:49 +0700 Subject: [PATCH] fix(ios): handling of cases with no welcome.htm --- .../PackageInstallViewController.swift | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Resource Management/PackageInstallViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Resource Management/PackageInstallViewController.swift index ac2d20d316..748edfacab 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Resource Management/PackageInstallViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Resource Management/PackageInstallViewController.swift @@ -60,6 +60,7 @@ public class PackageInstallViewController: UIViewCon private var dismissalBlock: (() -> Void)? = nil private weak var welcomeView: UIView? + private var mayPick: Bool = true public init(for package: Resource.Package, defaultLanguageCode: String? = nil, @@ -268,9 +269,11 @@ public class PackageInstallViewController: UIViewCon } set(mode) { - leftNavMode = mode + if mayPick { + leftNavMode = mode - navigationItem.leftBarButtonItem = navMapping[mode] + navigationItem.leftBarButtonItem = navMapping[mode] + } } } @@ -280,9 +283,11 @@ public class PackageInstallViewController: UIViewCon } set(mode) { - rightNavMode = mode + if mayPick { + rightNavMode = mode - navigationItem.rightBarButtonItem = navMapping[mode] + navigationItem.rightBarButtonItem = navMapping[mode] + } } } @@ -358,8 +363,10 @@ public class PackageInstallViewController: UIViewCon // No more selection-manipulation allowed. // This matters when there's no welcome page available. languageTable.isUserInteractionEnabled = false - // Prevent extra 'install' commands. + // Prevent extra 'install' commands and nav-bar related manipulation. + self.navigationItem.leftBarButtonItem?.isEnabled = false self.rightNavigationMode = .none + self.mayPick = false let dismissalBlock = { self.associators.forEach { $0.pickerFinalized() } @@ -399,7 +406,8 @@ public class PackageInstallViewController: UIViewCon dismissalBlock() } } else { - dismissalBlock() + self.dismissalBlock = dismissalBlock + onWelcomeDismissed() } }