NCSplitViewPlaceholderViewController.swift 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  3. // SPDX-License-Identifier: GPL-3.0-or-later
  4. //
  5. import UIKit
  6. @objcMembers class NCSplitViewPlaceholderViewController: UIViewController {
  7. @IBOutlet weak var titleLabel: UILabel!
  8. @IBOutlet weak var subtitleLabel: UILabel!
  9. @IBOutlet weak var logoImage: UIImageView!
  10. override func viewDidLoad() {
  11. super.viewDidLoad()
  12. titleLabel.text = NSLocalizedString("Join a conversation or start a new one", comment: "")
  13. subtitleLabel.text = NSLocalizedString("Say hi to your friends and colleagues!", comment: "")
  14. logoImage.image = UIImage(named: "app-logo-callkit")?.withTintColor(UIColor.systemGray)
  15. adjustTheming()
  16. NotificationCenter.default.addObserver(self, selector: #selector(self.appStateChanged(notification:)), name: NSNotification.Name.NCAppStateHasChanged, object: nil)
  17. NotificationCenter.default.addObserver(self, selector: #selector(self.serverCapabilitiesUpdated(notification:)), name: NSNotification.Name.NCServerCapabilitiesUpdated, object: nil)
  18. }
  19. override func viewWillAppear(_ animated: Bool) {
  20. let roomsTableViewController = NCUserInterfaceController.sharedInstance().roomsTableViewController
  21. roomsTableViewController?.removeRoomSelection()
  22. }
  23. func adjustTheming() {
  24. self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCAppBranding.themeTextColor()]
  25. self.navigationController?.navigationBar.tintColor = NCAppBranding.themeTextColor()
  26. self.navigationController?.navigationBar.barTintColor = NCAppBranding.themeColor()
  27. self.navigationController?.navigationBar.isTranslucent = false
  28. let appearance = UINavigationBarAppearance()
  29. appearance.configureWithOpaqueBackground()
  30. appearance.titleTextAttributes = [.foregroundColor: NCAppBranding.themeTextColor()]
  31. appearance.backgroundColor = NCAppBranding.themeColor()
  32. self.navigationItem.standardAppearance = appearance
  33. self.navigationItem.compactAppearance = appearance
  34. self.navigationItem.scrollEdgeAppearance = appearance
  35. }
  36. func appStateChanged(notification: Notification) {
  37. adjustTheming()
  38. }
  39. func serverCapabilitiesUpdated(notification: Notification) {
  40. adjustTheming()
  41. }
  42. }