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

[iOS] UI issues on iPhone SE #482

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Core/Core/Extensions/UIApplicationExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
import UIKit
import Theme

extension UIApplication {
public extension UIApplication {

public var keyWindow: UIWindow? {
var keyWindow: UIWindow? {
UIApplication.shared.windows.first { $0.isKeyWindow }
}

public func endEditing(force: Bool = true) {
func endEditing(force: Bool = true) {
windows.forEach { $0.endEditing(force) }
}

public class func topViewController(
class func topViewController(
controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController
) -> UIViewController? {
if let navigationController = controller as? UINavigationController {
Expand All @@ -34,6 +34,15 @@ extension UIApplication {
}
return controller
}

var windowInsets: UIEdgeInsets {
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the extra indentation

return .zero
}

return window.safeAreaInsets
}
}

extension UINavigationController {
Expand Down
8 changes: 7 additions & 1 deletion Core/Core/View/Base/DynamicOffsetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ public struct DynamicOffsetView: View {
private let padHeight: CGFloat = 290
private let collapsedHorizontalHeight: CGFloat = 120
private let collapsedVerticalHeight: CGFloat = 100
private let expandedHeight: CGFloat = 240
private var expandedHeight: CGFloat {
let topInset = UIApplication.shared.windowInsets.top
guard topInset > 0 else {
return 240
}
return 300 - topInset
}
private let coordinateBoundaryLower: CGFloat = -115
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }

Expand Down
10 changes: 9 additions & 1 deletion Course/Course/Presentation/Container/CourseContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ public struct CourseContainerView: View {
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }

private let coordinateBoundaryLower: CGFloat = -115
private let coordinateBoundaryHigher: CGFloat = 40

private var coordinateBoundaryHigher: CGFloat {
let topInset = UIApplication.shared.windowInsets.top
guard topInset > 0 else {
return 40
}

return topInset
}

private struct GeometryName {
static let backButton = "backButton"
Expand Down
Loading