talk-ios/NextcloudTalk/NCSplitViewPlaceholderViewC...

66 строки
2.7 KiB
Swift

//
// Copyright (c) 2022 Ivan Sein <ivan@nextcloud.com>
//
// Author Ivan Sein <ivan@nextcloud.com>
//
// GNU GPL version 3 or any later version
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
import UIKit
@objcMembers class NCSplitViewPlaceholderViewController: UIViewController {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var subtitleLabel: UILabel!
@IBOutlet weak var logoImage: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
titleLabel.text = NSLocalizedString("Join a conversation or start a new one", comment: "")
subtitleLabel.text = NSLocalizedString("Say hi to your friends and colleagues!", comment: "")
logoImage.image = UIImage(named: "app-logo-callkit")?.withTintColor(UIColor.systemGray)
adjustTheming()
NotificationCenter.default.addObserver(self, selector: #selector(self.appStateChanged(notification:)), name: NSNotification.Name.NCAppStateHasChanged, object: nil)
}
override func viewWillAppear(_ animated: Bool) {
let roomsTableViewController = NCUserInterfaceController.sharedInstance().roomsTableViewController
roomsTableViewController?.removeRoomSelection()
}
func adjustTheming() {
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCAppBranding.themeTextColor()]
self.navigationController?.navigationBar.tintColor = NCAppBranding.themeTextColor()
self.navigationController?.navigationBar.barTintColor = NCAppBranding.themeColor()
self.navigationController?.navigationBar.isTranslucent = false
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.titleTextAttributes = [.foregroundColor: NCAppBranding.themeTextColor()]
appearance.backgroundColor = NCAppBranding.themeColor()
self.navigationItem.standardAppearance = appearance
self.navigationItem.compactAppearance = appearance
self.navigationItem.scrollEdgeAppearance = appearance
}
func appStateChanged(notification: Notification) {
adjustTheming()
}
}