ThreemaVideoCallQualityViewController.swift 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. import Foundation
  21. class ThreemaVideoCallQualityViewController: ThemedTableViewController {
  22. required init?(coder aDecoder: NSCoder) {
  23. super.init(coder: aDecoder)
  24. }
  25. override func viewDidLoad() {
  26. super.viewDidLoad()
  27. }
  28. override func viewWillAppear(_ animated: Bool) {
  29. super.viewWillAppear(animated)
  30. self.title = BundleUtil.localizedString(forKey: "settings_threema_calls_video_quality_profile")
  31. }
  32. override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  33. return CallsignalingProtocol.threemaVideoCallQualitySettingCount()
  34. }
  35. override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  36. let qualitySettingItem = ThreemaVideoCallQualitySetting.init(UInt32(indexPath.row))
  37. let cell = tableView.dequeueReusableCell(withIdentifier: "ThreemaVideoCallQualitySettingCell", for: indexPath)
  38. cell.textLabel?.text = CallsignalingProtocol.threemaVideoCallQualitySettingTitle(for: qualitySettingItem)
  39. cell.detailTextLabel?.text = CallsignalingProtocol.threemaVideoCallQualitySettingSubtitle(for: qualitySettingItem)
  40. cell.accessoryType = CallsignalingProtocol.threemaVideoCallQualitySettingSelected(for: qualitySettingItem) ? .checkmark : .none
  41. return cell
  42. }
  43. override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  44. let qualitySettingItem = ThreemaVideoCallQualitySetting.init(UInt32(indexPath.row))
  45. UserSettings.shared()?.threemaVideoCallQualitySetting = qualitySettingItem
  46. NotificationCenter.default.post(name: NSNotification.Name(kThreemaVideoCallsQualitySettingChanged), object: nil)
  47. tableView.reloadData()
  48. }
  49. override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
  50. return BundleUtil.localizedString(forKey: "settings_threema_calls_video_quality_profile_footer")
  51. }
  52. }