From 5d06317ab624cd45f2d30472b3a3bea0a5e22666 Mon Sep 17 00:00:00 2001 From: Orkhan Alikhanov Date: Wed, 1 Aug 2018 00:44:38 +0400 Subject: [PATCH 1/2] Fixed podspec swift version --- Motion.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Motion.podspec b/Motion.podspec index 56f403b..f1a522c 100755 --- a/Motion.podspec +++ b/Motion.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'Motion' s.version = '1.5.0' - s.swift_version = '4.0' + s.swift_version = '4.2' s.license = 'MIT' s.summary = 'A library used to create beautiful animations and transitions for Apple devices.' s.homepage = 'http://cosmicmind.com' From 3c48ac4dacae6b5d86bfc027205c94f24b0f60cc Mon Sep 17 00:00:00 2001 From: Orkhan Alikhanov Date: Wed, 1 Aug 2018 01:24:38 +0400 Subject: [PATCH 2/2] Fixed issue-44, view is hidden below status bar during call --- .../MotionTransition+Complete.swift | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Sources/Transition/MotionTransition+Complete.swift b/Sources/Transition/MotionTransition+Complete.swift index 0d6a8c7..58999de 100644 --- a/Sources/Transition/MotionTransition+Complete.swift +++ b/Sources/Transition/MotionTransition+Complete.swift @@ -143,5 +143,33 @@ extension MotionTransition { } tContext?.completeTransition(isFinishing) + + let isModalDismissal = isModalTransition && !isPresenting + if isModalDismissal { + UIApplication.shared.fixRootViewY() + } + } +} + + +private extension UIApplication { + /** + When in-call, hotspot, or recording status bar is enabled, just after (custom) modal + dismissal transition animation ends `UITransitionView` is removed from the hierarchy + and that removal was moving `rootViewController.view` 20 points upwards. This function + should be called after transitioningContext.completeTransition(_:) upon modal dismissal + transition. It applies the work that `UITransitionView` should ideally have done after + custom modal dismissal. `UIKit` modal dismissals do not suffer from this. + + Fixes issue-44. See issue-44 for more info. + */ + func fixRootViewY() { + guard statusBarFrame.height == 40, let window = keyWindow, let vc = window.rootViewController else { + return + } + + if vc.view.frame.maxY + 20 == window.frame.height { + vc.view.frame.origin.y += 20 + } } }