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

Fix navigation bars inside of VectorHostingController. #6799

Merged
merged 1 commit into from
Oct 4, 2022
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Fix crash when scrolling chat list ([#6749](https://github.com/vector-im/element-ios/issues/6749))
- App Layout: Unable to send message after filtering for room ([#6755](https://github.com/vector-im/element-ios/issues/6755))
- Fix code block background colour ([#6778](https://github.com/vector-im/element-ios/issues/6778))
- Fix navigation bars visibility on iOS 16. ([#6799](https://github.com/vector-im/element-ios/pull/6799))

🧱 Build

Expand Down
16 changes: 8 additions & 8 deletions Riot/Modules/Common/SwiftUI/VectorHostingController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ class VectorHostingController: UIHostingController<AnyView> {
bottomSheetPreferences?.setup(viewController: self)
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

if isNavigationBarHidden {
self.navigationController?.isNavigationBarHidden = true
}
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

Expand All @@ -93,6 +85,14 @@ class VectorHostingController: UIHostingController<AnyView> {
}
}

override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()

if let navigationController = navigationController, navigationController.isNavigationBarHidden != isNavigationBarHidden {
navigationController.isNavigationBarHidden = isNavigationBarHidden
}
}

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class AnalyticsPromptCoordinator: Coordinator, Presentable {
// MARK: Private

private let parameters: AnalyticsPromptCoordinatorParameters
private let analyticsPromptHostingController: UIViewController
private let analyticsPromptHostingController: VectorHostingController
private var _analyticsPromptViewModel: Any?

fileprivate var analyticsPromptViewModel: AnalyticsPromptViewModel {
Expand Down Expand Up @@ -59,6 +59,7 @@ final class AnalyticsPromptCoordinator: Coordinator, Presentable {
let view = AnalyticsPrompt(viewModel: viewModel.context)
_analyticsPromptViewModel = viewModel
analyticsPromptHostingController = VectorHostingController(rootView: view)
analyticsPromptHostingController.isNavigationBarHidden = true
}

// MARK: - Public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ final class OnboardingCelebrationCoordinator: Coordinator, Presentable {
onboardingCelebrationViewModel = viewModel
onboardingCelebrationHostingController = VectorHostingController(rootView: view)
onboardingCelebrationHostingController.enableNavigationBarScrollEdgeAppearance = true
onboardingCelebrationHostingController.isNavigationBarHidden = true
}

// MARK: - Public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ final class OnboardingCongratulationsCoordinator: Coordinator, Presentable {
onboardingCongratulationsViewModel = viewModel
onboardingCongratulationsHostingController = VectorHostingController(rootView: view)
onboardingCongratulationsHostingController.statusBarStyle = .lightContent
onboardingCongratulationsHostingController.isNavigationBarHidden = true
}

// MARK: - Public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ final class OnboardingSplashScreenCoordinator: OnboardingSplashScreenCoordinator
onboardingSplashScreenViewModel = viewModel
onboardingSplashScreenHostingController = VectorHostingController(rootView: view)
onboardingSplashScreenHostingController.vc_removeBackTitle()
onboardingSplashScreenHostingController.isNavigationBarHidden = true

indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: onboardingSplashScreenHostingController)
}
Expand Down