2019-11-17 19:31:07 +00:00
|
|
|
//
|
|
|
|
// PreferencesHostingController.swift
|
|
|
|
// Tusker
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 11/17/19.
|
|
|
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
class PreferencesNavigationController: UINavigationController {
|
|
|
|
|
2020-01-08 02:29:15 +00:00
|
|
|
init(mastodonController: MastodonController) {
|
|
|
|
let view = PreferencesView(currentAccount: mastodonController.accountInfo!)
|
|
|
|
let hostingController = UIHostingController(rootView: view)
|
2019-11-17 19:31:07 +00:00
|
|
|
super.init(rootViewController: hostingController)
|
|
|
|
hostingController.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(donePressed))
|
|
|
|
}
|
|
|
|
|
|
|
|
required init?(coder aDecoder: NSCoder) {
|
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
override func viewWillDisappear(_ animated: Bool) {
|
|
|
|
super.viewWillDisappear(animated)
|
|
|
|
|
|
|
|
// workaround for onDisappear not being called when a modally presented UIHostingController is dismissed
|
|
|
|
NotificationCenter.default.post(name: .preferencesChanged, object: nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc func donePressed() {
|
|
|
|
dismiss(animated: true)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|