// _____ _ // |_ _| |_ _ _ ___ ___ _ __ __ _ // | | | ' \| '_/ -_) -_) ' \/ _` |_ // |_| |_||_|_| \___\___|_|_|_\__,_(_) // // Threema iOS Client // Copyright (c) 2019-2020 Threema GmbH // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License, version 3, // as published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . import UIKit class StorageManagementOlderThanViewController: ThemedTableViewController { var selectedIndex: Int = 0 override func viewDidLoad() { super.viewDidLoad() self.title = BundleUtil.localizedString(forKey: "older_than") } // MARK: - Navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { guard let cell = sender as? UITableViewCell, let indexPath = tableView.indexPath(for: cell) else { return } selectedIndex = indexPath.row } // MARK: - Table view data source override func numberOfSections(in tableView: UITableView) -> Int { return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return StorageManagementViewController.OlderThanOption.allCases.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let olderThanOption = StorageManagementViewController.OlderThanOption(rawValue: indexPath.row) else { fatalError("Unkown table view row \(indexPath.row)") } let cell: UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "OlderThanCell", for: indexPath) cell.textLabel?.text = StorageManagementViewController.titleDescription(for: olderThanOption) cell.accessoryType = indexPath.row == selectedIndex ? .checkmark : .none return cell } }