Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider Safe Area Insets for Some Screens #3084

Merged
merged 37 commits into from
Apr 23, 2020
Merged

Consider Safe Area Insets for Some Screens #3084

merged 37 commits into from
Apr 23, 2020

Conversation

ismailgulek
Copy link
Contributor

No description provided.

@ismailgulek ismailgulek changed the title Riot 3067 Consider Safe Area Insets for Some Screens Apr 9, 2020
@ismailgulek ismailgulek linked an issue Apr 9, 2020 that may be closed by this pull request
@ismailgulek ismailgulek self-assigned this Apr 9, 2020
@ismailgulek ismailgulek linked an issue Apr 9, 2020 that may be closed by this pull request
import Foundation
import UIKit

@objc extension UIDevice {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can manage safe area without this code atm. It could be dangerous to use magic numbers as those values could change for an iOS version or an iOS device.

Comment on lines +4246 to +4250
if (UIDevice.currentDevice.hasNotch)
{
// this device has a notch (iPhone X +)
result += UIApplication.sharedApplication.keyWindow.safeAreaInsets.top;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using hasNotch we could use this:

        static CGFloat kCallStatusBarSafeAreaExtraHeight = 24;        
        result = MAX(UIApplication.sharedApplication.keyWindow.safeAreaInsets.top + kCallStatusBarSafeAreaExtraHeight, CALL_STATUS_BAR_HEIGHT);

Comment on lines 4269 to 4275
if (@available(iOS 11.0, *))
{
UIEdgeInsets safeAreaInsets = UIApplication.sharedApplication.keyWindow.safeAreaInsets;
safeAreaInsets.top = topBarSize.height - CALL_STATUS_BAR_HEIGHT;
safeAreaInsets.bottom = 0.0;
_callStatusBarButton.titleEdgeInsets = safeAreaInsets;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move this behavior to statusBarDidChangeFrame method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

break;
}
default:
{
_callStatusBarWindow.transform = CGAffineTransformIdentity;
_callStatusBarWindow.frame = CGRectMake(0, 0, rootControllerFrame.size.width, CALL_STATUS_BAR_HEIGHT);
_callStatusBarWindow.frame = CGRectMake(0, 0, rootControllerFrame.size.width, callStatusBarHeight);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above if (_callStatusBarWindow) we can add:
UIEdgeInsets callBarButtonContentEdgeInsets = UIEdgeInsetsZero;
and here we can add:

                if (@available(iOS 11.0, *))
                {
                    callBarButtonContentEdgeInsets.top = callStatusBarHeight - CALL_STATUS_BAR_HEIGHT;
                }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with some changes.

@ismailgulek ismailgulek force-pushed the riot_3067 branch 2 times, most recently from 8f5e1cb to 8533fd5 Compare April 10, 2020 21:07
@ismailgulek ismailgulek linked an issue Apr 10, 2020 that may be closed by this pull request
ismailgulek added a commit that referenced this pull request Apr 13, 2020
…for #3084

Signed-off-by: ismailgulek <gulekismail@gmail.com>
@SBiOSoftWhare
Copy link
Contributor

General comments for devices with a notch:

  • We should make scroll views goes under home indicator when there is no bottom bar.
  • We should not constrain the whole view to left/right safe area but only inner components (like table view section title for ex.)

Here some regressions for left/right safe area in landascape:

Simulator Screen Shot - iPhone X - 2020-04-17 at 16 34 07

Simulator Screen Shot - iPhone X - 2020-04-17 at 16 36 12

Simulator Screen Shot - iPhone X - 2020-04-17 at 16 38 54

Simulator Screen Shot - iPhone X - 2020-04-17 at 16 40 05

Here some regressions about home indicator underlap:

Simulator Screen Shot - iPhone X - 2020-04-17 at 16 37 36

Simulator Screen Shot - iPhone X - 2020-04-17 at 16 38 01

Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
…for #3084

Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
…a view with translucent bar

Signed-off-by: ismailgulek <gulekismail@gmail.com>
…cognizer, do not destroy child pages until navigation completed

Signed-off-by: ismailgulek <gulekismail@gmail.com>
…translucent

Signed-off-by: ismailgulek <gulekismail@gmail.com>
…home indicator

Signed-off-by: ismailgulek <gulekismail@gmail.com>
…dicator

Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
… bug fix

Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
…home indicator

Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
Signed-off-by: ismailgulek <gulekismail@gmail.com>
@ismailgulek ismailgulek linked an issue Apr 22, 2020 that may be closed by this pull request
@ismailgulek ismailgulek merged commit 911eb38 into develop Apr 23, 2020
@ismailgulek ismailgulek deleted the riot_3067 branch April 23, 2020 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants