-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…creen Create screen
- Loading branch information
Showing
23 changed files
with
410 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
.../ico-relayer-clock.imageset/Contents.json → ...xcassets/ico-check.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "ico-relayer-clock.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
Multisig/Assets.xcassets/ico-mobile.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Mobile.pdf", | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"filename" : "Mobile (1).pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
Multisig/Assets.xcassets/ico-password.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Lock (1).pdf", | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"filename" : "Lock.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 161 additions & 0 deletions
161
Multisig/UI/Settings/MFA/KeySecurityOverviewViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
// | ||
// KeySecurityOverviewViewController.swift | ||
// Multisig | ||
// | ||
// Created by Mouaz on 8/8/23. | ||
// Copyright © 2023 Gnosis Ltd. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
fileprivate protocol SectionItem {} | ||
|
||
class KeySecurityOverviewViewController: LoadableViewController, UITableViewDelegate, UITableViewDataSource { | ||
@IBOutlet private var infoButton: UIBarButtonItem! | ||
|
||
private typealias SectionItems = (section: Section, items: [SectionItem]) | ||
private var sections = [SectionItems]() | ||
|
||
enum Section { | ||
case enabledFactors(String) | ||
case otherFactors(String) | ||
case info | ||
|
||
enum Factor: SectionItem { | ||
case factor(String, String?, String, Bool, Bool) | ||
} | ||
|
||
enum Info: SectionItem { | ||
case info(String, String) | ||
} | ||
} | ||
|
||
convenience init() { | ||
self.init(namedClass: Self.superclass()) | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
tableView.registerCell(SecurityFactorTableViewCell.self) | ||
tableView.registerCell(WarningTableViewCell.self) | ||
tableView.registerHeaderFooterView(BasicHeaderView.self) | ||
|
||
tableView.rowHeight = UITableView.automaticDimension | ||
tableView.estimatedRowHeight = 60 | ||
|
||
tableView.delegate = self | ||
tableView.dataSource = self | ||
tableView.tableFooterView = UIView() | ||
title = "Recovery Kit" | ||
|
||
if #available(iOS 15.0, *) { | ||
tableView.sectionHeaderTopPadding = 0 | ||
} | ||
|
||
infoButton = UIBarButtonItem(image: UIImage(named: "ico-info-24"), | ||
style: UIBarButtonItem.Style.plain, | ||
target: self, | ||
action: #selector(showHelpScreen)) | ||
navigationItem.rightBarButtonItem = infoButton | ||
} | ||
|
||
@objc func showHelpScreen() { | ||
|
||
} | ||
|
||
override func reloadData() { | ||
buildSections() | ||
tableView.reloadData() | ||
} | ||
|
||
private func buildSections() { | ||
sections = [] | ||
|
||
// TODO: Build sections properly | ||
sections.append(SectionItems(section: .enabledFactors("ENABLED FACTORS"), items: [ | ||
Section.Factor.factor("Email address", "ann.fischer@gmail", "ico-eMail", true, true)])) | ||
sections.append(SectionItems(section: .otherFactors("OTHER FACTORS"), | ||
items: [ | ||
Section.Factor.factor("Security password", nil, "ico-password", false, false), | ||
Section.Factor.factor("Trusted device", nil, "ico-mobile", false, false)])) | ||
sections.append(SectionItems(section: .info, | ||
items: [Section.Info.info("More factors are coming soon!", "ico-clock")])) | ||
|
||
let header = TableHeaderView(frame: CGRect(x: 0, y: 0, width: 0, height: 120)) | ||
header.set("Protect your owner from unauthorised access and ensure easy recovery. We recommend to enable at least 2 recovery factors.", centered: true, linesCount: 3, backgroundColor: .backgroundPrimary) | ||
|
||
tableView.tableHeaderView = header | ||
} | ||
|
||
func numberOfSections(in tableView: UITableView) -> Int { | ||
sections.count | ||
} | ||
|
||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
sections[section].items.count | ||
} | ||
|
||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
let factor = sections[indexPath.section].items[indexPath.row] | ||
switch sections[indexPath.section].section { | ||
case .enabledFactors(_), .otherFactors(_): | ||
if case let Section.Factor.factor(name, value, image, isDefault, selected) = factor { | ||
let cell = tableView.dequeueCell(SecurityFactorTableViewCell.self, for: indexPath) | ||
cell.selectionStyle = .none | ||
cell.set(name: name, | ||
icon: UIImage(named: image)!, | ||
value: value, | ||
tag: isDefault ? "(Default)" : nil, | ||
selected: selected) | ||
|
||
return cell | ||
} | ||
case .info: | ||
if case let Section.Info.info(text, image) = factor { | ||
let cell = tableView.dequeueCell(WarningTableViewCell.self, for: indexPath) | ||
cell.selectionStyle = .none | ||
cell.set(image: UIImage(named: image)?.withTintColor(.info, renderingMode: .alwaysOriginal), | ||
description: text, | ||
backgroundColor: .infoBackground) | ||
cell.backgroundColor = .clear | ||
|
||
return cell | ||
} | ||
} | ||
|
||
return UITableViewCell() | ||
} | ||
|
||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
|
||
} | ||
|
||
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | ||
var view: UIView? | ||
|
||
var title: String | ||
switch sections[section].section { | ||
case .enabledFactors(let name): | ||
title = name | ||
case .otherFactors(let name): | ||
title = name | ||
case .info: | ||
title = "" | ||
} | ||
|
||
view = tableView.dequeueHeaderFooterView(BasicHeaderView.self) | ||
(view as! BasicHeaderView).setName(title, backgroundColor: .clear, style: .caption2Secondary) | ||
|
||
return view | ||
} | ||
|
||
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | ||
switch sections[section].section { | ||
case .info: | ||
return 0 | ||
default: | ||
return BasicHeaderView.headerHeight | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
Multisig/UI/Settings/MFA/SecurityFactorTableViewCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// SecurityFactorTableViewCell.swift | ||
// Multisig | ||
// | ||
// Created by Mouaz on 8/9/23. | ||
// Copyright © 2023 Gnosis Ltd. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class SecurityFactorTableViewCell: UITableViewCell { | ||
|
||
@IBOutlet private weak var selectedImageView: UIImageView! | ||
@IBOutlet private weak var iconImageView: UIImageView! | ||
@IBOutlet private weak var tagLabel: UILabel! | ||
@IBOutlet private weak var valueLabel: UILabel! | ||
@IBOutlet private weak var nameLabel: UILabel! | ||
|
||
override func awakeFromNib() { | ||
super.awakeFromNib() | ||
|
||
nameLabel.setStyle(.headline) | ||
tagLabel.setStyle(.subheadlineSecondary) | ||
valueLabel.setStyle(.callout) | ||
} | ||
|
||
func set(name: String, icon: UIImage, value: String? = nil, tag: String? = nil, selected: Bool = false) { | ||
nameLabel.text = name | ||
valueLabel.text = value | ||
valueLabel.isHidden = value == nil | ||
tagLabel.text = tag | ||
tagLabel.isHidden = tag == nil | ||
selectedImageView.isHidden = !selected | ||
iconImageView.image = icon | ||
layoutIfNeeded() | ||
} | ||
} |
Oops, something went wrong.