added settings cell types

This commit is contained in:
loj 2019-04-27 01:13:12 +02:00
parent 23469e068b
commit 1b9994cf7e
10 changed files with 349 additions and 57 deletions

View File

@ -124,6 +124,9 @@
EEE15B1D227231F0008231B6 /* SettingsVCViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE15B1C227231F0008231B6 /* SettingsVCViewModel.swift */; };
EEE15B1F22723478008231B6 /* SettingsCoordinator.Delegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE15B1E22723478008231B6 /* SettingsCoordinator.Delegate.swift */; };
EEE15B20227238FF008231B6 /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EEE15B1622722CEE008231B6 /* Settings.storyboard */; };
EEE15B222273B6C5008231B6 /* SettingsTwoLabelsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE15B212273B6C5008231B6 /* SettingsTwoLabelsTableViewCell.swift */; };
EEE15B242273B701008231B6 /* SettingsOneLabelTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE15B232273B701008231B6 /* SettingsOneLabelTableViewCell.swift */; };
EEE15B262273B721008231B6 /* SettingsSwitchTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE15B252273B721008231B6 /* SettingsSwitchTableViewCell.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -250,6 +253,9 @@
EEE15B1A22723179008231B6 /* SettingsVCDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsVCDelegate.swift; sourceTree = "<group>"; };
EEE15B1C227231F0008231B6 /* SettingsVCViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsVCViewModel.swift; sourceTree = "<group>"; };
EEE15B1E22723478008231B6 /* SettingsCoordinator.Delegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsCoordinator.Delegate.swift; sourceTree = "<group>"; };
EEE15B212273B6C5008231B6 /* SettingsTwoLabelsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTwoLabelsTableViewCell.swift; sourceTree = "<group>"; };
EEE15B232273B701008231B6 /* SettingsOneLabelTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsOneLabelTableViewCell.swift; sourceTree = "<group>"; };
EEE15B252273B721008231B6 /* SettingsSwitchTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSwitchTableViewCell.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -648,6 +654,9 @@
EEE15B182272305C008231B6 /* SettingsVC.swift */,
EEE15B1A22723179008231B6 /* SettingsVCDelegate.swift */,
EEE15B1C227231F0008231B6 /* SettingsVCViewModel.swift */,
EEE15B212273B6C5008231B6 /* SettingsTwoLabelsTableViewCell.swift */,
EEE15B232273B701008231B6 /* SettingsOneLabelTableViewCell.swift */,
EEE15B252273B721008231B6 /* SettingsSwitchTableViewCell.swift */,
);
path = Settings;
sourceTree = "<group>";
@ -807,6 +816,7 @@
EE377EE421F4F1A100138385 /* TrxDetails.swift in Sources */,
EE377ECB21E8F71700138385 /* PassphraseEntryMode.swift in Sources */,
EEBEBB882207061300A6BD18 /* String-Extension.swift in Sources */,
EEE15B242273B701008231B6 /* SettingsOneLabelTableViewCell.swift in Sources */,
EE377EB321E5303E00138385 /* ViewFactory.swift in Sources */,
EE07A47221E3EACE006031C8 /* OnboardingCoordinator.Delegate.swift in Sources */,
EE1876A72219FA15004853A7 /* Wallet.swift in Sources */,
@ -823,6 +833,7 @@
EE94A74C22135B7200882BB1 /* TrxDetailsVCDelegate.swift in Sources */,
EEE15B0F2270E89F008231B6 /* QrcVCDelegate.swift in Sources */,
EE377EC021E7D92200138385 /* PinEntryMode.swift in Sources */,
EEE15B262273B721008231B6 /* SettingsSwitchTableViewCell.swift in Sources */,
EE21434D22298F8900F3902D /* UINavigationController-Extension.swift in Sources */,
EE377EB721E6831E00138385 /* CreateNewWalletCoordinator.Delegate.swift in Sources */,
EEBEBB7D2200E10B00A6BD18 /* ScanVCDelegate.swift in Sources */,
@ -844,6 +855,7 @@
EE377EF121FDEE3F00138385 /* ZEC.swift in Sources */,
EEBEBB972207477100A6BD18 /* SendCoordinator.Delegate.swift in Sources */,
EE377ED221F47E1400138385 /* HomeVC.swift in Sources */,
EEE15B222273B6C5008231B6 /* SettingsTwoLabelsTableViewCell.swift in Sources */,
EE377ED621F4835F00138385 /* HomeVCDelegate.swift in Sources */,
EE377EBE21E68C0B00138385 /* PinVCDelegate.swift in Sources */,
EE1876A52219DD99004853A7 /* AmountVCViewModel.swift in Sources */,

