aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionDetailTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-03-09 12:53:14 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-18 06:46:55 +0100
commit8e5a9215de945cd6a6bc274c37bb1f2d31581bd5 (patch)
treef0e2c5ca7af47a0dd089bafbc52de40fc2c212dc /WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionDetailTableViewController.swift
parenton-demand: iOS: SSIDs view: Always show the selected SSIDs section (diff)
downloadwireguard-apple-8e5a9215de945cd6a6bc274c37bb1f2d31581bd5.tar.xz
wireguard-apple-8e5a9215de945cd6a6bc274c37bb1f2d31581bd5.zip
on-demand: iOS: Show list of SSIDs in a separate screen
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionDetailTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionDetailTableViewController.swift48
1 files changed, 48 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionDetailTableViewController.swift
new file mode 100644
index 0000000..c1e0913
--- /dev/null
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionDetailTableViewController.swift
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: MIT
+// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
+
+import UIKit
+
+class SSIDOptionDetailTableViewController: UITableViewController {
+
+ let selectedSSIDs: [String]
+
+ init(title: String, ssids: [String]) {
+ selectedSSIDs = ssids
+ super.init(style: .grouped)
+ self.title = title
+ }
+
+ required init?(coder aDecoder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ tableView.estimatedRowHeight = 44
+ tableView.rowHeight = UITableView.automaticDimension
+
+ tableView.register(TextCell.self)
+ }
+}
+
+extension SSIDOptionDetailTableViewController {
+ override func numberOfSections(in tableView: UITableView) -> Int {
+ return 1
+ }
+
+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return selectedSSIDs.count
+ }
+
+ override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
+ return tr("tunnelOnDemandSectionTitleSelectedSSIDs")
+ }
+
+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ let cell: TextCell = tableView.dequeueReusableCell(for: indexPath)
+ cell.message = selectedSSIDs[indexPath.row]
+ return cell
+ }
+}