CallsFromOldAccountViewController.swift 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  3. // SPDX-License-Identifier: GPL-3.0-or-later
  4. //
  5. import UIKit
  6. @objc protocol CallsFromOldAccountViewControllerDelegate: AnyObject {
  7. func callsFromOldAccountWarningAcknowledged()
  8. }
  9. class CallsFromOldAccountViewController: UIViewController {
  10. weak var delegate: CallsFromOldAccountViewControllerDelegate?
  11. @IBOutlet weak var warningTextLabel: UILabel!
  12. @IBOutlet weak var acknowledgeWarningButton: NCButton!
  13. override func viewDidLoad() {
  14. super.viewDidLoad()
  15. self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCAppBranding.themeTextColor()]
  16. self.navigationController?.navigationBar.tintColor = NCAppBranding.themeTextColor()
  17. self.navigationController?.navigationBar.barTintColor = NCAppBranding.themeColor()
  18. self.navigationController?.navigationBar.isTranslucent = false
  19. self.navigationItem.title = NSLocalizedString("Calls from old accounts", comment: "")
  20. let appearance = UINavigationBarAppearance()
  21. appearance.configureWithOpaqueBackground()
  22. appearance.titleTextAttributes = [.foregroundColor: NCAppBranding.themeTextColor()]
  23. appearance.backgroundColor = NCAppBranding.themeColor()
  24. self.navigationItem.standardAppearance = appearance
  25. self.navigationItem.compactAppearance = appearance
  26. self.navigationItem.scrollEdgeAppearance = appearance
  27. acknowledgeWarningButton.setTitle(NSLocalizedString("Confirm and hide warning", comment: ""), for: .normal)
  28. acknowledgeWarningButton.setButtonStyle(style: .primary)
  29. let warning1 = NSLocalizedString("Calls from an old account were received.", comment: "")
  30. let warning2 = NSLocalizedString("This usually indicates that this device was previously used for an account, which was not properly removed from the server.", comment: "")
  31. let warning3 = NSLocalizedString("To resolve this issue, use the web interface and go to \"Settings -> Security\".", comment: "")
  32. let warning4 = NSLocalizedString("Under \"Devices & sessions\" check if there are duplicate entries for the same device.", comment: "")
  33. let warning5 = NSLocalizedString("Remove old duplicate entries and leave only the most recent entries.", comment: "")
  34. let warning6 = NSLocalizedString("If you're using multiple servers, you need to check all of them.", comment: "")
  35. let warningTextComplete = warning1 + " " + warning2 + "\n\n" + warning3 + "\n\n" + warning4 + "\n\n" + warning5 + "\n\n" + warning6
  36. warningTextLabel.text = warningTextComplete
  37. }
  38. @IBAction func acknowledgeWarningButtonPressed(_ sender: Any) {
  39. NCSettingsController.sharedInstance().setDidReceiveCallsFromOldAccount(false)
  40. self.navigationController?.popViewController(animated: true)
  41. self.delegate?.callsFromOldAccountWarningAcknowledged()
  42. }
  43. }