diff --git a/Sources/ChatFeature/Controllers/SingleChatController.swift b/Sources/ChatFeature/Controllers/SingleChatController.swift index 91aa66ec122b86593e3c0e9eab9c3eaf72793a31..b8d8b7703b180178f4c39ab6f04a73c0e7e7b4d6 100644 --- a/Sources/ChatFeature/Controllers/SingleChatController.swift +++ b/Sources/ChatFeature/Controllers/SingleChatController.swift @@ -530,12 +530,10 @@ extension SingleChatController: KeyboardListenerDelegate { } func keyboardWillChangeFrame(info: KeyboardInfo) { - let keyWindow: UIWindow? = UIApplication.shared.connectedScenes - .filter { $0.activationState == .foregroundActive } - .compactMap { $0 as? UIWindowScene } - .first? - .windows - .first(where: \.isKeyWindow) + let keyWindow = UIApplication.shared + .connectedScenes + .flatMap { ($0 as? UIWindowScene)?.windows ?? [] } + .first { $0.isKeyWindow } guard let keyWindow = keyWindow else { fatalError("[keyboardWillChangeFrame]: Couldn't get key window")