Files
safe-ios/Multisig/UI/Settings/AppSettingsViewController/FeatureToggleTableViewController.swift
6e841ec293 gh-2828 Lock / unlock store (#2891)
* gh-2828 Lock/unlock data store

* gh-2828 Add required credential checks to security center

* gh-2828 Add screen for faceID unlock

* gh-2828 Separate layout for faceID unlock screen

* gh-2828 Fix optional variable binding; cleanup

* gh-2828 Wire faceID unlock

* gh-2828 WIP: passcode check

* gh-2828 Add handling for initial passcode

* gh-2828 delete v1

* gh-2828 Do not create a new sensitive key when changing the password

* gh-2828 Enable passcode check

* gh-2828 enable conditional unlock

* gh-2828 Rename feature toggle

* gh-2828 Test sensitive key is kept across password changes.

* gh-2828 Unlock datastore with derived user passcode

* gh-2828 Change passcode: password check & unlock

* gh-2828 Prevent double faceID check

* gh-2828 Add separate callback for faceID check

* gh-2828 Automatically ask for TouchId/FaceId

* gh-2828 Can't use protocol as type if you want default values :-(

---------

Co-authored-by: Dirk Jäckel <[email protected]>
2023-02-13 13:28:17 +01:00

80 lines
2.3 KiB
Swift

//
// FeatureToggleTableViewController.swift
// Multisig
//
// Created by Dmitry Bespalov on 18.01.23.
// Copyright © 2023 Gnosis Ltd. All rights reserved.
//
import UIKit
class FeatureToggleTableViewController: UITableViewController {
enum RowID {
case securityCenter
case halt
}
var rows: [RowID] = [.securityCenter, .halt]
override func viewDidLoad() {
super.viewDidLoad()
title = "Toggles"
tableView.registerCell(SwitchDetailedTableViewCell.self)
tableView.registerCell(ButtonTableViewCell.self)
tableView.backgroundColor = .backgroundPrimary
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 60
if #available(iOS 15.0, *) {
tableView.sectionHeaderTopPadding = 0
}
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return rows.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let rowID = rows[indexPath.row]
switch rowID {
case .securityCenter:
let cell = tableView.dequeueCell(SwitchDetailedTableViewCell.self, for: indexPath)
cell.text = "Security v2"
cell.detailText = "This will switch passcode functionality to use the new key security infrastructure."
cell.setOn(AppConfiguration.FeatureToggles.securityCenter, animated: false)
return cell
case .halt:
let cell = tableView.dequeueCell(ButtonTableViewCell.self, for: indexPath)
cell.setText("Shtudown the app") {
exit(0)
}
return cell
}
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let rowID = rows[indexPath.row]
switch rowID {
case .securityCenter:
AppConfiguration.FeatureToggles.securityCenter.toggle()
let cell = tableView.cellForRow(at: indexPath) as! SwitchDetailedTableViewCell
cell.setOn(AppConfiguration.FeatureToggles.securityCenter)
default:
break
}
}
}