Преглед на файлове

rename SettingsVideoChatInstanceController to SettingsVideoChatViewController

cyberta преди 4 години
родител
ревизия
8b8ae8d735

+ 4 - 4
deltachat-ios.xcodeproj/project.pbxproj

@@ -26,7 +26,7 @@
 		302B84C72396770B001C261F /* RelayHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 302B84C42396627F001C261F /* RelayHelper.swift */; };
 		302B84CE2397F6CD001C261F /* URL+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 302B84CD2397F6CD001C261F /* URL+Extension.swift */; };
 		302D5450268B6B2300A8B271 /* MessageUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 302D544F268B6B2300A8B271 /* MessageUtils.swift */; };
-		302D5454268B84CB00A8B271 /* SettingsVideoChatInstanceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 302D5453268B84CB00A8B271 /* SettingsVideoChatInstanceController.swift */; };
+		302D5454268B84CB00A8B271 /* SettingsVideoChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 302D5453268B84CB00A8B271 /* SettingsVideoChatViewController.swift */; };
 		302E1BB4252B5AB4008F4264 /* PlayButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 302E1BB3252B5AB4008F4264 /* PlayButtonView.swift */; };
 		30349291256441E200A523D0 /* QuotePreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30349290256441E200A523D0 /* QuotePreview.swift */; };
 		303492952565AABC00A523D0 /* DraftModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 303492942565AABC00A523D0 /* DraftModel.swift */; };
@@ -241,7 +241,7 @@
 		302B84C42396627F001C261F /* RelayHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayHelper.swift; sourceTree = "<group>"; };
 		302B84CD2397F6CD001C261F /* URL+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+Extension.swift"; sourceTree = "<group>"; };
 		302D544F268B6B2300A8B271 /* MessageUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageUtils.swift; sourceTree = "<group>"; };
-		302D5453268B84CB00A8B271 /* SettingsVideoChatInstanceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsVideoChatInstanceController.swift; sourceTree = "<group>"; };
+		302D5453268B84CB00A8B271 /* SettingsVideoChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsVideoChatViewController.swift; sourceTree = "<group>"; };
 		302E1BB3252B5AB4008F4264 /* PlayButtonView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PlayButtonView.swift; path = "deltachat-ios/Chat/Views/PlayButtonView.swift"; sourceTree = SOURCE_ROOT; };
 		30349290256441E200A523D0 /* QuotePreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuotePreview.swift; sourceTree = "<group>"; };
 		303492942565AABC00A523D0 /* DraftModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftModel.swift; sourceTree = "<group>"; };
@@ -802,7 +802,7 @@
 				78E45E3921D3CFBC00D4B15E /* SettingsController.swift */,
 				B20462E32440A4A600367A57 /* SettingsAutodelOverviewController.swift */,
 				B20462E52440C99600367A57 /* SettingsAutodelSetController.swift */,
-				302D5453268B84CB00A8B271 /* SettingsVideoChatInstanceController.swift */,
+				302D5453268B84CB00A8B271 /* SettingsVideoChatViewController.swift */,
 				AE76E5ED242BF2EA003CF461 /* WelcomeViewController.swift */,
 				AE8F503424753DFE007FEE0B /* GalleryViewController.swift */,
 				30734325249A280B00BF9AD1 /* MediaQualityController.swift */,
@@ -1340,7 +1340,7 @@
 				AEC67A1E241FCFE0007DDBE1 /* ChatListViewModel.swift in Sources */,
 				30FDB71F24D8170E0066C48D /* TextMessageCell.swift in Sources */,
 				AE1988A523EB2FBA00B4CD5F /* Errors.swift in Sources */,
-				302D5454268B84CB00A8B271 /* SettingsVideoChatInstanceController.swift in Sources */,
+				302D5454268B84CB00A8B271 /* SettingsVideoChatViewController.swift in Sources */,
 				AEFBE22F23FEF23D0045327A /* ProviderInfoCell.swift in Sources */,
 				AE6EC5242497663200A400E4 /* UIImageView+Extensions.swift in Sources */,
 				30F8817624DA97DA0023780E /* BackgroundContainer.swift in Sources */,

+ 1 - 1
deltachat-ios/Controller/SettingsController.swift

@@ -539,7 +539,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
     }
 
     private func showVideoChatInstance() {
-        let videoInstanceController = SettingsVideoChatInstanceController(dcContext: dcContext)
+        let videoInstanceController = SettingsVideoChatViewController(dcContext: dcContext)
         navigationController?.pushViewController(videoInstanceController, animated: true)
     }
 

+ 1 - 1
deltachat-ios/Controller/SettingsVideoChatInstanceController.swift

@@ -1,6 +1,6 @@
 import UIKit
 import DcCore
-class SettingsVideoChatInstanceController: UITableViewController {
+class SettingsVideoChatViewController: UITableViewController {
 
     private var dcContext: DcContext
 

+ 53 - 0
deltachat-ios/Controller/SettingsVideoChatViewController.swift

@@ -0,0 +1,53 @@
+import UIKit
+import DcCore
+class SettingsVideoChatViewController: UITableViewController {
+
+    private var dcContext: DcContext
+
+    private lazy var videoInstanceCell: TextFieldCell = {
+        let cell = TextFieldCell.makeConfigCell(labelID: String.localized("videochat_instance"),
+                                                placeholderID: String.localized("videochat_instance_placeholder"))
+        cell.textField.autocapitalizationType = .none
+        cell.textField.autocorrectionType = .no
+        cell.textField.textContentType = .URL
+        return cell
+    }()
+
+    init(dcContext: DcContext) {
+        self.dcContext = dcContext
+        super.init(style: .grouped)
+        self.title = String.localized("videochat_instance")
+        hidesBottomBarWhenPushed = true
+    }
+
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    // MARK: - Table view data source
+
+    override func numberOfSections(in tableView: UITableView) -> Int {
+        return 1
+    }
+
+    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 1
+    }
+
+    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+        tableView.deselectRow(at: indexPath, animated: true)
+    }
+
+    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        videoInstanceCell.textField.text = dcContext.getConfig("webrtc_instance")
+        return videoInstanceCell
+    }
+
+    override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
+        return String.localized("videochat_instance_explain")
+    }
+
+    override func viewWillDisappear(_ animated: Bool) {
+        dcContext.setConfig("webrtc_instance", videoInstanceCell.getText())
+    }
+}