From e9066b3d52cff0be51eb68cb570797f2ca098a24 Mon Sep 17 00:00:00 2001 From: Joshua Horton Date: Wed, 5 Feb 2025 14:00:41 +0700 Subject: [PATCH] change(ios): relocates the "enter foreground" kbd-reload trigger Addresses part of #12216 --- .../Classes/Keyboard/InputViewController.swift | 2 +- .../Classes/Keyboard/KeymanWebViewController.swift | 8 -------- .../Classes/MainViewController/MainViewController.swift | 8 ++++++++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/InputViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/InputViewController.swift index 16acd10f9e..98f6290276 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/InputViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/InputViewController.swift @@ -589,7 +589,7 @@ open class InputViewController: UIInputViewController, KeymanWebDelegate { } // KeymanWebViewController maintenance methods - func reload() { + public func reload() { keymanWeb.reloadKeyboard() } diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/KeymanWebViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/KeymanWebViewController.swift index a0c8c6d5e4..72822bbbfc 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/KeymanWebViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/KeymanWebViewController.swift @@ -72,14 +72,6 @@ class KeymanWebViewController: UIViewController { super.init(nibName: nil, bundle: nil) _ = view - - NotificationCenter.default.addObserver( - forName: UIApplication.willEnterForegroundNotification, - object: nil, - queue: OperationQueue.main - ) { _ in - self.reloadKeyboard() - } } required init?(coder aDecoder: NSCoder) { diff --git a/ios/keyman/Keyman/Keyman/Classes/MainViewController/MainViewController.swift b/ios/keyman/Keyman/Keyman/Classes/MainViewController/MainViewController.swift index 35ee78c5db..de6f00da63 100644 --- a/ios/keyman/Keyman/Keyman/Classes/MainViewController/MainViewController.swift +++ b/ios/keyman/Keyman/Keyman/Classes/MainViewController/MainViewController.swift @@ -112,6 +112,14 @@ class MainViewController: UIViewController, TextViewDelegate, UIActionSheetDeleg forName: Notifications.keyboardRemoved, observer: self, function: MainViewController.keyboardRemoved) + + NotificationCenter.default.addObserver( + forName: UIApplication.willEnterForegroundNotification, + object: nil, + queue: OperationQueue.main + ) { _ in + Manager.shared.inputViewController.reload() + } // Unfortunately, it's the main app with the file definitions. // We have to gerry-rig this so that the framework-based SettingsViewController