View File

@ -136,3 +136,19 @@
"settings.button.nukeWallet" = "Wallet löschen";
"settings.generalSettings" = "Allgemeine Einstellungen";
"settings.language" = "Sprache";
"settings.fiat" = "Fiat Einheit";
"settings.node" = "Node";
"settings.faceId" = "Face ID";
"settings.resetPin" = "PIN zurücksetzen";
"settings.securityAndPin" = "Sicherheit und PIN";
"settings.displayPassphrase" = "Passwort anzeigen";

View File

@ -136,3 +136,19 @@
"settings.button.nukeWallet" = "Nuke Wallet";
"settings.generalSettings" = "General Settings";
"settings.language" = "Language";
"settings.fiat" = "Fiat Conversion Unit";
"settings.node" = "Node";
"settings.faceId" = "Face ID";
"settings.resetPin" = "Reset PIN";
"settings.securityAndPin" = "Security & PIN";
"settings.displayPassphrase" = "Display Passphrase";

View File

@ -12,6 +12,9 @@
<array key="SourceSansPro-Bold.ttf">
<string>SourceSansPro-Bold</string>
</array>
<array key="SourceSansPro-Regular.ttf">
<string>SourceSansPro-Regular</string>
</array>
<array key="SourceSansPro-SemiBold.ttf">
<string>SourceSansPro-SemiBold</string>
</array>
@ -63,9 +66,120 @@
<action selector="backButtonTouched" destination="M2V-hB-lEq" eventType="touchUpInside" id="bPG-xl-juI"/>
</connections>
</button>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="q79-B3-nPW">
<rect key="frame" x="0.0" y="199" width="414" height="615"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" rowHeight="48" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="q79-B3-nPW">
<rect key="frame" x="0.0" y="171" width="414" height="643"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingsTwoLabelsCell" id="9ur-6u-FUh" userLabel="TwoLabelsCell" customClass="SettingsTwoLabelsTableViewCell" customModule="ZWallet">
<rect key="frame" x="0.0" y="55.5" width="414" height="48"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="9ur-6u-FUh" id="Up4-bQ-WE9">
<rect key="frame" x="0.0" y="0.0" width="414" height="47.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="!!Left" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0r1-0w-aZe" userLabel="LeftLabel">
<rect key="frame" x="24" y="13.5" width="612" height="21"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="180" id="iY2-O9-Eeb"/>
</constraints>
<fontDescription key="fontDescription" name="SourceSansPro-Regular" family="Source Sans Pro" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="!!Right" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v31-CV-Ig6" userLabel="RightLabel">
<rect key="frame" x="652" y="13.5" width="100" height="21"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="9we-NL-ajp"/>
</constraints>
<fontDescription key="fontDescription" name="SourceSansPro-Regular" family="Source Sans Pro" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" alpha="0.40000000596046448" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="DisclosureIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="2CD-U8-Oyl">
<rect key="frame" x="776" y="17.5" width="8" height="13"/>
<viewLayoutGuide key="safeArea" id="BVq-JV-ZhK"/>
</imageView>
</subviews>
<constraints>
<constraint firstItem="0r1-0w-aZe" firstAttribute="leading" secondItem="Up4-bQ-WE9" secondAttribute="leading" constant="24" id="1y0-sF-kUS"/>
<constraint firstItem="2CD-U8-Oyl" firstAttribute="centerY" secondItem="Up4-bQ-WE9" secondAttribute="centerY" id="9jv-xq-dEx"/>
<constraint firstItem="2CD-U8-Oyl" firstAttribute="leading" secondItem="v31-CV-Ig6" secondAttribute="trailing" constant="24" id="B3k-KX-ZIW"/>
<constraint firstItem="0r1-0w-aZe" firstAttribute="centerY" secondItem="Up4-bQ-WE9" secondAttribute="centerY" id="Jjf-dt-IOM"/>
<constraint firstAttribute="trailing" secondItem="2CD-U8-Oyl" secondAttribute="trailing" constant="24" id="gut-Ik-XLC"/>
<constraint firstItem="v31-CV-Ig6" firstAttribute="leading" secondItem="0r1-0w-aZe" secondAttribute="trailing" constant="16" id="sBR-dh-0SH"/>
<constraint firstItem="v31-CV-Ig6" firstAttribute="centerY" secondItem="Up4-bQ-WE9" secondAttribute="centerY" id="uqe-An-Edr"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="leftLabel" destination="0r1-0w-aZe" id="gi3-KJ-5NP"/>
<outlet property="rightLabel" destination="v31-CV-Ig6" id="4SW-bQ-UGT"/>
</connections>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingsOneLabelCell" id="tr9-Wr-iEY" userLabel="OneLabelCell" customClass="SettingsOneLabelTableViewCell" customModule="ZWallet">
<rect key="frame" x="0.0" y="103.5" width="414" height="48"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="tr9-Wr-iEY" id="1ih-QA-kGw">
<rect key="frame" x="0.0" y="0.0" width="414" height="47.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="!!Left" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sNp-76-3jx" userLabel="LeftLabel">
<rect key="frame" x="24" y="13.5" width="728" height="21"/>
<fontDescription key="fontDescription" name="SourceSansPro-Regular" family="Source Sans Pro" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" alpha="0.40000000596046448" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="DisclosureIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="3rv-zo-Amg">
<rect key="frame" x="776" y="17.5" width="8" height="13"/>
<viewLayoutGuide key="safeArea" id="Gal-Ru-udU"/>
</imageView>
</subviews>
<constraints>
<constraint firstItem="3rv-zo-Amg" firstAttribute="leading" secondItem="sNp-76-3jx" secondAttribute="trailing" constant="24" id="7M7-gR-wA9"/>
<constraint firstItem="sNp-76-3jx" firstAttribute="leading" secondItem="1ih-QA-kGw" secondAttribute="leading" constant="24" id="BrG-Fe-SPd"/>
<constraint firstItem="sNp-76-3jx" firstAttribute="centerY" secondItem="1ih-QA-kGw" secondAttribute="centerY" id="D7H-tw-NoN"/>
<constraint firstItem="3rv-zo-Amg" firstAttribute="centerY" secondItem="1ih-QA-kGw" secondAttribute="centerY" id="DdC-FE-89S"/>
<constraint firstAttribute="trailing" secondItem="3rv-zo-Amg" secondAttribute="trailing" constant="24" id="mdW-Va-22b"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="leftLabel" destination="sNp-76-3jx" id="Tn9-xC-9Hj"/>
</connections>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingsSwitchCell" id="9oX-To-Kbp" userLabel="SwitchCell" customClass="SettingsSwitchTableViewCell" customModule="ZWallet">
<rect key="frame" x="0.0" y="151.5" width="414" height="48"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="9oX-To-Kbp" id="Kas-rg-D0T">
<rect key="frame" x="0.0" y="0.0" width="414" height="47.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="!!Right" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2vT-ca-43g" userLabel="LeftLabel">
<rect key="frame" x="24" y="13.5" width="691" height="21"/>
<fontDescription key="fontDescription" name="SourceSansPro-Regular" family="Source Sans Pro" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7wh-YI-lVe">
<rect key="frame" x="735" y="8.5" width="51" height="31"/>
<color key="onTintColor" red="0.2404455543" green="0.49460166690000001" blue="0.8346244693" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<action selector="switchChanged" destination="9oX-To-Kbp" eventType="valueChanged" id="gLB-Jg-Aue"/>
</connections>
</switch>
</subviews>
<constraints>
<constraint firstItem="7wh-YI-lVe" firstAttribute="leading" secondItem="2vT-ca-43g" secondAttribute="trailing" constant="20" id="Ay5-ba-Ic3"/>
<constraint firstAttribute="trailing" secondItem="7wh-YI-lVe" secondAttribute="trailing" constant="24" id="Eff-HJ-ImQ"/>
<constraint firstItem="2vT-ca-43g" firstAttribute="centerY" secondItem="Kas-rg-D0T" secondAttribute="centerY" id="LxI-wP-U9A"/>
<constraint firstItem="7wh-YI-lVe" firstAttribute="centerY" secondItem="Kas-rg-D0T" secondAttribute="centerY" id="pgv-PD-4wf"/>
<constraint firstItem="2vT-ca-43g" firstAttribute="leading" secondItem="Kas-rg-D0T" secondAttribute="leading" constant="24" id="tLC-6t-VsT"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="leftLabel" destination="2vT-ca-43g" id="5U3-5h-MN1"/>
<outlet property="switchSwitch" destination="7wh-YI-lVe" id="Cxy-lU-c8A"/>
</connections>
</tableViewCell>
</prototypes>
</tableView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="!!Settings" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r9g-U1-6GC">
<rect key="frame" x="24" y="116" width="366" height="43"/>
@ -77,7 +191,7 @@
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<constraints>
<constraint firstItem="q79-B3-nPW" firstAttribute="leading" secondItem="Vyu-5m-YUx" secondAttribute="leading" id="CPe-kP-tOU"/>
<constraint firstItem="Vyu-5m-YUx" firstAttribute="bottom" secondItem="H0N-Ax-m9d" secondAttribute="bottom" id="FPj-Sn-BCT"/>
@ -86,7 +200,7 @@
<constraint firstItem="r9g-U1-6GC" firstAttribute="leading" secondItem="Vyu-5m-YUx" secondAttribute="leading" constant="24" id="WOg-Dr-Ycf"/>
<constraint firstItem="BD7-Xi-ojG" firstAttribute="top" secondItem="Vyu-5m-YUx" secondAttribute="top" constant="4" id="XOf-4Y-77E"/>
<constraint firstItem="H0N-Ax-m9d" firstAttribute="top" secondItem="q79-B3-nPW" secondAttribute="bottom" id="fRm-hn-JqE"/>
<constraint firstItem="q79-B3-nPW" firstAttribute="top" secondItem="r9g-U1-6GC" secondAttribute="bottom" constant="40" id="hfM-KR-3FO"/>
<constraint firstItem="q79-B3-nPW" firstAttribute="top" secondItem="r9g-U1-6GC" secondAttribute="bottom" constant="12" id="hfM-KR-3FO"/>
<constraint firstItem="Vyu-5m-YUx" firstAttribute="trailing" secondItem="H0N-Ax-m9d" secondAttribute="trailing" constant="24" id="j43-qX-LKh"/>
<constraint firstItem="H0N-Ax-m9d" firstAttribute="leading" secondItem="Vyu-5m-YUx" secondAttribute="leading" constant="24" id="mFp-Wh-To7"/>
<constraint firstItem="Vyu-5m-YUx" firstAttribute="trailing" secondItem="r9g-U1-6GC" secondAttribute="trailing" constant="24" id="unm-EG-rDc"/>
@ -108,5 +222,6 @@
</scenes>
<resources>
<image name="ArrowBack" width="24" height="24"/>
<image name="DisclosureIndicator" width="8" height="13"/>
</resources>
</document>

