Fix new crash when closing compose VC (#1018)

This commit is contained in:
Jed Fox 2023-04-17 17:21:55 -04:00 committed by GitHub
parent 75bde8258f
commit 391bc455ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -207,8 +207,9 @@ extension ComposeContentViewController {
self.tableView.contentInset.bottom = padding - self.view.safeAreaInsets.bottom
self.tableView.verticalScrollIndicatorInsets.bottom = padding - self.view.safeAreaInsets.bottom
UIView.animate(withDuration: 0.3) {
guard let window = self.view.window else { return }
// ref: https://developer.apple.com/documentation/uikit/uiresponder/1621578-keyboardframeenduserinfokey
let localKeyboardFrame = self.view.convert(endFrame, from: self.view.window!.screen.coordinateSpace)
let localKeyboardFrame = self.view.convert(endFrame, from: window.screen.coordinateSpace)
let intersection = self.view.bounds.intersection(localKeyboardFrame)
if intersection.isEmpty {
self.composeContentToolbarViewBottomLayoutConstraint.constant = 0