Skip to content

Commit 3cd7912

Browse files
committed
Merge branch 'fix/CLIENT-6233-composer-ipad-ios18' into 'develop'
CLIENT-6233 Fix composer on iPads running iOS 18 See merge request ProtonMail/protonmail-ios!4414
2 parents 67efa88 + 3617bb0 commit 3cd7912

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

ProtonMail/ProtonMail/Resource/APP_share/content_light.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ table a, table p {
5353
word-break: break-word;
5454
}
5555

56+
@supports (height: fit-content) {
57+
html {
58+
height: fit-content;
59+
}
60+
}
61+
5662
blockquote {
5763
padding: 0 0 0 0.6rem !important;
5864
margin: 0 !important;

ProtonMail/ProtonMail/Supporting Files/Settings.bundle/Acknowledgements.latest_result.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ name: lottie-ios, nameSpecified: Lottie, owner: airbnb, version: 4.3.3, source:
106106

107107
name: OHHTTPStubs, nameSpecified: OHHTTPStubs, owner: AliSoftware, version: 9.1.0, source: https://github.com/AliSoftware/OHHTTPStubs
108108

109-
name: protoncore_ios, nameSpecified: ProtonCore, owner: ProtonMail, version: 31.1.5, source: https://github.com/ProtonMail/protoncore_ios
109+
name: protoncore_ios, nameSpecified: ProtonCore, owner: ProtonMail, version: 31.1.6, source: https://github.com/ProtonMail/protoncore_ios
110110

111111
name: Reachability.swift, nameSpecified: Reachability, owner: ashleymills, version: 5.2.4, source: https://github.com/ashleymills/Reachability.swift
112112

ProtonMail/ProtonMail/ViewControllers/APP_share/Compose/ComposerContainer/ComposeContainerViewController.swift

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -954,11 +954,35 @@ extension ComposeContainerViewController: NSNotificationCenterKeyboardObserverPr
954954

955955
func keyboardWillShowNotification(_ notification: Notification) {
956956
if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue {
957-
self.bottomPadding?.constant = keyboardFrame.cgRectValue.height + Constant.toolBarHeight
958-
self.toolbarBottom?.constant = -1 * keyboardFrame.cgRectValue.height
959-
UIView.animate(withDuration: 0.25) {
960-
self.view.layoutIfNeeded()
957+
if UIDevice.current.isIpad {
958+
keyboardWillShowOnIpad(keyboardFrame: keyboardFrame.cgRectValue)
959+
} else {
960+
adjustViewForKeyboard(extraBottomPadding: keyboardFrame.cgRectValue.height)
961+
}
962+
}
963+
}
964+
965+
private func keyboardWillShowOnIpad(keyboardFrame: CGRect) {
966+
// this delay is needed, because the appearance of the keyboard might cause the view to move up a little
967+
// we need to wait with `convert` until that happens
968+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
969+
let keyboardFrameInView = self.view.convert(keyboardFrame, from: nil)
970+
let extraBottomPadding = self.view.bounds.height - max(0, keyboardFrameInView.origin.y)
971+
972+
guard extraBottomPadding >= 0 else {
973+
return
961974
}
975+
976+
self.adjustViewForKeyboard(extraBottomPadding: extraBottomPadding)
977+
}
978+
}
979+
980+
private func adjustViewForKeyboard(extraBottomPadding: CGFloat) {
981+
bottomPadding?.constant = extraBottomPadding + Constant.toolBarHeight
982+
toolbarBottom?.constant = -extraBottomPadding
983+
984+
UIView.animate(withDuration: 0.25) {
985+
self.view.layoutIfNeeded()
962986
}
963987
}
964988
}

ProtonMail/ProtonMail/ViewControllers/APP_share/Compose/ComposerViewFactory.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ final class ComposerViewFactory {
104104
controller.delegate = composerDelegate
105105
let navigationVC = UINavigationController(rootViewController: controller)
106106
router.setupNavigation(navigationVC)
107+
navigationVC.modalPresentationStyle = .pageSheet
107108
return navigationVC
108109
}
109110

0 commit comments

Comments
 (0)