Krisiacik / ImageViewer

An image viewer à la Twitter
MIT License
2.54k stars 387 forks source link

Add iOS 11/iPhone X support #169

Closed humblehacker closed 6 years ago

humblehacker commented 6 years ago

Closes #164

humblehacker commented 6 years ago

Hmm, hold off on approving this one. Seems safeAreaInsets at the time layout is calculated is coming back empty. I'm investigating.

humblehacker commented 6 years ago

Ok, this now works to my satisfaction. Please let me know what you think.

Note is probably a breaking change for anyone who was manually working around these issues.

zfoltin commented 6 years ago

LGTM 👍

RuiAAPeres commented 6 years ago

@humblehacker do you mind adding a gif or an image of your work?

zfoltin commented 6 years ago

Guess we can reuse the screenshot from https://github.com/MailOnline/ImageViewer/issues/164 - maybe add a line to CHANGELOG.md too?

humblehacker commented 6 years ago

Ok, here's a collection of screenshots with various configurations:

without status bar with status bar
iPhone 6s - 10.1 iPhone 6s - 10.1 - statusBarHidden
iPhone 6s - 10.1 iPhone 6s - 10.1 - statusBarHidden
iPhone 6s - 11.1 iPhone 6s - 11.1 - statusBarHidden
iPhone 6s - 11.1 iPhone 6s - 11.1 - statusBarHidden
iPhone X - 11.1 iPhone X - 11.1 - statusBarHidden
iPhone X - 11.1 iPhone X - 11.1 - statusBarHidden
ugenlik commented 6 years ago

@humblehacker Do I have to do anything extra to activate this? This changes doesn't work for me in iPhone X.

self.presentImageGallery(galleryViewController)

and it is initiated like =

let galleryViewController = GalleryViewController(startIndex: 0, itemsDataSource: self, itemsDelegate: self, displacedViewsDataSource: self, configuration: galleryConfiguration())

            GalleryConfigurationItem.statusBarHidden(false),

            GalleryConfigurationItem.closeButtonMode(.builtIn),

            GalleryConfigurationItem.pagingMode(.standard),
            GalleryConfigurationItem.presentationStyle(.displacement),
            GalleryConfigurationItem.hideDecorationViewsOnLaunch(false),

            GalleryConfigurationItem.swipeToDismissMode(.vertical),
            GalleryConfigurationItem.toggleDecorationViewsBySingleTap(false),

            GalleryConfigurationItem.overlayColor(UIColor(white: 0.035, alpha: 1)),
            GalleryConfigurationItem.overlayColorOpacity(1),
            GalleryConfigurationItem.overlayBlurOpacity(1),
            GalleryConfigurationItem.overlayBlurStyle(UIBlurEffectStyle.light),

            GalleryConfigurationItem.videoControlsColor(.white),

            GalleryConfigurationItem.maximumZoomScale(8),
            GalleryConfigurationItem.swipeToDismissThresholdVelocity(500),

            GalleryConfigurationItem.doubleTapToZoomDuration(0.15),

            GalleryConfigurationItem.blurPresentDuration(0.5),
            GalleryConfigurationItem.blurPresentDelay(0),
            GalleryConfigurationItem.colorPresentDuration(0.25),
            GalleryConfigurationItem.colorPresentDelay(0),

            GalleryConfigurationItem.blurDismissDuration(0.1),
            GalleryConfigurationItem.blurDismissDelay(0.4),
            GalleryConfigurationItem.colorDismissDuration(0.45),
            GalleryConfigurationItem.colorDismissDelay(0),

            GalleryConfigurationItem.itemFadeDuration(0.3),
            GalleryConfigurationItem.decorationViewsFadeDuration(0.15),
            GalleryConfigurationItem.rotationDuration(0.15),

            GalleryConfigurationItem.displacementDuration(0.55),
            GalleryConfigurationItem.reverseDisplacementDuration(0.25),
            GalleryConfigurationItem.displacementTransitionStyle(.springBounce(0.7)),
            GalleryConfigurationItem.displacementTimingCurve(.linear),

            GalleryConfigurationItem.displacementKeepOriginalInPlace(false),
            GalleryConfigurationItem.displacementInsetMargin(50)
        ]

img_1184

ugenlik commented 6 years ago

@humblehacker never mind, had to do pod 'ImageViewer', :git => 'https://github.com/MailOnline/ImageViewer.git', :commit => 'a4de06a08a78c4b0a65a48aa891f755b64ff03a because it is not in the release

humblehacker commented 6 years ago

@ugenlik Glad you got it working. You can also use :branch => 'master' instead of a specific commit. That's what I'm using until a new release is available.