View File

@ -37,6 +37,7 @@ internal class SettingsCoordinator: BaseCoordinator {
extension SettingsCoordinator: SettingsVCDelegate {
func settingsVCDelegateBackTouched(sender: SettingsVC) {
self.delegate?.settingsCoordinatorDelegateBackTouched(coordinator: self)
}
@ -45,6 +46,30 @@ extension SettingsCoordinator: SettingsVCDelegate {
#warning("implement")
}
func settingsVCDelegateLanguageSelectionTouched(sender: SettingsVC) {
}
func settingsVCDelegateFiatSelectionTouched(sender: SettingsVC) {
}
func settingsVCDelegateNodeSelectionTouched(sender: SettingsVC) {
}
func settingsVCDelegateBiometricSwitchTouched(sender: SettingsVC) {
}
func settingsVCDelegateResetPinTouched(sender: SettingsVC) {
}
func settingsVCDelegateDisplayPassphraseTouched(sender: SettingsVC) {
}
private func showSettingsView() {
let vc = self.viewFactory.getSettingsVC()
vc.delegate = self

View File

@ -0,0 +1,14 @@
//
// SettingsOneLabelTableViewCell.swift
// ZWallet
//
// Created by loj on 27.04.19.
// Copyright © 2019 XMR Systems LLC. All rights reserved.
//
import UIKit
class SettingsOneLabelTableViewCell: UITableViewCell {
@IBOutlet weak var leftLabel: UILabel!
}

View File

@ -0,0 +1,17 @@
//
// SettingsSwitchTableViewCell.swift
// ZWallet
//
// Created by loj on 27.04.19.
// Copyright © 2019 XMR Systems LLC. All rights reserved.
//
import UIKit
class SettingsSwitchTableViewCell: UITableViewCell {
@IBOutlet weak var leftLabel: UILabel!
@IBOutlet weak var switchSwitch: UISwitch!
@IBAction func switchChanged() {}
}

View File

@ -0,0 +1,15 @@
//
// SettingsTwoLabelsTableViewCell.swift
// ZWallet
//
// Created by loj on 26.04.19.
// Copyright © 2019 XMR Systems LLC. All rights reserved.
//
import UIKit
class SettingsTwoLabelsTableViewCell: UITableViewCell {
@IBOutlet weak var leftLabel: UILabel!
@IBOutlet weak var rightLabel: UILabel!
}

View File

@ -43,8 +43,8 @@ class SettingsVC: UIViewController {
}
private func setup() {
// self.settingsTableView.dataSource = self
// self.settingsTableView.delegate = self
self.settingsTableView.dataSource = self
self.settingsTableView.delegate = self
}
public func updateView() {
@ -59,60 +59,116 @@ class SettingsVC: UIViewController {
}
private enum CellIdentifier: String {
case review = "ReviewCell"
case memo = "ReviewMemoCell"
case twoLabels = "SettingsTwoLabelsCell"
case oneLabel = "SettingsOneLabelCell"
case labelSwitch = "SettingsSwitchCell"
}
// private var cellDefinitions: [(cell: UITableViewCell, height: Int, action: ((ReviewVC) -> Void)?)] {
// return [(self.amountCell, 100, self.delegate?.reviewVCDelegateChangeAmountTouched),
// (self.receivingAddressCell, 100, self.delegate?.reviewVCDelegateChangeReceivingAddressTouched),
// (self.memoCell, 120, self.delegate?.reviewVCDelegateChangeMemoTouched)]
// }
//
// private var amountCell: UITableViewCell {
// let cell = self.summaryTableView.dequeueReusableCell(withIdentifier: CellIdentifier.review.rawValue) as! ReviewTableViewCell
// cell.titleLabel.text = self.localizer?.localized("review.amount")
// cell.descriptionLabel.text = self.amountDescription
// return cell
// }
//
// private var receivingAddressCell: UITableViewCell {
// let cell = self.summaryTableView.dequeueReusableCell(withIdentifier: CellIdentifier.review.rawValue) as! ReviewTableViewCell
// cell.titleLabel.text = self.localizer?.localized("review.receivingAddress")
// cell.descriptionLabel.text = self.viewModel?.receivingAddress
// return cell
// }
//
// private var memoCell: UITableViewCell {
// let cell = self.summaryTableView.dequeueReusableCell(withIdentifier: CellIdentifier.memo.rawValue) as! ReviewTableViewCell
// cell.titleLabel.text = self.localizer?.localized("review.memo")
// cell.descriptionLabel.text = self.viewModel?.memo
// return cell
// }
private var cellDefinitions: [(section: Int, cell: UITableViewCell, action: ((SettingsVC) -> Void)?)] {
return [(section: 0,
cell:self.languageCell,
action: self.delegate?.settingsVCDelegateLanguageSelectionTouched),
(section: 0,
cell:self.fiatCell,
action: self.delegate?.settingsVCDelegateFiatSelectionTouched),
(section: 1,
cell:self.nodeCell,
action: self.delegate?.settingsVCDelegateNodeSelectionTouched),
(section: 2,
cell:self.biometricCell,
action: self.delegate?.settingsVCDelegateBiometricSwitchTouched),
(section: 2,
cell:self.resetPinCell,
action: self.delegate?.settingsVCDelegateResetPinTouched),
(section: 2,
cell:self.displayPassphraseCell,
action: self.delegate?.settingsVCDelegateDisplayPassphraseTouched),
]
}
private var sectionHeaders = ["settings.generalSettings",
"settings.node",
"settings.securityAndPin"]
private var languageCell: UITableViewCell {
let cell = self.settingsTableView.dequeueReusableCell(withIdentifier: CellIdentifier.twoLabels.rawValue) as! SettingsTwoLabelsTableViewCell
cell.leftLabel.text = self.localizer?.localized("settings.language")
cell.rightLabel.text = "__language__"
return cell
}
private var fiatCell: UITableViewCell {
let cell = self.settingsTableView.dequeueReusableCell(withIdentifier: CellIdentifier.twoLabels.rawValue) as! SettingsTwoLabelsTableViewCell
cell.leftLabel.text = self.localizer?.localized("settings.fiat")
cell.rightLabel.text = "__fiat__"
return cell
}
private var nodeCell: UITableViewCell {
let cell = self.settingsTableView.dequeueReusableCell(withIdentifier: CellIdentifier.oneLabel.rawValue) as! SettingsOneLabelTableViewCell
cell.leftLabel.text = "__node__"
return cell
}
private var biometricCell: UITableViewCell {
let cell = self.settingsTableView.dequeueReusableCell(withIdentifier: CellIdentifier.labelSwitch.rawValue) as! SettingsSwitchTableViewCell
cell.leftLabel.text = self.localizer?.localized("settings.faceId")
cell.switchSwitch.isOn = true
return cell
}
private var resetPinCell: UITableViewCell {
let cell = self.settingsTableView.dequeueReusableCell(withIdentifier: CellIdentifier.oneLabel.rawValue) as! SettingsOneLabelTableViewCell
cell.leftLabel.text = self.localizer?.localized("settings.resetPin")
return cell
}
private var displayPassphraseCell: UITableViewCell {
let cell = self.settingsTableView.dequeueReusableCell(withIdentifier: CellIdentifier.oneLabel.rawValue) as! SettingsOneLabelTableViewCell
cell.leftLabel.text = self.localizer?.localized("settings.displayPassphrase")
return cell
}
}
//extension SettingsVC: UITableViewDelegate {
//
// func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// return CGFloat(self.cellDefinitions[indexPath.row].height)
// }
//
// func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// if let action = self.cellDefinitions[indexPath.row].action {
// action(self)
// }
// }
//}
extension SettingsVC: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let sectionItems = self.cellDefinitions
.filter { $0.section == indexPath.section }
if let action = sectionItems[indexPath.row].action {
action(self)
}
}
}
//extension SettingsVC: UITableViewDataSource {
//
// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// return self.cellDefinitions.count
// }
//
// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// return self.cellDefinitions[indexPath.row].cell
// }
//}
extension SettingsVC: UITableViewDataSource {
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return self.localizer?.localized(self.sectionHeaders[section])
}
func numberOfSections(in tableView: UITableView) -> Int {
let n = (cellDefinitions.map { $0.section }.max() ?? 0) + 1
return n
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let n = self.cellDefinitions
.filter { $0.section == section }
.count
return n
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let sectionItems = self.cellDefinitions
.filter { $0.section == indexPath.section }
let cell = sectionItems[indexPath.row].cell
return cell
}
}

View File

@ -12,4 +12,10 @@ import Foundation
internal protocol SettingsVCDelegate: class {
func settingsVCDelegateBackTouched(sender: SettingsVC)
func settingsVCDelegateNukeWalletTouched(sender: SettingsVC)
func settingsVCDelegateLanguageSelectionTouched(sender: SettingsVC)
func settingsVCDelegateFiatSelectionTouched(sender: SettingsVC)
func settingsVCDelegateNodeSelectionTouched(sender: SettingsVC)
func settingsVCDelegateBiometricSwitchTouched(sender: SettingsVC)
func settingsVCDelegateResetPinTouched(sender: SettingsVC)
func settingsVCDelegateDisplayPassphraseTouched(sender: SettingsVC)
}