mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Fix orientation
This commit is contained in:
parent
e644cb277b
commit
37d09eb505
2 changed files with 29 additions and 8 deletions
|
@ -56,6 +56,7 @@ class DialpadViewController: UIViewController {
|
||||||
|
|
||||||
private enum Constants {
|
private enum Constants {
|
||||||
static let sizeOniPad: CGSize = CGSize(width: 375, height: 667)
|
static let sizeOniPad: CGSize = CGSize(width: 375, height: 667)
|
||||||
|
static let additionalTopInset: CGFloat = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
private var wasCursorAtTheEnd: Bool = true
|
private var wasCursorAtTheEnd: Bool = true
|
||||||
|
@ -202,6 +203,14 @@ class DialpadViewController: UIViewController {
|
||||||
private func registerThemeServiceDidChangeThemeNotification() {
|
private func registerThemeServiceDidChangeThemeNotification() {
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeServiceDidChangeTheme, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeServiceDidChangeTheme, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func topSafeAreaInset() -> CGFloat {
|
||||||
|
guard let window = UIApplication.shared.keyWindow else {
|
||||||
|
return Constants.additionalTopInset
|
||||||
|
}
|
||||||
|
|
||||||
|
return window.safeAreaInsets.top + Constants.additionalTopInset
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Actions
|
// MARK: - Actions
|
||||||
|
|
||||||
|
@ -292,7 +301,21 @@ class DialpadViewController: UIViewController {
|
||||||
extension DialpadViewController: CustomSizedPresentable {
|
extension DialpadViewController: CustomSizedPresentable {
|
||||||
|
|
||||||
func customSize(withParentContainerSize containerSize: CGSize) -> CGSize {
|
func customSize(withParentContainerSize containerSize: CGSize) -> CGSize {
|
||||||
|
if UIDevice.current.isPhone {
|
||||||
|
return CGSize(width: containerSize.width, height: containerSize.height - topSafeAreaInset())
|
||||||
|
}
|
||||||
return Constants.sizeOniPad
|
return Constants.sizeOniPad
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func position(withParentContainerSize containerSize: CGSize) -> CGPoint {
|
||||||
|
let mySize = customSize(withParentContainerSize: containerSize)
|
||||||
|
|
||||||
|
if UIDevice.current.isPhone {
|
||||||
|
return CGPoint(x: 0, y: topSafeAreaInset())
|
||||||
|
}
|
||||||
|
|
||||||
|
return CGPoint(x: (containerSize.width - mySize.width)/2,
|
||||||
|
y: (containerSize.height - mySize.height)/2)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,13 +489,11 @@
|
||||||
{
|
{
|
||||||
DialpadViewController *controller = [DialpadViewController instantiate];
|
DialpadViewController *controller = [DialpadViewController instantiate];
|
||||||
controller.delegate = self;
|
controller.delegate = self;
|
||||||
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
|
self.customSizedPresentationController = [[CustomSizedPresentationController alloc] initWithPresentedViewController:controller presentingViewController:self];
|
||||||
{
|
self.customSizedPresentationController.dismissOnBackgroundTap = NO;
|
||||||
self.customSizedPresentationController = [[CustomSizedPresentationController alloc] initWithPresentedViewController:controller presentingViewController:self];
|
self.customSizedPresentationController.cornerRadius = 16;
|
||||||
self.customSizedPresentationController.dismissOnBackgroundTap = NO;
|
|
||||||
|
controller.transitioningDelegate = self.customSizedPresentationController;
|
||||||
controller.transitioningDelegate = self.customSizedPresentationController;
|
|
||||||
}
|
|
||||||
[self presentViewController:controller animated:YES completion:nil];
|
[self presentViewController:controller animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +501,7 @@
|
||||||
|
|
||||||
- (void)dialpadViewControllerDidTapCall:(DialpadViewController *)viewController withPhoneNumber:(NSString *)phoneNumber
|
- (void)dialpadViewControllerDidTapCall:(DialpadViewController *)viewController withPhoneNumber:(NSString *)phoneNumber
|
||||||
{
|
{
|
||||||
if (self.mainSession.callManager && phoneNumber)
|
if (self.mainSession.callManager && phoneNumber.length > 0)
|
||||||
{
|
{
|
||||||
[self startActivityIndicator];
|
[self startActivityIndicator];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue