diff --git a/ZWallet.xcodeproj/project.pbxproj b/ZWallet.xcodeproj/project.pbxproj index b7e38d8..4728cb9 100644 --- a/ZWallet.xcodeproj/project.pbxproj +++ b/ZWallet.xcodeproj/project.pbxproj @@ -35,8 +35,14 @@ EE377EDA21F4BE5500138385 /* TrxHistoryProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377ED921F4BE5500138385 /* TrxHistoryProvider.swift */; }; EE377EDF21F4C45A00138385 /* TrxHistoryProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EDE21F4C45A00138385 /* TrxHistoryProviderTests.swift */; }; EE377EE221F4F18700138385 /* TrxDirection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EE121F4F18700138385 /* TrxDirection.swift */; }; - EE377EE421F4F1A100138385 /* TrxDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EE321F4F1A100138385 /* TrxDetail.swift */; }; - EE377EE621F4F1C400138385 /* TrxHistoryObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EE521F4F1C400138385 /* TrxHistoryObserver.swift */; }; + EE377EE421F4F1A100138385 /* TrxDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EE321F4F1A100138385 /* TrxDetails.swift */; }; + EE377EE621F4F1C400138385 /* TrxHistoryObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EE521F4F1C400138385 /* TrxHistoryObservable.swift */; }; + EE377EE921F7A76500138385 /* TrxDetailsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EE821F7A76500138385 /* TrxDetailsVC.swift */; }; + EE377EEB21F7AF3C00138385 /* TrxDetailTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EEA21F7AF3C00138385 /* TrxDetailTableViewCell.swift */; }; + EE377EED21F7B02600138385 /* TrxMemoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EEC21F7B02600138385 /* TrxMemoTableViewCell.swift */; }; + EE377EEF21FDE64400138385 /* TrxDetails.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE07A44B21E206D7006031C8 /* TrxDetails.storyboard */; }; + EE377EF121FDEE3F00138385 /* ZEC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EF021FDEE3F00138385 /* ZEC.swift */; }; + EE377EF321FE181000138385 /* Date-Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE377EF221FE181000138385 /* Date-Extension.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 */; }; @@ -102,8 +108,14 @@ EE377ED921F4BE5500138385 /* TrxHistoryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxHistoryProvider.swift; sourceTree = ""; }; EE377EDE21F4C45A00138385 /* TrxHistoryProviderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxHistoryProviderTests.swift; sourceTree = ""; }; EE377EE121F4F18700138385 /* TrxDirection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxDirection.swift; sourceTree = ""; }; - EE377EE321F4F1A100138385 /* TrxDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxDetail.swift; sourceTree = ""; }; - EE377EE521F4F1C400138385 /* TrxHistoryObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxHistoryObserver.swift; sourceTree = ""; }; + EE377EE321F4F1A100138385 /* TrxDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxDetails.swift; sourceTree = ""; }; + EE377EE521F4F1C400138385 /* TrxHistoryObservable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxHistoryObservable.swift; sourceTree = ""; }; + EE377EE821F7A76500138385 /* TrxDetailsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxDetailsVC.swift; sourceTree = ""; }; + EE377EEA21F7AF3C00138385 /* TrxDetailTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxDetailTableViewCell.swift; sourceTree = ""; }; + EE377EEC21F7B02600138385 /* TrxMemoTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrxMemoTableViewCell.swift; sourceTree = ""; }; + EE377EEE21F9013800138385 /* ___TODO.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = "___TODO.md"; sourceTree = ""; }; + EE377EF021FDEE3F00138385 /* ZEC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZEC.swift; sourceTree = ""; }; + EE377EF221FE181000138385 /* Date-Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date-Extension.swift"; sourceTree = ""; }; 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 = ""; }; EE57700221CFCC5500433CAB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -205,6 +217,7 @@ isa = PBXGroup; children = ( EE377ECE21EB56AD00138385 /* ZWKeyboardLayoutConstraint.swift */, + EE377EF221FE181000138385 /* Date-Extension.swift */, ); path = Extensions; sourceTree = ""; @@ -230,13 +243,24 @@ EE377EE021F4F16100138385 /* Types */ = { isa = PBXGroup; children = ( - EE377EE321F4F1A100138385 /* TrxDetail.swift */, + EE377EE321F4F1A100138385 /* TrxDetails.swift */, EE377EE121F4F18700138385 /* TrxDirection.swift */, - EE377EE521F4F1C400138385 /* TrxHistoryObserver.swift */, + EE377EE521F4F1C400138385 /* TrxHistoryObservable.swift */, + EE377EF021FDEE3F00138385 /* ZEC.swift */, ); path = Types; sourceTree = ""; }; + EE377EE721F7A71A00138385 /* TrxDetails */ = { + isa = PBXGroup; + children = ( + EE377EEA21F7AF3C00138385 /* TrxDetailTableViewCell.swift */, + EE377EE821F7A76500138385 /* TrxDetailsVC.swift */, + EE377EEC21F7B02600138385 /* TrxMemoTableViewCell.swift */, + ); + path = TrxDetails; + sourceTree = ""; + }; EE576FF121CFCC5500433CAB = { isa = PBXGroup; children = ( @@ -258,6 +282,7 @@ EE576FFC21CFCC5500433CAB /* ZWallet */ = { isa = PBXGroup; children = ( + EE377EEE21F9013800138385 /* ___TODO.md */, EE57701E21CFCFCE00433CAB /* _Assets */, EE57701D21CFCFB000433CAB /* _Main */, EE57702721D000EE00433CAB /* Definitions */, @@ -333,6 +358,7 @@ EE07A44E21E217E0006031C8 /* Main */, EE377EC321E8F44C00138385 /* Passphrase */, EE377EBA21E68A6600138385 /* Pin */, + EE377EE721F7A71A00138385 /* TrxDetails */, ); path = Views; sourceTree = ""; @@ -478,6 +504,7 @@ EE76B85C21D8D1930093571F /* SourceSansPro-BoldItalic.ttf in Resources */, EE377ECC21EB4A6800138385 /* Passphrase.storyboard in Resources */, EE76B85321D8D1930093571F /* SourceSansPro-BlackItalic.ttf in Resources */, + EE377EEF21FDE64400138385 /* TrxDetails.storyboard in Resources */, EE76B85821D8D1930093571F /* SourceSansPro-Light.ttf in Resources */, EE76B85621D8D1930093571F /* SourceSansPro-Bold.ttf in Resources */, EE76B85921D8D1930093571F /* SourceSansPro-Black.ttf in Resources */, @@ -516,18 +543,22 @@ EE07A45221E23E92006031C8 /* MainVCDelegate.swift in Sources */, EE377EC521E8F47100138385 /* PassphraseVC.swift in Sources */, EE57702621CFFDDB00433CAB /* ZWButtom.swift in Sources */, + EE377EEB21F7AF3C00138385 /* TrxDetailTableViewCell.swift in Sources */, EE377EDA21F4BE5500138385 /* TrxHistoryProvider.swift in Sources */, EE07A46E21E3E71B006031C8 /* OnboardingCoordinator.swift in Sources */, EE377ED821F485FB00138385 /* HomeCoordinator.swift in Sources */, EE07A46C21E29EA4006031C8 /* BaseCoordinator.swift in Sources */, EE57702B21D0230C00433CAB /* ZWProgressBar.swift in Sources */, + EE377EED21F7B02600138385 /* TrxMemoTableViewCell.swift in Sources */, EE57702921D0011400433CAB /* Colors.swift in Sources */, - EE377EE621F4F1C400138385 /* TrxHistoryObserver.swift in Sources */, - EE377EE421F4F1A100138385 /* TrxDetail.swift in Sources */, + EE377EE621F4F1C400138385 /* TrxHistoryObservable.swift in Sources */, + EE377EE421F4F1A100138385 /* TrxDetails.swift in Sources */, EE377ECB21E8F71700138385 /* PassphraseEntryMode.swift in Sources */, EE377EB321E5303E00138385 /* ViewFactory.swift in Sources */, EE07A47221E3EACE006031C8 /* OnboardingCoordinator.Delegate.swift in Sources */, + EE377EF321FE181000138385 /* Date-Extension.swift in Sources */, EE07A45521E24FDD006031C8 /* Localization.swift in Sources */, + EE377EE921F7A76500138385 /* TrxDetailsVC.swift in Sources */, EE576FFE21CFCC5500433CAB /* AppDelegate.swift in Sources */, EE377EC021E7D92200138385 /* PinEntryMode.swift in Sources */, EE377EB721E6831E00138385 /* CreateNewWalletCoordinator.Delegate.swift in Sources */, @@ -538,6 +569,7 @@ EE377EC221E7DFD200138385 /* Constants.swift in Sources */, EE377EC921E8F67000138385 /* PassphraseVCDelegate.swift in Sources */, EE07A45721E26E88006031C8 /* IocContainer.swift in Sources */, + EE377EF121FDEE3F00138385 /* ZEC.swift in Sources */, EE377ED221F47E1400138385 /* HomeVC.swift in Sources */, EE377ED621F4835F00138385 /* HomeVCDelegate.swift in Sources */, EE377EBE21E68C0B00138385 /* PinVCDelegate.swift in Sources */, diff --git a/ZWallet/Definitions/Colors.swift b/ZWallet/Definitions/Colors.swift index ecd5e2f..d5bbefc 100644 --- a/ZWallet/Definitions/Colors.swift +++ b/ZWallet/Definitions/Colors.swift @@ -31,4 +31,8 @@ public class Colors { background: Colors.zwalletColor, border: Colors.zwalletColor, text: .white) + + public static let trxDetailReceivedBackgroundColor = UIColor(red: 0.15, green: 0.7, blue: 0.32, alpha: 1) + + public static let trxDetailSentBackgroundColor = UIColor(red: 0.87, green: 0.07, blue: 0.13, alpha: 1) } diff --git a/ZWallet/Definitions/Constants.swift b/ZWallet/Definitions/Constants.swift index 2554fcb..3aad3b0 100644 --- a/ZWallet/Definitions/Constants.swift +++ b/ZWallet/Definitions/Constants.swift @@ -12,5 +12,8 @@ import Foundation internal class Constants { public static let pinCodeLength = 6 - + + public static let atomicUnitsPerZec: UInt64 = 1_000_000_000_000 + public static let numberOfFractionDigits: Int = 12 + public static let prettyPrintNumberOfFractionDigits = 7 } diff --git a/ZWallet/Extensions/Date-Extension.swift b/ZWallet/Extensions/Date-Extension.swift new file mode 100644 index 0000000..16d944b --- /dev/null +++ b/ZWallet/Extensions/Date-Extension.swift @@ -0,0 +1,29 @@ +// +// Date-Extension.swift +// ZWallet +// +// Created by loj on 27.01.19. +// Copyright © 2019 XMR Systems LLC. All rights reserved. +// + +import Foundation + + +extension Date { + + /// Formatted date and time + public func dateAndTime() -> String { + let df = DateFormatter() + df.dateStyle = .medium + df.timeStyle = .medium + return df.string(from: self) + } + + /// Formatted time in HH:mm + public func time() -> String { + let df = DateFormatter() + df.dateStyle = .none + df.timeStyle = .medium + return df.string(from: self) + } +} diff --git a/ZWallet/Infrastructure/de.lproj/InfoPlist.strings b/ZWallet/Infrastructure/de.lproj/InfoPlist.strings index aaa96b1..32a89d6 100644 --- a/ZWallet/Infrastructure/de.lproj/InfoPlist.strings +++ b/ZWallet/Infrastructure/de.lproj/InfoPlist.strings @@ -18,11 +18,35 @@ "pin.description.confirmPin" = "Du kennst das. Wiederhole den PIN aus dem letzten Schritt um diesen zu bestätigen."; +"passphrase.title.initialPassphrase" = "Wähle ein Passwort"; + +"passphrase.description.initialPassphrase" = "Bitte wähle ein Passwort um das Backup deiner Wallet zu verschlüsseln. Deine Backups werden in deinem iCloud Nutzerkonto gespeichert. Falls du dein Passwort vergisst kann deine Wallet nicht wiederhergestellt werden."; + "passphrase.next" = "Weiter"; +"passphrase.placeholder.initialPassphrase" = "Passwort"; + +"passphrase.title.confirmPassphrase" = "Bestätige Passwort"; + +"passphrase.description.confirmPassphrase" = "Wiederhole dein Passwort und notiere es *exakt so wie du es hier eingibst* auf einem Blatt Papier. Anschliessend versorge dieses Papier an einem sicheren Ort. Zeige es niemandem und rede nicht darüber."; + +"passphrase.placeholder.confirmPassphrase" = "Wiederhole dein Passwort"; + +"passphrase.mismatch.title" = "Passwort ungleich"; + "global.Ok" = "Ok"; -"trxDetailCell.received" = "Empfangen"; +"trxDetail.received" = "Empfangen"; -"trxDetailCell.sent" = "Gesendet"; +"trxDetail.sent" = "Gesendet"; + +"trxDetail.date" = "Datum"; + +"trxDetail.sourceAddress" = "Von Adresse"; + +"trxDetail.trxId" = "Transaktions-ID"; + +"trxDetail.memo" = "Anmerkung"; + +"trxDetail.destinationAddress" = "Nach Adresse"; diff --git a/ZWallet/Infrastructure/en.lproj/InfoPlist.strings b/ZWallet/Infrastructure/en.lproj/InfoPlist.strings index 8801ce7..4fe2fd0 100644 --- a/ZWallet/Infrastructure/en.lproj/InfoPlist.strings +++ b/ZWallet/Infrastructure/en.lproj/InfoPlist.strings @@ -36,7 +36,17 @@ "global.Ok" = "Ok"; -"trxDetailCell.received" = "Received"; +"trxDetail.received" = "Received"; -"trxDetailCell.sent" = "Sent"; +"trxDetail.sent" = "Sent"; + +"trxDetail.date" = "Date"; + +"trxDetail.sourceAddress" = "From Address"; + +"trxDetail.trxId" = "Transaction ID"; + +"trxDetail.memo" = "Memo"; + +"trxDetail.destinationAddress" = "To Address"; diff --git a/ZWallet/Services/TrxHistoryProvider.swift b/ZWallet/Services/TrxHistoryProvider.swift index 677c1ac..574b35c 100644 --- a/ZWallet/Services/TrxHistoryProvider.swift +++ b/ZWallet/Services/TrxHistoryProvider.swift @@ -10,30 +10,30 @@ import Foundation public protocol TrxHistoryProviderProtocol: class { - func add(trxDetail: TrxDetail) - func all() -> [TrxDetail] + func add(trxDetails: TrxDetails) + func all() -> [TrxDetails] func count() -> Int - func register(observer: TrxHistoryObserver) - func deregister(observer: TrxHistoryObserver) + func register(observer: TrxHistoryObservable) + func deregister(observer: TrxHistoryObservable) } public class TrxHistoryProvider: TrxHistoryProviderProtocol { - private var trxHistory: [TrxDetail] - private var observers: [TrxHistoryObserver] + private var trxHistory: [TrxDetails] + private var observers: [TrxHistoryObservable] public init() { - self.trxHistory = [TrxDetail]() - self.observers = [TrxHistoryObserver]() + self.trxHistory = [TrxDetails]() + self.observers = [TrxHistoryObservable]() } - public func add(trxDetail: TrxDetail) { - self.trxHistory.append(trxDetail) + public func add(trxDetails: TrxDetails) { + self.trxHistory.append(trxDetails) self.notifyAllObservers() } - public func all() -> [TrxDetail] { + public func all() -> [TrxDetails] { return self.trxHistory } @@ -41,11 +41,11 @@ public class TrxHistoryProvider: TrxHistoryProviderProtocol { return self.trxHistory.count } - public func register(observer: TrxHistoryObserver) { + public func register(observer: TrxHistoryObservable) { self.observers.append(observer) } - public func deregister(observer: TrxHistoryObserver) { + public func deregister(observer: TrxHistoryObservable) { self.observers = self.observers.filter { $0 !== observer } } diff --git a/ZWallet/Services/ViewFactory.swift b/ZWallet/Services/ViewFactory.swift index 5af2ab0..72361dd 100644 --- a/ZWallet/Services/ViewFactory.swift +++ b/ZWallet/Services/ViewFactory.swift @@ -24,6 +24,7 @@ internal protocol ViewFactoryProtocol { func getPinView() -> PinVC func getPassphraseView() -> PassphraseVC func getHomeView() -> HomeVC + func getTrxDetailsView() -> TrxDetailsVC } @@ -45,6 +46,10 @@ internal class ViewFactory: ViewFactoryProtocol { return UIStoryboard(name: "Home", bundle: nil) }() + private lazy var trxDetailsStoryboard: UIStoryboard = { + return UIStoryboard(name: "TrxDetails", bundle: nil) + }() + func getOnboardingMainView() -> MainVC { let vc = self.mainStoryboard.instantiateViewController(withIdentifier: "Main") as! MainVC return vc @@ -64,4 +69,9 @@ internal class ViewFactory: ViewFactoryProtocol { let vc = self.homeStoryboard.instantiateViewController(withIdentifier: "Home") as! HomeVC return vc } + + func getTrxDetailsView() -> TrxDetailsVC { + let vc = self.trxDetailsStoryboard.instantiateViewController(withIdentifier: "TrxDetails") as! TrxDetailsVC + return vc + } } diff --git a/ZWallet/Storyboards/Home.storyboard b/ZWallet/Storyboards/Home.storyboard index 2da1a64..63b1468 100644 --- a/ZWallet/Storyboards/Home.storyboard +++ b/ZWallet/Storyboards/Home.storyboard @@ -29,7 +29,7 @@ - + @@ -57,9 +57,9 @@