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

Add partial support for iPhone X #57

Merged
merged 3 commits into from
Nov 11, 2017
Merged

Add partial support for iPhone X #57

merged 3 commits into from
Nov 11, 2017

Conversation

u2606
Copy link
Contributor

@u2606 u2606 commented Oct 31, 2017

Partial support for #48.

Photo library picker:

Old:

(Automatically scrolls too far, and shows photos between navigation bar and top of screen)

screen shot 2017-10-31 at 01 27 54

New:

screen shot 2017-10-31 at 01 28 31
screen shot 2017-10-31 at 01 28 57

Camera

Old:

(Buttons and “Photo 1” text too high)

screen shot 2017-10-31 at 01 28 02

New:

screen shot 2017-10-31 at 01 29 17

Same photo on iPhone 6s, for comparison:

screen shot 2017-10-31 at 01 27 33

Already supporting iPhone X:

Circle cropper:

screen shot 2017-10-31 at 01 43 10

Still not supporting iPhone X:

Photo library in landscape:

(Photos too close to left and right edges)

screen shot 2017-10-31 at 01 30 19

Camera in landscape:

(Buttons to close to “top” [physical top of phone, not virtual top of screen])

screen shot 2017-10-31 at 01 30 13

Edit tool:

screen shot 2017-10-31 at 01 44 14

Copy link
Member

@HiveHicks HiveHicks left a comment

Choose a reason for hiding this comment

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

Could you please fix issues that I pointed out or allow editing of this pull request so that I could do it myself? (See https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork)

@@ -43,6 +43,9 @@
25A489CC1E656B2D00CC431B /* Latoto-SemiboldItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 251E57EC1E6565890009A288 /* Latoto-SemiboldItalic.ttf */; };
2A0B5C0CB29FF72D8233F563 /* Pods_PaparazzoExample_Storyboard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0197BFD7D8A9DC3C06FA3EB3 /* Pods_PaparazzoExample_Storyboard.framework */; };
38D34B668F9788158C7228EA /* Pods_PaparazzoExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11AE831F8581BCFBA632B260 /* Pods_PaparazzoExample.framework */; };
BB0265081FA86FB4002A5561 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB0265061FA86FB4002A5561 /* LaunchScreen.storyboard */; };
BB0265091FA86FB4002A5561 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB0265061FA86FB4002A5561 /* LaunchScreen.storyboard */; };
BB02650A1FA86FB4002A5561 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB0265061FA86FB4002A5561 /* LaunchScreen.storyboard */; };
Copy link
Member

Choose a reason for hiding this comment

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

Adding LaunchScreen is unnecessary for the purpose of this pull request. Please remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per Apple’s guide to Update Apps for iPhone X, apps need either a LaunchScreen.storyboard or an iPhone X launch image (1125px × 2436px). Since Paparazzo already included the LaunchScreen.storyboard for the storyboard-based example project, I moved the storyboard to the shared directory (Example/PaparazzoExample_Storyboard/Base.lproj/LaunchScreen.storyboardExample/Shared/Base.lproj/LaunchScreen.storyboard) and included it in the other two targets. This diff hunk shows the file being included in all three targets, not a duplication of the file.

If you prefer not to include even a LaunchScreen.storyboard in the non-storyboard-based targets, please provide a 1125px × 2436px launch screen image.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I didn't know that, thanks for the explanation!


let minimumYOffset: CGFloat
if #available(iOS 11.0, *) {
minimumYOffset = -safeAreaInsets.top
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to use -max(contentInset.top, safeAreaInsets.top) here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed.

topMargin = safeAreaInsets.top
} else {
topMargin = 0
}
Copy link
Member

@HiveHicks HiveHicks Nov 7, 2017

Choose a reason for hiding this comment

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

To avoid constant checking for the availability of safeAreaInsets I would add a UIView extension like that:

extension UIView {
    var paparazzoSafeAreaInsets: UIEdgeInsets {
        if #available(iOS 11.0, *) {
            return safeAreaInsets
        } else {
            return .zero
        }
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed.

@@ -21,8 +21,6 @@ final class PhotoLibraryViewController: PaparazzoViewController, PhotoLibraryVie
super.viewWillAppear(animated)

navigationController?.setNavigationBarHidden(false, animated: animated)
hideNavigationBarShadow()
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One of the navigation bar changes in hideNavigationBarShadow causes the table view’s contents to appear in the iPhone X status bar. (See the first image from this PR, reproduced below.) I’m not sure whether it’s setting the background image, the background color, or the shadow image. If you prefer to still set some of those, while removing the offending ones, some experimentation could determine which are causing the visual error below.

screen shot 2017-10-31 at 01 27 54

@u2606
Copy link
Contributor Author

u2606 commented Nov 7, 2017

I can make the requested changes, but won’t be able to get back to this for a few days. If you’d like the changes sooner, this PR is actually already allows edits from maintainers of this project:

allowed-edits-from-maintainers

@HiveHicks HiveHicks changed the base branch from master to develop November 11, 2017 12:12
# Conflicts:
#	Example/PaparazzoExample.xcodeproj/project.pbxproj
@HiveHicks HiveHicks merged commit 3b82d82 into avito-tech:develop Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants