Skip to content

Commit

Permalink
Remove decorate function
Browse files Browse the repository at this point in the history
  • Loading branch information
dus7 committed Apr 17, 2024
1 parent 73de18b commit d1364e7
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions DuckDuckGo/SettingsHostingController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import Subscription
class SettingsHostingController: UIHostingController<AnyView> {
var viewModel: SettingsViewModel
var viewProvider: SettingsLegacyViewProvider

init(viewModel: SettingsViewModel, viewProvider: SettingsLegacyViewProvider) {
self.viewModel = viewModel
self.viewProvider = viewProvider
Expand All @@ -36,15 +36,15 @@ class SettingsHostingController: UIHostingController<AnyView> {
viewModel.onRequestPushLegacyView = { [weak self] vc in
self?.pushLegacyViewController(vc)
}

viewModel.onRequestPresentLegacyView = { [weak self] vc, modal in
self?.presentLegacyViewController(vc, modal: modal)
}

viewModel.onRequestPopLegacyView = { [weak self] in
self?.navigationController?.popViewController(animated: true)
}

viewModel.onRequestDismissSettings = { [weak self] in
self?.navigationController?.dismiss(animated: true)
}
Expand All @@ -56,15 +56,15 @@ class SettingsHostingController: UIHostingController<AnyView> {
}
self.rootView = AnyView(settingsView)

decorate()
decorateNavigationBar()
}

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

// If this is not called, settings navigation bar (UIKIt) is going wild with colors after reopening settings (?!)
// Root cause will be investigated later as part of https://app.asana.com/0/414235014887631/1207098219526666/f
decorate()
decorateNavigationBar()
}

required init?(coder aDecoder: NSCoder) {
Expand All @@ -74,19 +74,11 @@ class SettingsHostingController: UIHostingController<AnyView> {
func pushLegacyViewController(_ vc: UIViewController) {
navigationController?.pushViewController(vc, animated: true)
}

func presentLegacyViewController(_ vc: UIViewController, modal: Bool = false) {
if modal {
vc.modalPresentationStyle = .fullScreen
}
navigationController?.present(vc, animated: true)
}
}

extension SettingsHostingController {

private func decorate() {
decorateNavigationBar()
}

}

0 comments on commit d1364e7

Please sign in to comment.