added home view

This commit is contained in:
loj 2019-01-20 12:06:29 +01:00
parent 8f2475db46
commit cec1a96da2
10 changed files with 239 additions and 12 deletions

View File

@ -28,6 +28,10 @@
EE377ECB21E8F71700138385 /* PassphraseEntryMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377ECA21E8F71700138385 /* PassphraseEntryMode.swift */; };
EE377ECC21EB4A6800138385 /* Passphrase.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE96916F21D561BE00BE1289 /* Passphrase.storyboard */; };
EE377ECF21EB56AD00138385 /* ZWKeyboardLayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377ECE21EB56AD00138385 /* ZWKeyboardLayoutConstraint.swift */; };
EE377ED221F47E1400138385 /* HomeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377ED121F47E1400138385 /* HomeVC.swift */; };
EE377ED421F4827500138385 /* HomeTrxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377ED321F4827500138385 /* HomeTrxTableViewCell.swift */; };
EE377ED621F4835F00138385 /* HomeVCDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377ED521F4835F00138385 /* HomeVCDelegate.swift */; };
EE377ED821F485FB00138385 /* HomeCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377ED721F485FB00138385 /* HomeCoordinator.swift */; };
EE576FFE21CFCC5500433CAB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE576FFD21CFCC5500433CAB /* AppDelegate.swift */; };
EE57700321CFCC5500433CAB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE57700121CFCC5500433CAB /* Main.storyboard */; };
EE57700521CFCC5600433CAB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EE57700421CFCC5600433CAB /* Assets.xcassets */; };
@ -87,6 +91,10 @@
EE377EC821E8F67000138385 /* PassphraseVCDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PassphraseVCDelegate.swift; sourceTree = "<group>"; };
EE377ECA21E8F71700138385 /* PassphraseEntryMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PassphraseEntryMode.swift; sourceTree = "<group>"; };
EE377ECE21EB56AD00138385 /* ZWKeyboardLayoutConstraint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZWKeyboardLayoutConstraint.swift; sourceTree = "<group>"; };
EE377ED121F47E1400138385 /* HomeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeVC.swift; sourceTree = "<group>"; };
EE377ED321F4827500138385 /* HomeTrxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeTrxTableViewCell.swift; sourceTree = "<group>"; };
EE377ED521F4835F00138385 /* HomeVCDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeVCDelegate.swift; sourceTree = "<group>"; };
EE377ED721F485FB00138385 /* HomeCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeCoordinator.swift; sourceTree = "<group>"; };
EE576FFA21CFCC5500433CAB /* ZWallet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ZWallet.app; sourceTree = BUILT_PRODUCTS_DIR; };
EE576FFD21CFCC5500433CAB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
EE57700221CFCC5500433CAB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@ -192,6 +200,16 @@
path = Extensions;
sourceTree = "<group>";
};
EE377ED021F47D5200138385 /* Home */ = {
isa = PBXGroup;
children = (
EE377ED321F4827500138385 /* HomeTrxTableViewCell.swift */,
EE377ED121F47E1400138385 /* HomeVC.swift */,
EE377ED521F4835F00138385 /* HomeVCDelegate.swift */,
);
path = Home;
sourceTree = "<group>";
};
EE576FF121CFCC5500433CAB = {
isa = PBXGroup;
children = (
@ -273,6 +291,7 @@
EE07A46B21E29EA4006031C8 /* BaseCoordinator.swift */,
EE377EB621E6831E00138385 /* CreateNewWalletCoordinator.Delegate.swift */,
EE377EB421E6821F00138385 /* CreateNewWalletCoordinator.swift */,
EE377ED721F485FB00138385 /* HomeCoordinator.swift */,
EE07A47121E3EACE006031C8 /* OnboardingCoordinator.Delegate.swift */,
EE07A46D21E3E71B006031C8 /* OnboardingCoordinator.swift */,
);
@ -282,6 +301,7 @@
EE57702121CFD03500433CAB /* Views */ = {
isa = PBXGroup;
children = (
EE377ED021F47D5200138385 /* Home */,
EE07A44E21E217E0006031C8 /* Main */,
EE377EC321E8F44C00138385 /* Passphrase */,
EE377EBA21E68A6600138385 /* Pin */,
@ -468,6 +488,7 @@
EE377EC521E8F47100138385 /* PassphraseVC.swift in Sources */,
EE57702621CFFDDB00433CAB /* ZWButtom.swift in Sources */,
EE07A46E21E3E71B006031C8 /* OnboardingCoordinator.swift in Sources */,
EE377ED821F485FB00138385 /* HomeCoordinator.swift in Sources */,
EE07A46C21E29EA4006031C8 /* BaseCoordinator.swift in Sources */,
EE57702B21D0230C00433CAB /* ZWProgressBar.swift in Sources */,
EE57702921D0011400433CAB /* Colors.swift in Sources */,
@ -478,12 +499,15 @@
EE576FFE21CFCC5500433CAB /* AppDelegate.swift in Sources */,
EE377EC021E7D92200138385 /* PinEntryMode.swift in Sources */,
EE377EB721E6831E00138385 /* CreateNewWalletCoordinator.Delegate.swift in Sources */,
EE377ED421F4827500138385 /* HomeTrxTableViewCell.swift in Sources */,
EE377EB521E6821F00138385 /* CreateNewWalletCoordinator.swift in Sources */,
EE377ECF21EB56AD00138385 /* ZWKeyboardLayoutConstraint.swift in Sources */,
EE377EBC21E68AB000138385 /* PinVC.swift in Sources */,
EE377EC221E7DFD200138385 /* Constants.swift in Sources */,
EE377EC921E8F67000138385 /* PassphraseVCDelegate.swift in Sources */,
EE07A45721E26E88006031C8 /* IocContainer.swift in Sources */,
EE377ED221F47E1400138385 /* HomeVC.swift in Sources */,
EE377ED621F4835F00138385 /* HomeVCDelegate.swift in Sources */,
EE377EBE21E68C0B00138385 /* PinVCDelegate.swift in Sources */,
EE57702F21D38BAD00433CAB /* ZWPinDotView.swift in Sources */,
EE07A45021E23E43006031C8 /* MainVC.swift in Sources */,

View File

@ -23,6 +23,7 @@ internal protocol ViewFactoryProtocol {
func getOnboardingMainView() -> MainVC
func getPinView() -> PinVC
func getPassphraseView() -> PassphraseVC
func getHomeView() -> HomeVC
}
@ -40,6 +41,10 @@ internal class ViewFactory: ViewFactoryProtocol {
return UIStoryboard(name: "Passphrase", bundle: nil)
}()
private lazy var homeStoryboard: UIStoryboard = {
return UIStoryboard(name: "Home", bundle: nil)
}()
func getOnboardingMainView() -> MainVC {
let vc = self.mainStoryboard.instantiateViewController(withIdentifier: "Main") as! MainVC
return vc
@ -54,4 +59,9 @@ internal class ViewFactory: ViewFactoryProtocol {
let vc = self.passphraseStoryboard.instantiateViewController(withIdentifier: "Passphrase") as! PassphraseVC
return vc
}
func getHomeView() -> HomeVC {
let vc = self.homeStoryboard.instantiateViewController(withIdentifier: "Home") as! HomeVC
return vc
}
}

View File

@ -21,10 +21,10 @@
</array>
</customFonts>
<scenes>
<!--View Controller-->
<!--HomeVC-->
<scene sceneID="Tig-fj-IV0">
<objects>
<viewController storyboardIdentifier="Home" id="3iR-4S-bLd" sceneMemberID="viewController">
<viewController storyboardIdentifier="Home" id="3iR-4S-bLd" customClass="HomeVC" customModule="ZWallet" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="kOX-QC-cnU">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -53,13 +53,14 @@
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Gear" translatesAutoresizingMaskIntoConstraints="NO" id="X2K-bn-u7l">
<rect key="frame" x="372" y="58" width="18" height="18"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kcu-27-Sce">
<rect key="frame" x="359" y="48" width="44" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="18" id="Hjk-fJ-8zX"/>
<constraint firstAttribute="height" constant="18" id="dOH-qN-CgQ"/>
<constraint firstAttribute="height" constant="44" id="Fmj-aV-Z2d"/>
<constraint firstAttribute="width" constant="44" id="cGi-TZ-Ooh"/>
</constraints>
</imageView>
<state key="normal" image="Gear"/>
</button>
</subviews>
<color key="backgroundColor" red="0.15160199999809265" green="0.13179048895835876" blue="0.47870725393295288" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
@ -68,13 +69,13 @@
<constraint firstAttribute="trailing" secondItem="oqZ-HW-Zcf" secondAttribute="trailing" constant="8" id="MyX-QC-dVy"/>
<constraint firstItem="oqZ-HW-Zcf" firstAttribute="centerX" secondItem="jbe-IX-HiN" secondAttribute="centerX" id="Otm-PF-qdB"/>
<constraint firstItem="oqZ-HW-Zcf" firstAttribute="top" secondItem="Uox-ul-SfL" secondAttribute="bottom" constant="24" id="Peq-V4-GNd"/>
<constraint firstAttribute="trailing" secondItem="X2K-bn-u7l" secondAttribute="trailing" constant="24" id="UkS-Cw-a9a"/>
<constraint firstAttribute="trailing" secondItem="Kcu-27-Sce" secondAttribute="trailing" constant="11" id="T3c-oX-jwt"/>
<constraint firstAttribute="trailing" secondItem="9dR-7B-uMn" secondAttribute="trailing" constant="8" id="b7D-gH-8Mc"/>
<constraint firstItem="X2K-bn-u7l" firstAttribute="top" secondItem="Uox-ul-SfL" secondAttribute="top" id="c4U-iu-hJB"/>
<constraint firstItem="Uox-ul-SfL" firstAttribute="centerX" secondItem="jbe-IX-HiN" secondAttribute="centerX" id="d7m-Nv-PkO"/>
<constraint firstItem="9dR-7B-uMn" firstAttribute="leading" secondItem="jbe-IX-HiN" secondAttribute="leading" constant="8" id="jgc-my-yJO"/>
<constraint firstItem="oqZ-HW-Zcf" firstAttribute="leading" secondItem="jbe-IX-HiN" secondAttribute="leading" constant="8" id="ku8-jX-vvF"/>
<constraint firstItem="Uox-ul-SfL" firstAttribute="top" secondItem="jbe-IX-HiN" secondAttribute="top" constant="58" id="lx8-83-ZLS"/>
<constraint firstItem="Kcu-27-Sce" firstAttribute="top" secondItem="jbe-IX-HiN" secondAttribute="top" constant="48" id="umt-Xy-iIk"/>
<constraint firstItem="9dR-7B-uMn" firstAttribute="centerX" secondItem="jbe-IX-HiN" secondAttribute="centerX" id="v9Y-Yr-4BN"/>
</constraints>
</view>
@ -131,7 +132,7 @@
<rect key="frame" x="0.0" y="316" width="414" height="580"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="TrxCell" rowHeight="80" id="tJV-bC-RBh">
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="TrxCell" rowHeight="80" id="tJV-bC-RBh" customClass="HomeTrxTableViewCell" customModule="ZWallet" customModuleProvider="target">
<rect key="frame" x="0.0" y="55.5" width="414" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="tJV-bC-RBh" id="tbN-Xt-Swv">
@ -204,6 +205,13 @@
<constraint firstItem="PdB-OF-EFR" firstAttribute="trailing" secondItem="KXK-L6-XWN" secondAttribute="trailing" constant="24" id="peB-OP-Naa"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="directionImageView" destination="Zo3-P7-XAE" id="PWI-re-LZe"/>
<outlet property="directionLabel" destination="kfl-QO-Fmg" id="14s-3u-LNW"/>
<outlet property="trxAmountLabel" destination="KXK-L6-XWN" id="PZt-Zr-Xc1"/>
<outlet property="trxDateLabel" destination="TJc-P0-KVQ" id="4nz-jQ-aP2"/>
<outlet property="trxFiatAmountLabel" destination="q6G-cM-ax8" id="9yZ-f8-rra"/>
</connections>
</tableViewCell>
</prototypes>
</tableView>
@ -224,6 +232,15 @@
</constraints>
<viewLayoutGuide key="safeArea" id="BYh-FW-Fpk"/>
</view>
<connections>
<outlet property="balanceLabel" destination="oqZ-HW-Zcf" id="2Tx-qC-kZw"/>
<outlet property="fiatBalanceLabel" destination="9dR-7B-uMn" id="0md-Qx-clj"/>
<outlet property="receiveButton" destination="Wm8-M3-API" id="0ko-mS-UFn"/>
<outlet property="sendButton" destination="7YJ-EF-wfQ" id="fK3-DO-T2x"/>
<outlet property="settingsButton" destination="Kcu-27-Sce" id="uuK-tQ-nmu"/>
<outlet property="titleLabel" destination="Uox-ul-SfL" id="bOe-YL-1Qf"/>
<outlet property="trxTableView" destination="etR-G8-YOv" id="L5P-qP-8nn"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="avL-L1-Q13" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>

View File

@ -48,5 +48,20 @@ extension AppCoordinator: OnboardingCoordinatorDelegate {
func onboardingCoordinatorSuccessful(coordinator: OnboardingCoordinator) {
#warning("implement")
self.remove(childCoordinator: coordinator)
self.navigationController.popToRootViewController(animated: false)
self.showHome()
}
}
extension AppCoordinator {
private func showHome() {
let homeCoordinator = HomeCoordinator(navigationController: self.navigationController,
iocContainer: self.iocContainer)
self.add(childCoordinator: homeCoordinator)
homeCoordinator.start()
}
}

View File

@ -82,7 +82,7 @@ extension CreateNewWalletCoordinator: PassphraseVCDelegate {
self.showConfirmPassphraseView(with: passphrase)
case let .confirm(passphrase):
#warning("save passphrase")
#warning("onboarding done")
self.delegate?.createNewWalletCoordinatorSuccessful(coordinator: self)
}
}

View File

@ -0,0 +1,59 @@
//
// HomeCoordinator.swift
// ZWallet
//
// Created by loj on 20.01.19.
// Copyright © 2019 XMR Systems LLC. All rights reserved.
//
import Foundation
import UIKit
internal class HomeCoordinator: BaseCoordinator {
private var iocContainer: IocContainerProtocol
private var viewFactory: ViewFactoryProtocol
private var localizer: Localizable
internal init(navigationController: UINavigationController,
iocContainer: IocContainerProtocol)
{
self.iocContainer = iocContainer
self.viewFactory = self.iocContainer.viewFactory
self.localizer = self.iocContainer.localizer
super.init(navigationController: navigationController)
}
internal func start() {
self.showHomeView()
}
}
extension HomeCoordinator: HomeVCDelegate {
func homeVCSendButtonTouched(sender: HomeVC) {
#warning("implement")
}
func homeVCReceiveButtonTouched(sender: HomeVC) {
#warning("implement")
}
func homeVCSettingsButtonTouched(sender: HomeVC) {
#warning("implement")
}
func homeVCTrxCellTouched(sender: HomeVC) {
#warning("implement")
}
private func showHomeView() {
let vc = self.viewFactory.getHomeView()
vc.localizer = self.localizer
self.navigationController.pushViewController(vc, animated: true)
}
}

View File

@ -62,7 +62,8 @@ extension OnboardingCoordinator: MainVCDelegate {
extension OnboardingCoordinator: CreateNewWalletCoordinatorDelegate {
func createNewWalletCoordinatorSuccessful(coordinator: CreateNewWalletCoordinator) {
#warning("implement")
self.remove(childCoordinator: coordinator)
self.delegate?.onboardingCoordinatorSuccessful(coordinator: self)
}
func createNewWalletCoordinatorCancelled(coordinator: CreateNewWalletCoordinator) {

View File

@ -0,0 +1,30 @@
//
// HomeTrxTableViewCell.swift
// ZWallet
//
// Created by loj on 20.01.19.
// Copyright © 2019 XMR Systems LLC. All rights reserved.
//
import UIKit
class HomeTrxTableViewCell: UITableViewCell {
@IBOutlet weak var directionImageView: UIImageView!
@IBOutlet weak var directionLabel: UILabel!
@IBOutlet weak var trxDateLabel: UILabel!
@IBOutlet weak var trxAmountLabel: UILabel!
@IBOutlet weak var trxFiatAmountLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}

View File

@ -0,0 +1,54 @@
//
// HomeVC.swift
// ZWallet
//
// Created by loj on 20.01.19.
// Copyright © 2019 XMR Systems LLC. All rights reserved.
//
import UIKit
class HomeVC: UIViewController {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var balanceLabel: UILabel!
@IBOutlet weak var fiatBalanceLabel: UILabel!
@IBOutlet weak var sendButton: UIButton!
@IBOutlet weak var receiveButton: UIButton!
@IBOutlet weak var settingsButton: UIButton!
@IBOutlet weak var trxTableView: UITableView!
public weak var delegate: HomeVCDelegate?
public weak var localizer: Localizable?
@IBAction func sendButtonTouched() {
self.delegate?.homeVCSendButtonTouched(sender: self)
}
@IBAction func receiveButtonTouched() {
self.delegate?.homeVCReceiveButtonTouched(sender: self)
}
@IBAction func settingsButtonTouched() {
self.delegate?.homeVCSettingsButtonTouched(sender: self)
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.setup()
self.updateView()
}
private func setup() {
}
private func updateView() {
}
}

View File

@ -0,0 +1,17 @@
//
// HomeVCDelegate.swift
// ZWallet
//
// Created by loj on 20.01.19.
// Copyright © 2019 XMR Systems LLC. All rights reserved.
//
import Foundation
internal protocol HomeVCDelegate: class {
func homeVCSendButtonTouched(sender: HomeVC)
func homeVCReceiveButtonTouched(sender: HomeVC)
func homeVCSettingsButtonTouched(sender: HomeVC)
func homeVCTrxCellTouched(sender: HomeVC)
}