From a62d5eefcb8b66e2d4ffddbd5c99b313b2845d58 Mon Sep 17 00:00:00 2001 From: Ermat Date: Fri, 21 Dec 2018 18:33:40 +0600 Subject: [PATCH] Apply new design for Transactions and Transaction Info modules (#247) --- .../BankWallet.xcodeproj/project.pbxproj | 24 +++++ .../Contents.json | 22 ++++ .../statusSuccess@2x.png | Bin 0 -> 1056 bytes .../statusSuccess@3x.png | Bin 0 -> 1545 bytes .../Contents.json | 22 ++++ .../statusPending@2x.png | Bin 0 -> 1395 bytes .../statusPending@3x.png | Bin 0 -> 2175 bytes .../TransactionViewItemFactory.swift | 2 +- .../TransactionInfoAlertModel.swift | 19 ++-- .../ViewItems/TransactionAmountItem.swift | 19 ++-- .../ViewItems/TransactionAmountItemView.swift | 27 ++--- .../TransactionFromToHashItemView.swift | 6 +- .../ViewItems/TransactionStatusItem.swift | 31 +++--- .../ViewItems/TransactionStatusItemView.swift | 65 ++++------- .../ViewItems/TransactionTitleItem.swift | 9 +- .../ViewItems/TransactionTitleItemView.swift | 26 ++--- .../ViewItems/TransactionValueItem.swift | 16 +++ .../ViewItems/TransactionValueItemView.swift | 45 ++++++++ .../Transactions/TransactionsModule.swift | 4 +- .../Transactions/Views/TransactionCell.swift | 102 +++++++++++------- .../Theme/TransactionInfoTheme.swift | 22 ++-- .../BankWallet/Theme/TransactionsTheme.swift | 12 ++- .../Controls/BarsProgressView.swift | 55 ++++++++++ .../UserInterface/ValueFormatter.swift | 29 ++--- .../BankWallet/en.lproj/Localizable.strings | 10 +- .../TransactionViewItemFactoryTests.swift | 4 +- 26 files changed, 367 insertions(+), 204 deletions(-) create mode 100644 BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Completed Icon.imageset/Contents.json create mode 100644 BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Completed Icon.imageset/statusSuccess@2x.png create mode 100644 BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Completed Icon.imageset/statusSuccess@3x.png create mode 100644 BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Pending Icon.imageset/Contents.json create mode 100644 BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Pending Icon.imageset/statusPending@2x.png create mode 100644 BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Pending Icon.imageset/statusPending@3x.png create mode 100644 BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionValueItem.swift create mode 100644 BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionValueItemView.swift create mode 100644 BankWallet/BankWallet/UserInterface/Controls/BarsProgressView.swift diff --git a/BankWallet/BankWallet.xcodeproj/project.pbxproj b/BankWallet/BankWallet.xcodeproj/project.pbxproj index ccf523e8a7..d84cc2830a 100644 --- a/BankWallet/BankWallet.xcodeproj/project.pbxproj +++ b/BankWallet/BankWallet.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 11B350B7FE5660DE0BD3DA64 /* Satoshi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3522E7181FB5F0A647944 /* Satoshi.swift */; }; 11B350BDE65AE8059EB84D67 /* BackupConfirmationAlertModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35DFF5136FA50CB5FBCA6 /* BackupConfirmationAlertModel.swift */; }; 11B350D872DA13413A850044 /* SendAmountItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35A56B7E8B8CCA04266B2 /* SendAmountItemView.swift */; }; + 11B350E923A4E51AAF9D2828 /* BarsProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35A686DD5BA335FEB6BEB /* BarsProgressView.swift */; }; 11B350F7731A09AC00AB8DC4 /* SendFeeItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B357B45FC7216E5D1BA309 /* SendFeeItem.swift */; }; 11B350FE91BF2919D84DFCE9 /* UnlinkButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3595B61F6978D745D9776 /* UnlinkButtonItem.swift */; }; 11B351147B9FA7CFB61D6F31 /* TransactionViewItemFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35461B70501F290DFC166 /* TransactionViewItemFactoryTests.swift */; }; @@ -61,6 +62,7 @@ 11B353FA170E276850F994F1 /* BaseCurrencySettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35E4481DCD98BF2074797 /* BaseCurrencySettingsViewController.swift */; }; 11B3541F6B5316F3B373D1EA /* ValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35EFB45ECC2D403CA6C89 /* ValueFormatter.swift */; }; 11B3542C6A82191F2384F5B9 /* AlertButtonItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3566164D1D7C7898132E2 /* AlertButtonItemView.swift */; }; + 11B35433045DD100592EF633 /* TransactionValueItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B353A2F8FFE93DC7E58F98 /* TransactionValueItem.swift */; }; 11B3544601D94D63EC87FE26 /* Currency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B356DF243F6B9248E6AD42 /* Currency.swift */; }; 11B3546128004E2E5F3CD23A /* RestorePresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35BAEE22C144B33661819 /* RestorePresenter.swift */; }; 11B354A12A3BF8521C417171 /* SendAddressItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35AC7305FD5CEB5690DD9 /* SendAddressItemView.swift */; }; @@ -83,6 +85,8 @@ 11B355D7142B6A76B6A3502E /* BalanceInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3511175F5F85BE5677E1A /* BalanceInteractor.swift */; }; 11B355D74C9D67C254B90297 /* IndexedInputField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35C8856A137E92441AF19 /* IndexedInputField.swift */; }; 11B355EC3FC64AAB8F417078 /* BaseCurrencySettingsRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35F3E6B957ECFF5D1CE2E /* BaseCurrencySettingsRouter.swift */; }; + 11B355F7D6BA626065AC1C22 /* TransactionValueItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B353A2F8FFE93DC7E58F98 /* TransactionValueItem.swift */; }; + 11B355FF37740FA524EBD1AF /* TransactionValueItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B352DC7180DECC0ACE5EBE /* TransactionValueItemView.swift */; }; 11B3562C214D0245D43DFDE4 /* TransactionViewItemFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3569AD3ABD5F26CB51506 /* TransactionViewItemFactory.swift */; }; 11B3562F64946DE3E95788EE /* BaseCurrencySettingsInteractorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3581BC59DE52C60AED5F5 /* BaseCurrencySettingsInteractorTests.swift */; }; 11B35669B7CAC5A76825BD9C /* NumPadTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35BFD94DA13D66AD6A86D /* NumPadTheme.swift */; }; @@ -108,6 +112,7 @@ 11B357941D6FFB7AEF9CB45F /* TestExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B351C72700B40AB457AFA8 /* TestExtensions.swift */; }; 11B357CFFB630DFC08549D44 /* LanguageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B357C9E0AA5CE75C3CC825 /* LanguageCell.swift */; }; 11B357FF0E2440D91193C476 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3535DD03F9264351E13A9 /* NetworkManager.swift */; }; + 11B35807029DA6882DBAAF0C /* BarsProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35A686DD5BA335FEB6BEB /* BarsProgressView.swift */; }; 11B358174F4EECAD3CE3F293 /* BaseCurrencySettingsPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35B7A44754508AEFDA9FD /* BaseCurrencySettingsPresenter.swift */; }; 11B3581B212DB1B428F85501 /* Rate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35BBAAAE1A3981B902E89 /* Rate.swift */; }; 11B3581B5F15B9F806F1CA8F /* BaseCurrencySettingsPresenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B359DA37B619C35AF93D2A /* BaseCurrencySettingsPresenterTests.swift */; }; @@ -124,6 +129,7 @@ 11B358B9171642B3FF30CD0B /* RealmStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B354A7AB2C1276AAAAE9E6 /* RealmStorage.swift */; }; 11B358BCBAF4A9C9233C3FC0 /* SendConfirmationAddressItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3522F9D6DB1D04EA92CCE /* SendConfirmationAddressItem.swift */; }; 11B358C53045F204FA0D12FB /* TransactionRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B356738853E2305B5CC34B /* TransactionRecord.swift */; }; + 11B358C978B24F3B6E3728C4 /* TransactionValueItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B353A2F8FFE93DC7E58F98 /* TransactionValueItem.swift */; }; 11B358CB49FDCC89DBCD6449 /* RealmStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B354A7AB2C1276AAAAE9E6 /* RealmStorage.swift */; }; 11B358CB8E47D049CC361084 /* ConfirmationCheckboxItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35EC60329833B8D6CA1E0 /* ConfirmationCheckboxItem.swift */; }; 11B358EB4EC30EDFFEBFCF29 /* CoinManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35570FD93AFB406434D20 /* CoinManager.swift */; }; @@ -212,8 +218,10 @@ 11B35E846A0F60A4BCF77B3B /* CurrencyManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3592BB989584CB1E4129B /* CurrencyManagerTests.swift */; }; 11B35E9C0E8F38C063A48367 /* BackupPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B355771A1D96DB96FBC975 /* BackupPresenter.swift */; }; 11B35E9D76B0EFAC4B49AB2A /* SendAmountItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B359DEE539B7406C382B80 /* SendAmountItem.swift */; }; + 11B35EBB0DC7C0CE6F51E9DA /* BarsProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35A686DD5BA335FEB6BEB /* BarsProgressView.swift */; }; 11B35EBB724E7ECC932BC762 /* BackupConfirmationAlertModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35DFF5136FA50CB5FBCA6 /* BackupConfirmationAlertModel.swift */; }; 11B35EC72662D83DF2D55438 /* AppConfigProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B358A2ED820E5741F0701A /* AppConfigProvider.swift */; }; + 11B35EC8DCB3ADAFA79ECC17 /* TransactionValueItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B352DC7180DECC0ACE5EBE /* TransactionValueItemView.swift */; }; 11B35ECFA9C3E5FA6DE0646D /* ReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35788190D05AF5DBB9072 /* ReachabilityManager.swift */; }; 11B35EF16E8F5AEE9336AE30 /* NumPadTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35BFD94DA13D66AD6A86D /* NumPadTheme.swift */; }; 11B35EF8F8B8F43987CC121C /* BaseCurrencySettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35E4481DCD98BF2074797 /* BaseCurrencySettingsViewController.swift */; }; @@ -223,6 +231,7 @@ 11B35F2D49204D34BA6C4EDB /* AlertButtonItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3566164D1D7C7898132E2 /* AlertButtonItemView.swift */; }; 11B35F318E009D7BCCCE1E1B /* WalletManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B357F5E2BDAAAE4E5446E3 /* WalletManager.swift */; }; 11B35F56DE01B03CCFB49E32 /* BackupInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B353A3B460BF1B24349F9F /* BackupInteractor.swift */; }; + 11B35F6A886EBB725C3FA31F /* TransactionValueItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B352DC7180DECC0ACE5EBE /* TransactionValueItemView.swift */; }; 11B35F8641C2F7F7FB23B181 /* GuestInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B3566ED622AE7606EF76B9 /* GuestInteractor.swift */; }; 11B35FACF36A8A986D01D1FC /* PeriodicTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B35FA1C1FF965AA2EB6666 /* PeriodicTimer.swift */; }; 11B35FAE71A2259D4E4CBF0C /* SendConfirmationAmountItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B356AA9A3DDA541D5EBEAC /* SendConfirmationAmountItemView.swift */; }; @@ -894,8 +903,10 @@ 11B352A3792AA46E98DDE5B6 /* SendStateViewItemFactoryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendStateViewItemFactoryTests.swift; sourceTree = ""; }; 11B352D114BED753EEBA8B8D /* BitcoinAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BitcoinAdapter.swift; sourceTree = ""; }; 11B352D314A298B6B832F309 /* EthereumAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EthereumAdapter.swift; sourceTree = ""; }; + 11B352DC7180DECC0ACE5EBE /* TransactionValueItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionValueItemView.swift; sourceTree = ""; }; 11B3535DD03F9264351E13A9 /* NetworkManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = ""; }; 11B3535FC407BA20765EBCF4 /* KeyboardObservingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardObservingViewController.swift; sourceTree = ""; }; + 11B353A2F8FFE93DC7E58F98 /* TransactionValueItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionValueItem.swift; sourceTree = ""; }; 11B353A3B460BF1B24349F9F /* BackupInteractor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackupInteractor.swift; sourceTree = ""; }; 11B353D57AB36A9CF4DEE090 /* GuestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GuestViewController.swift; sourceTree = ""; }; 11B353F1BD63011E1D536631 /* WalletNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WalletNavigationController.swift; sourceTree = ""; }; @@ -955,6 +966,7 @@ 11B35A56B7E8B8CCA04266B2 /* SendAmountItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendAmountItemView.swift; sourceTree = ""; }; 11B35A5DE20DD6DD486FAFC0 /* Protocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Protocols.swift; sourceTree = ""; }; 11B35A65D7F2EADB3618DA64 /* RandomManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RandomManager.swift; sourceTree = ""; }; + 11B35A686DD5BA335FEB6BEB /* BarsProgressView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarsProgressView.swift; sourceTree = ""; }; 11B35AC7305FD5CEB5690DD9 /* SendAddressItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendAddressItemView.swift; sourceTree = ""; }; 11B35ADA6828A0EF11976938 /* GuestRouter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GuestRouter.swift; sourceTree = ""; }; 11B35ADD30196056A9C6407C /* WordsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WordsManager.swift; sourceTree = ""; }; @@ -1564,6 +1576,7 @@ 11B35C8856A137E92441AF19 /* IndexedInputField.swift */, 11B3570598EDE26F96BC5F41 /* RespondButton.swift */, 11B35F53002A95B923B397AE /* NumPad.swift */, + 11B35A686DD5BA335FEB6BEB /* BarsProgressView.swift */, ); path = Controls; sourceTree = ""; @@ -1982,6 +1995,8 @@ 1A564E1F405D2D57FBC9E799 /* TransactionFromToHashItemView.swift */, 1A564181733CBC44EECFBBF3 /* TransactionCloseItem.swift */, 1A564B27FBA16D9EA22F0944 /* TransactionCloseItemView.swift */, + 11B353A2F8FFE93DC7E58F98 /* TransactionValueItem.swift */, + 11B352DC7180DECC0ACE5EBE /* TransactionValueItemView.swift */, ); path = ViewItems; sourceTree = ""; @@ -2920,6 +2935,9 @@ 1A5645DFFB1EC95815289D1F /* CurrentDateProvider.swift in Sources */, 1A5647C0909A28BECA342148 /* LockoutView.swift in Sources */, 1A564375773F7977B14EF1E0 /* Coin.swift in Sources */, + 11B35807029DA6882DBAAF0C /* BarsProgressView.swift in Sources */, + 11B355F7D6BA626065AC1C22 /* TransactionValueItem.swift in Sources */, + 11B35F6A886EBB725C3FA31F /* TransactionValueItemView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3211,6 +3229,9 @@ 1A56424C8E4017689EFF5D6D /* CurrentDateProvider.swift in Sources */, 1A5647481AAB5BF5A86F9829 /* LockoutView.swift in Sources */, 1A564E286A1C980C944A63A9 /* Coin.swift in Sources */, + 11B35EBB0DC7C0CE6F51E9DA /* BarsProgressView.swift in Sources */, + 11B358C978B24F3B6E3728C4 /* TransactionValueItem.swift in Sources */, + 11B355FF37740FA524EBD1AF /* TransactionValueItemView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3462,6 +3483,9 @@ 1A564E374CD439E2C1334208 /* CurrentDateProvider.swift in Sources */, 1A5645EDCB2C77F13BFEB1E2 /* LockoutView.swift in Sources */, 1A564A7ECB966C4711CA1A86 /* Coin.swift in Sources */, + 11B350E923A4E51AAF9D2828 /* BarsProgressView.swift in Sources */, + 11B35433045DD100592EF633 /* TransactionValueItem.swift in Sources */, + 11B35EC8DCB3ADAFA79ECC17 /* TransactionValueItemView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Completed Icon.imageset/Contents.json b/BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Completed Icon.imageset/Contents.json new file mode 100644 index 0000000000..4ab852ffc8 --- /dev/null +++ b/BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Completed Icon.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "statusSuccess@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "statusSuccess@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Completed Icon.imageset/statusSuccess@2x.png b/BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Completed Icon.imageset/statusSuccess@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..58c3426860033b4882e1d39ac757b28fb88adba4 GIT binary patch literal 1056 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 BolF1# literal 0 HcmV?d00001 diff --git a/BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Pending Icon.imageset/statusPending@3x.png b/BankWallet/BankWallet/Assets.xcassets/Transactions/Transaction Info Pending Icon.imageset/statusPending@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..89d5ca65112e06db039238b9eca750e14f997531 GIT binary patch literal 2175 zcmV-_2!QvAP)Px-IY~r8RCodHTwQDwRTQ4t-TrOTGzeA=uSDd{-yjM8^Z|nr1Nw&10BLmf!9v^J zK8Ydn)-Bso6HJ8$iALU3B8f&Z_(P(N`m9ZOHIfQxYO!V8-5tNPGn1X2Irq-b&TMzd zOtPJsbMHO(JKvo9GxwgUqQpncK+HhQK+HhQK)W)aHXHcN%uIS|skmEJ%a5V%?V6@; z$N7HzdKE>(j}CPif9Q8ZRkeAX=QS<)dtYDIwM-_ng8QZ&O(7_s|Daz{?!2OD%FD29 zCw`p)EnGvnIaO6YQ?>1I+0NF z+3c|&y%q7FD-wcEojN^Gsc7$Mnzq|NB>yE;RlSCXa6FeA{@#CSd5KU7nw*?@V10e{ z6u=&oR~uETda*;9n5BjzY18su2?7p zp|2T5lNyKSM4fiQ4LaFXj9%Yjgu1F}i9b`R)b-9zZLz<HIN z{S4YO`&JJ5Y%@nIJ9xKy!bTXmd}I^Z#-&+ht^}1zm8`Wu?OI)-Nnq{1HLrAx)!DoQ zpxCxrRw+UHN?>)dt5%|RRcOVgRfDHr85j$8xqh$h)otWcNh&3XmPwI^nQg0!^ll|q z+gd5z-HAM2au*p?u&rt%lcbBJ1YrcAHDt#@Z{=aVcsi6vAiz7=zxqmoQ@O}SGpCRs zT3$dVT3}}m4a*kob_g-=G;C!J5)wpPGbrKMeZc%-mDY1uZ7nP$%!HkR*lF0xBuV-p zW8cbAh*kpqE_OMTY=D3;6Lzj@k*$SzF00Awgi9EktX` zZNi5GrU<*pRw+S9r0rnGK@02-VVejf*jZc2ETIP>&DbZex1M$%>LtxvGcZ)RT6@tG1{lrN5dw`XZCgalDc zAO{j`?~%Rza%KF;jOLbcA?aZ>H(x6Xgqg5&SVXo`ULipgFo|@E39LJ?e$t~yS=5O` zy)j9G(hoVscq{)enM}OHrHN#OnXohIYlf{%l7t}Rja{&nt0Md)+Ji_!pY$ebsUt}z zC;7t2$j}e|5C}2P$yO(X9z>M`45CS$2gT=52#PZ$T#22epyUu%J*LQsPh_K+Q%Vqp z+9G4g%v?Kbn~eCJnkb?x3rVL@#XkR@qbNF7HsA`jRc#cacip)hAD{XXK}!3a8fe?6 zXIrc9Y#4#1*ZDvz_43%*u@{}T)g&$+giZ=^$hGX&D=odgzH-7UX~kEBuB@k9ruFI6G5Y+N3jmAQVg`?z}#YMskHhz1ur=g zH%LHO2oquBA*dI(xgqaTqY=1Eve;cMh9nyq=lJ4fmoH-j68z2l2Faak;5;q~R5z zbxjE*M_mXcR~$pRi49&&(e@eh-p@IZ2T=v_rwATsjz4DcKoVt%KZo)_)ZO|)o#%<7 z8%Gr0PZ8{*8Mj;caMJ0M%=8XFpBlK;8@Q8}DW<@45OorxoZ|&oRxW57y?Elyu=PLc zwHrur$a<)4bf1N%Qi+Kmi)ePNqWefZ$X?mh)YN_J>)JugRVXNwX1b2hK6@F#J#8Y~ zJ^xsMGm^Gn+UZ|Ya5luUn1Psqn1Psqn1S|S;D1O%vtWm(v)ljx002ovPDHLkV1nHl B6@>r* literal 0 HcmV?d00001 diff --git a/BankWallet/BankWallet/Core/Factories/TransactionViewItemFactory.swift b/BankWallet/BankWallet/Core/Factories/TransactionViewItemFactory.swift index d525304306..53931bb688 100644 --- a/BankWallet/BankWallet/Core/Factories/TransactionViewItemFactory.swift +++ b/BankWallet/BankWallet/Core/Factories/TransactionViewItemFactory.swift @@ -40,7 +40,7 @@ extension TransactionViewItemFactory: ITransactionViewItemFactory { if confirmations >= threshold { status = .completed } else { - status = .processing(progress: Double(confirmations) / Double(threshold)) + status = .processing(confirmations: confirmations) } } diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/TransactionInfoAlertModel.swift b/BankWallet/BankWallet/Modules/TransactionInfo/TransactionInfoAlertModel.swift index 5ffc76ea09..b25c1b38b1 100644 --- a/BankWallet/BankWallet/Modules/TransactionInfo/TransactionInfoAlertModel.swift +++ b/BankWallet/BankWallet/Modules/TransactionInfo/TransactionInfoAlertModel.swift @@ -13,28 +13,33 @@ class TransactionInfoAlertModel: BaseAlertModel { hideInBackground = false if let item = delegate.transactionViewItem(forTransactionHash: transactionHash) { - let titleItem = TransactionTitleItem(item: item, tag: 0, required: true, onIdTap: { + let titleItem = TransactionTitleItem(item: item, tag: 0, onIdTap: { delegate.onCopy(value: item.transactionHash) }) addItemView(titleItem) - let amountItem = TransactionAmountItem(item: item, tag: 1, required: true) + let amountItem = TransactionAmountItem(item: item, tag: 1) addItemView(amountItem) + if let date = item.date { + let timeItem = TransactionValueItem(title: "tx_info.time".localized, value: DateHelper.instance.formatTransactionInfoTime(from: date), tag: 2) + addItemView(timeItem) + } + + let statusItem = TransactionStatusItem(item: item, tag: 3) + addItemView(statusItem) + if let from = item.from { - addItemView(TransactionFromToHashItem(title: "tx_info.from_hash".localized, value: from, tag: 2, required: true, onHashTap: { + addItemView(TransactionFromToHashItem(title: "tx_info.from_hash".localized, value: from, tag: 4, required: true, onHashTap: { delegate.onCopy(value: from) })) } if let to = item.to { - addItemView(TransactionFromToHashItem(title: "tx_info.to_hash".localized, value: to, tag: 3, required: true, onHashTap: { + addItemView(TransactionFromToHashItem(title: "tx_info.to_hash".localized, value: to, tag: 5, required: true, onHashTap: { delegate.onCopy(value: to) })) } - - let statusItem = TransactionStatusItem(item: item, tag: 4, required: true) - addItemView(statusItem) } let closeItem = TransactionCloseItem(tag: 5, required: true, onTap: { [weak self] in diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionAmountItem.swift b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionAmountItem.swift index 3059fabf44..9f7a85adfc 100644 --- a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionAmountItem.swift +++ b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionAmountItem.swift @@ -3,21 +3,18 @@ import GrouviActionSheet class TransactionAmountItem: BaseActionItem { + var currencyAmount: String? + var currencyAmountColor: UIColor var amount: String? - var amountColor: UIColor - var fiatAmount: String - init(item: TransactionViewItem, tag: Int? = nil, hidden: Bool = false, required: Bool = false) { - amount = ValueFormatter.instance.format(coinValue: item.coinValue, explicitSign: true) - amountColor = item.incoming ? TransactionInfoTheme.incomingAmountColor : TransactionInfoTheme.outgoingAmountColor - - if let value = item.currencyValue, let formattedValue = ValueFormatter.instance.format(currencyValue: value, approximate: true) { - self.fiatAmount = formattedValue - } else { - self.fiatAmount = "n/a" + init(item: TransactionViewItem, tag: Int? = nil) { + if let value = item.currencyValue, let formattedValue = ValueFormatter.instance.format(currencyValue: value) { + currencyAmount = formattedValue } + currencyAmountColor = item.incoming ? TransactionInfoTheme.incomingAmountColor : TransactionInfoTheme.outgoingAmountColor + amount = ValueFormatter.instance.format(coinValue: item.coinValue) - super.init(cellType: TransactionAmountItemView.self, tag: tag, hidden: hidden, required: required) + super.init(cellType: TransactionAmountItemView.self, tag: tag, required: true) height = TransactionInfoTheme.amountHeight } diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionAmountItemView.swift b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionAmountItemView.swift index 468cbefb4c..2a57d5dbda 100644 --- a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionAmountItemView.swift +++ b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionAmountItemView.swift @@ -5,8 +5,8 @@ import SnapKit class TransactionAmountItemView: BaseActionItemView { + var currencyAmountLabel = UILabel() var amountLabel = UILabel() - var fiatAmountLabel = UILabel() override var item: TransactionAmountItem? { return _item as? TransactionAmountItem } @@ -15,28 +15,29 @@ class TransactionAmountItemView: BaseActionItemView { backgroundColor = TransactionInfoTheme.itemBackground - amountLabel.font = TransactionInfoTheme.amountFont - addSubview(amountLabel) - amountLabel.snp.makeConstraints { maker in + currencyAmountLabel.font = TransactionInfoTheme.amountFont + addSubview(currencyAmountLabel) + currencyAmountLabel.snp.makeConstraints { maker in maker.centerX.equalToSuperview() - maker.top.equalToSuperview().offset(TransactionInfoTheme.amountTopMargin) + maker.top.equalToSuperview().offset(TransactionInfoTheme.regularMargin) } - fiatAmountLabel.font = TransactionInfoTheme.fiatAmountFont - fiatAmountLabel.textColor = TransactionInfoTheme.fiatAmountColor - addSubview(fiatAmountLabel) - fiatAmountLabel.snp.makeConstraints { maker in + amountLabel.font = TransactionInfoTheme.fiatAmountFont + amountLabel.textColor = TransactionInfoTheme.fiatAmountColor + addSubview(amountLabel) + amountLabel.snp.makeConstraints { maker in maker.centerX.equalToSuperview() - maker.top.equalTo(self.amountLabel.snp.bottom).offset(TransactionInfoTheme.middleMargin) + maker.bottom.equalToSuperview().offset(-TransactionInfoTheme.regularMargin) } } override func updateView() { super.updateView() - amountLabel.text = item?.amount - amountLabel.textColor = item?.amountColor - fiatAmountLabel.text = item?.fiatAmount + currencyAmountLabel.text = item?.currencyAmount + currencyAmountLabel.textColor = item?.currencyAmountColor + + amountLabel.text = item?.amount } } diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionFromToHashItemView.swift b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionFromToHashItemView.swift index 783823f048..d389ef254b 100644 --- a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionFromToHashItemView.swift +++ b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionFromToHashItemView.swift @@ -36,7 +36,7 @@ class TransactionFromToHashItemView: BaseActionItemView { wrapperView.cornerRadius = TransactionInfoTheme.hashButtonCornerRadius addSubview(wrapperView) wrapperView.snp.makeConstraints { maker in - maker.leading.equalTo(self.titleLabel.snp.trailing).offset(TransactionInfoTheme.largeMargin) + maker.leading.equalTo(self.titleLabel.snp.trailing).offset(TransactionInfoTheme.hashButtonMargin) maker.centerY.equalToSuperview() maker.trailing.equalToSuperview().offset(-TransactionInfoTheme.regularMargin) maker.height.equalTo(TransactionInfoTheme.hashButtonHeight) @@ -48,8 +48,8 @@ class TransactionFromToHashItemView: BaseActionItemView { maker.centerY.equalToSuperview() } - valueLabel.font = TransactionInfoTheme.itemTitleFont - valueLabel.textColor = TransactionInfoTheme.hashButtonTextColor + valueLabel.font = TransactionInfoTheme.itemValueFont + valueLabel.textColor = TransactionInfoTheme.itemValueColor valueLabel.lineBreakMode = .byTruncatingMiddle wrapperView.addSubview(valueLabel) valueLabel.snp.makeConstraints { maker in diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionStatusItem.swift b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionStatusItem.swift index 026ffe8657..000e05c5a9 100644 --- a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionStatusItem.swift +++ b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionStatusItem.swift @@ -1,32 +1,25 @@ -import Foundation import GrouviActionSheet class TransactionStatusItem: BaseActionItem { + let title: String + var icon: UIImage? + var confirmations: Int? - var title: String? - var value: String? - var valueImage: UIImage? - var valueImageTintColor: UIColor? - var progress: Double? - - init(item: TransactionViewItem, tag: Int? = nil, hidden: Bool = false, required: Bool = false) { - super.init(cellType: TransactionStatusItemView.self, tag: tag, hidden: hidden, required: required) - + init(item: TransactionViewItem, tag: Int? = nil) { title = "tx_info.status".localized + super.init(cellType: TransactionStatusItemView.self, tag: tag, required: true) + switch item.status { case .pending: - value = "tx_info.pending".localized - valueImage = UIImage(named: "Transaction Processing Icon") - valueImageTintColor = TransactionInfoTheme.processingIconTintColor - case .processing(let progress): - value = "tx_info.processing".localized("\(Int(progress * 100))%") - self.progress = progress + icon = UIImage(named: "Transaction Info Pending Icon") + case .processing(let confirmations): + self.confirmations = confirmations case .completed: - value = "tx_info.completed".localized - valueImage = UIImage(named: "Transaction Success Icon") - valueImageTintColor = TransactionInfoTheme.successIconTintColor + icon = UIImage(named: "Transaction Info Completed Icon") } + + height = TransactionInfoTheme.itemHeight } } diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionStatusItemView.swift b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionStatusItemView.swift index eff63ecbef..64972ae917 100644 --- a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionStatusItemView.swift +++ b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionStatusItemView.swift @@ -4,11 +4,9 @@ import GrouviActionSheet import SnapKit class TransactionStatusItemView: BaseActionItemView { - - var titleLabel = UILabel() - var statusLabel = UILabel() - var progressView = UIView() - var statusImageView = TintImageView(image: nil, selectedImage: nil) + let titleLabel = UILabel() + let iconImageView = UIImageView() + let barsProgressView = BarsProgressView(count: 6, barWidth: TransactionInfoTheme.barsProgressBarWidth, color: TransactionInfoTheme.barsProgressColor, inactiveColor: TransactionInfoTheme.barsProgressInactiveColor) override var item: TransactionStatusItem? { return _item as? TransactionStatusItem } @@ -25,40 +23,17 @@ class TransactionStatusItemView: BaseActionItemView { maker.leading.equalToSuperview().offset(TransactionInfoTheme.regularMargin) } - let wrapperView = UIView() - wrapperView.backgroundColor = TransactionInfoTheme.hashButtonBackground - wrapperView.borderColor = TransactionInfoTheme.hashButtonBorderColor - wrapperView.borderWidth = 1 / UIScreen.main.scale - wrapperView.cornerRadius = TransactionInfoTheme.hashButtonCornerRadius - addSubview(wrapperView) - wrapperView.snp.makeConstraints { maker in - maker.leading.equalTo(self.titleLabel.snp.trailing).offset(TransactionInfoTheme.middleMargin) + addSubview(iconImageView) + iconImageView.snp.makeConstraints { maker in maker.centerY.equalToSuperview() maker.trailing.equalToSuperview().offset(-TransactionInfoTheme.regularMargin) - maker.height.equalTo(TransactionInfoTheme.hashButtonHeight) - } - - progressView.backgroundColor = .cryptoGreen20 - wrapperView.addSubview(progressView) - progressView.snp.makeConstraints { maker in - maker.top.bottom.leading.equalToSuperview() - maker.width.equalTo(0) } - statusLabel.font = TransactionInfoTheme.itemTitleFont - wrapperView.addSubview(statusLabel) - statusLabel.snp.makeConstraints { maker in + addSubview(barsProgressView) + barsProgressView.snp.makeConstraints { maker in maker.centerY.equalToSuperview() - maker.trailing.equalToSuperview().offset(-TransactionInfoTheme.middleMargin) - } - - wrapperView.addSubview(statusImageView) - statusImageView.snp.makeConstraints { maker in - maker.centerY.equalToSuperview() - maker.leading.equalToSuperview().offset(TransactionInfoTheme.middleMargin) - maker.trailing.equalTo(self.statusLabel.snp.leading).offset(0) - maker.width.equalTo(0) - maker.height.equalTo(TransactionInfoTheme.statusImageHeight) + maker.trailing.equalToSuperview().offset(-TransactionInfoTheme.regularMargin) + maker.height.equalTo(TransactionInfoTheme.barsProgressHeight) } } @@ -66,21 +41,19 @@ class TransactionStatusItemView: BaseActionItemView { super.updateView() titleLabel.text = item?.title - statusLabel.text = item?.value?.uppercased() - statusLabel.textColor = TransactionInfoTheme.hashButtonTextColor - statusImageView.image = item?.valueImage - statusImageView.tintColor = item?.valueImageTintColor - let hasImage = item?.valueImage != nil - statusImageView.snp.updateConstraints { maker in - maker.trailing.equalTo(self.statusLabel.snp.leading).offset(hasImage ? -TransactionInfoTheme.smallMargin : 0) - maker.width.equalTo(hasImage ? TransactionInfoTheme.statusImageWidth : 0) + if let icon = item?.icon { + iconImageView.isHidden = false + iconImageView.image = icon + } else { + iconImageView.isHidden = true } - let progress = item?.progress ?? 0 - progressView.snp.remakeConstraints { maker in - maker.top.bottom.leading.equalToSuperview() - maker.width.equalToSuperview().multipliedBy(progress) + if let confirmations = item?.confirmations { + barsProgressView.isHidden = false + barsProgressView.filledCount = confirmations + } else { + barsProgressView.isHidden = true } } diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionTitleItem.swift b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionTitleItem.swift index b9d080a212..a3d9273e1e 100644 --- a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionTitleItem.swift +++ b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionTitleItem.swift @@ -1,20 +1,15 @@ -import Foundation import GrouviActionSheet class TransactionTitleItem: BaseActionItem { - - let date: Date? let transactionId: String let onIdTap: (() -> ())? - - init(item: TransactionViewItem, tag: Int? = nil, hidden: Bool = false, required: Bool = false, onIdTap: (() -> ())? = nil) { - date = item.date + init(item: TransactionViewItem, tag: Int? = nil, onIdTap: (() -> ())? = nil) { transactionId = item.transactionHash self.onIdTap = onIdTap - super.init(cellType: TransactionTitleItemView.self, tag: tag, hidden: hidden, required: required) + super.init(cellType: TransactionTitleItemView.self, tag: tag, required: true) height = TransactionInfoTheme.titleHeight } diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionTitleItemView.swift b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionTitleItemView.swift index d0b4c1c98a..19735ca92a 100644 --- a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionTitleItemView.swift +++ b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionTitleItemView.swift @@ -5,30 +5,21 @@ import SnapKit class TransactionTitleItemView: BaseActionItemView { - var dateLabel = UILabel() - var idLabel = UILabel() + let titleLabel = UILabel() + let idLabel = UILabel() override var item: TransactionTitleItem? { return _item as? TransactionTitleItem } override func initView() { super.initView() - let titleLabel = UILabel() titleLabel.text = "tx_info.title".localized titleLabel.font = TransactionInfoTheme.titleFont titleLabel.textColor = TransactionInfoTheme.titleColor addSubview(titleLabel) titleLabel.snp.makeConstraints { maker in maker.leading.equalToSuperview().offset(TransactionInfoTheme.regularMargin) - maker.top.equalToSuperview().offset(TransactionInfoTheme.middleMargin) - } - - dateLabel.font = TransactionInfoTheme.dateFont - dateLabel.textColor = TransactionInfoTheme.dateColor - addSubview(dateLabel) - dateLabel.snp.makeConstraints { maker in - maker.leading.equalToSuperview().offset(TransactionInfoTheme.regularMargin) - maker.top.equalTo(titleLabel.snp.bottom) + maker.centerY.equalToSuperview() } let infoButton = RespondButton() @@ -39,7 +30,7 @@ class TransactionTitleItemView: BaseActionItemView { infoButton.cornerRadius = TransactionInfoTheme.hashButtonCornerRadius infoButton.snp.makeConstraints { maker in maker.trailing.equalToSuperview().offset(-TransactionInfoTheme.regularMargin) - maker.leading.equalTo(self.dateLabel.snp.trailing).offset(TransactionInfoTheme.largeMargin) + maker.leading.equalTo(self.titleLabel.snp.trailing).offset(TransactionInfoTheme.hashButtonMargin) maker.centerY.equalToSuperview() maker.height.equalTo(TransactionInfoTheme.hashButtonHeight) } @@ -53,7 +44,7 @@ class TransactionTitleItemView: BaseActionItemView { maker.centerY.equalToSuperview() } idTitleLabel.font = TransactionInfoTheme.itemTitleFont - idTitleLabel.textColor = TransactionInfoTheme.hashButtonTextColor + idTitleLabel.textColor = TransactionInfoTheme.hashButtonHashTextColor idTitleLabel.text = "#" infoButton.addSubview(idLabel) @@ -62,15 +53,14 @@ class TransactionTitleItemView: BaseActionItemView { maker.trailing.equalToSuperview().offset(-TransactionInfoTheme.middleMargin) maker.centerY.equalToSuperview() } - idLabel.font = TransactionInfoTheme.itemTitleFont - idLabel.textColor = TransactionInfoTheme.hashButtonTextColor + idLabel.font = TransactionInfoTheme.itemValueFont + idLabel.textColor = TransactionInfoTheme.itemValueColor idLabel.lineBreakMode = .byTruncatingMiddle } override func updateView() { super.updateView() - let date = item?.date.map { DateHelper.instance.formatTransactionInfoTime(from: $0) } ?? "n/a" - dateLabel.text = date + idLabel.text = item?.transactionId } diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionValueItem.swift b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionValueItem.swift new file mode 100644 index 0000000000..2483dc30d0 --- /dev/null +++ b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionValueItem.swift @@ -0,0 +1,16 @@ +import GrouviActionSheet + +class TransactionValueItem: BaseActionItem { + let title: String + let value: String + + init(title: String, value: String, tag: Int? = nil) { + self.title = title + self.value = value + + super.init(cellType: TransactionValueItemView.self, tag: tag, required: true) + + height = TransactionInfoTheme.itemHeight + } + +} diff --git a/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionValueItemView.swift b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionValueItemView.swift new file mode 100644 index 0000000000..3cea82179b --- /dev/null +++ b/BankWallet/BankWallet/Modules/TransactionInfo/ViewItems/TransactionValueItemView.swift @@ -0,0 +1,45 @@ +import UIKit +import GrouviExtensions +import GrouviActionSheet +import SnapKit + +class TransactionValueItemView: BaseActionItemView { + + var titleLabel = UILabel() + var valueLabel = UILabel() + + override var item: TransactionValueItem? { return _item as? TransactionValueItem } + + override func initView() { + super.initView() + + backgroundColor = TransactionInfoTheme.itemBackground + + titleLabel.font = TransactionInfoTheme.itemTitleFont + titleLabel.textColor = TransactionInfoTheme.itemTitleColor + titleLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) + titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + addSubview(titleLabel) + titleLabel.snp.makeConstraints { maker in + maker.centerY.equalToSuperview() + maker.leading.equalToSuperview().offset(TransactionInfoTheme.regularMargin) + } + + valueLabel.font = TransactionInfoTheme.itemValueFont + valueLabel.textColor = TransactionInfoTheme.itemValueColor + addSubview(valueLabel) + valueLabel.snp.makeConstraints { maker in + maker.leading.equalTo(self.titleLabel.snp.trailing).offset(TransactionInfoTheme.largeMargin) + maker.centerY.equalToSuperview() + maker.trailing.equalToSuperview().offset(-TransactionInfoTheme.regularMargin) + } + } + + override func updateView() { + super.updateView() + + titleLabel.text = item?.title + valueLabel.text = item?.value + } + +} diff --git a/BankWallet/BankWallet/Modules/Transactions/TransactionsModule.swift b/BankWallet/BankWallet/Modules/Transactions/TransactionsModule.swift index 8ab985cdcb..91770e6b93 100644 --- a/BankWallet/BankWallet/Modules/Transactions/TransactionsModule.swift +++ b/BankWallet/BankWallet/Modules/Transactions/TransactionsModule.swift @@ -2,7 +2,7 @@ import RealmSwift enum TransactionStatus { case pending - case processing(progress: Double) + case processing(confirmations: Int) case completed } @@ -11,7 +11,7 @@ extension TransactionStatus: Equatable { public static func ==(lhs: TransactionStatus, rhs: TransactionStatus) -> Bool { switch (lhs, rhs) { case (.pending, .pending): return true - case (let .processing(lhsProgress), let .processing(rhsProgress)): return lhsProgress == rhsProgress + case (let .processing(lhsConfirmations), let .processing(rhsConfirmations)): return lhsConfirmations == rhsConfirmations case (.completed, .completed): return true default: return false } diff --git a/BankWallet/BankWallet/Modules/Transactions/Views/TransactionCell.swift b/BankWallet/BankWallet/Modules/Transactions/Views/TransactionCell.swift index 73ca823e32..6ff077abae 100644 --- a/BankWallet/BankWallet/Modules/Transactions/Views/TransactionCell.swift +++ b/BankWallet/BankWallet/Modules/Transactions/Views/TransactionCell.swift @@ -8,10 +8,12 @@ class TransactionCell: UITableViewCell { var dateLabel = UILabel() var timeLabel = UILabel() - var statusImageView = UIImageView() + var pendingImageView = UIImageView() + var completedImageView = UIImageView() + var barsProgressView = BarsProgressView(count: 6, barWidth: TransactionsTheme.barsProgressBarWidth, color: TransactionsTheme.barsProgressColor, inactiveColor: TransactionsTheme.barsProgressInactiveColor) + var currencyAmountLabel = UILabel() var amountLabel = UILabel() - var fiatAmountLabel = UILabel() override init(style: UITableViewCellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) @@ -37,34 +39,50 @@ class TransactionCell: UITableViewCell { contentView.addSubview(timeLabel) timeLabel.snp.makeConstraints { maker in maker.leading.equalTo(contentView.snp.leadingMargin).offset(TransactionsTheme.leftAdditionalMargin) - maker.top.equalTo(self.dateLabel.snp.bottom).offset(TransactionsTheme.cellSmallMargin) + maker.bottom.equalToSuperview().offset(-TransactionsTheme.cellMediumMargin) } - contentView.addSubview(statusImageView) - statusImageView.snp.makeConstraints { maker in - maker.size.equalTo(TransactionsTheme.statusImageViewSize) - maker.leading.equalTo(self.timeLabel.snp.trailing).offset(TransactionsTheme.cellMilliMargin) - maker.centerY.equalTo(self.timeLabel) + currencyAmountLabel.font = TransactionsTheme.currencyAmountLabelFont + contentView.addSubview(currencyAmountLabel) + currencyAmountLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) + currencyAmountLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) + currencyAmountLabel.snp.makeConstraints { maker in + maker.leading.equalTo(self.dateLabel.snp.trailing).offset(TransactionsTheme.cellMediumMargin) + maker.top.equalToSuperview().offset(TransactionsTheme.cellMediumMargin) + maker.trailing.equalTo(contentView.snp.trailingMargin) } - amountLabel.font = TransactionsTheme.amountLabelFont + amountLabel.textAlignment = .right contentView.addSubview(amountLabel) - amountLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) - amountLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) amountLabel.snp.makeConstraints { maker in - maker.leading.equalTo(self.dateLabel.snp.trailing).offset(TransactionsTheme.cellMediumMargin) - maker.top.equalToSuperview().offset(TransactionsTheme.cellMediumMargin) + maker.leading.equalTo(self.timeLabel.snp.trailing).offset(TransactionsTheme.cellMediumMargin) + maker.bottom.equalToSuperview().offset(-TransactionsTheme.cellMediumMargin) maker.trailing.equalTo(contentView.snp.trailingMargin) } - fiatAmountLabel.font = TransactionsTheme.fiatAmountLabelFont - fiatAmountLabel.textAlignment = .right - contentView.addSubview(fiatAmountLabel) - fiatAmountLabel.snp.makeConstraints { maker in - maker.leading.equalTo(self.timeLabel.snp.trailing).offset(TransactionsTheme.cellMediumMargin) - maker.top.equalTo(self.amountLabel.snp.bottom).offset(TransactionsTheme.cellMicroMargin) - maker.trailing.equalTo(contentView.snp.trailingMargin) + pendingImageView.image = UIImage(named: "Transaction Processing Icon") + pendingImageView.alpha = TransactionsTheme.pendingStatusIconTransparency + contentView.addSubview(pendingImageView) + pendingImageView.snp.makeConstraints { maker in + maker.size.equalTo(TransactionsTheme.statusImageViewSize) + maker.leading.equalTo(contentView.snp.leadingMargin).offset(TransactionsTheme.leftAdditionalMargin) + maker.top.equalToSuperview().offset(TransactionsTheme.pendingIconTopMargin) + } + + completedImageView.image = UIImage(named: "Transaction Success Icon") + contentView.addSubview(completedImageView) + completedImageView.snp.makeConstraints { maker in + maker.size.equalTo(TransactionsTheme.statusImageViewSize) + maker.leading.equalTo(self.timeLabel.snp.trailing).offset(TransactionsTheme.cellSmallMargin) + maker.centerY.equalTo(self.amountLabel) + } + + contentView.addSubview(barsProgressView) + barsProgressView.snp.makeConstraints { maker in + maker.height.equalTo(TransactionsTheme.barsProgressHeight) + maker.leading.equalTo(self.timeLabel.snp.trailing).offset(TransactionsTheme.cellSmallMargin) + maker.centerY.equalTo(self.amountLabel) } let separatorView = UIView() @@ -81,34 +99,44 @@ class TransactionCell: UITableViewCell { } func bind(item: TransactionViewItem) { - dateLabel.textColor = item.status == .completed ? TransactionsTheme.dateLabelTextColor : TransactionsTheme.dateLabelTextColor50 - timeLabel.textColor = item.status == .completed ? TransactionsTheme.timeLabelTextColor : TransactionsTheme.timeLabelTextColor50 - let incomingTextColor = item.status == .completed ? TransactionsTheme.incomingTextColor : TransactionsTheme.incomingTextColor50 - let outgoingTextColor = item.status == .completed ? TransactionsTheme.outgoingTextColor : TransactionsTheme.outgoingTextColor50 - amountLabel.textColor = item.incoming ? incomingTextColor : outgoingTextColor - fiatAmountLabel.textColor = item.status == .completed ? TransactionsTheme.fiatAmountLabelColor : TransactionsTheme.fiatAmountLabelColor50 + dateLabel.textColor = item.status == .pending ? TransactionsTheme.dateLabelTextColor50 : TransactionsTheme.dateLabelTextColor + timeLabel.textColor = item.status == .pending ? TransactionsTheme.timeLabelTextColor50 : TransactionsTheme.timeLabelTextColor + timeLabel.textColor = item.status == .pending ? TransactionsTheme.timeLabelTextColor50 : TransactionsTheme.timeLabelTextColor + let incomingTextColor = item.status == .pending ? TransactionsTheme.incomingTextColor50 : TransactionsTheme.incomingTextColor + let outgoingTextColor = item.status == .pending ? TransactionsTheme.outgoingTextColor50 : TransactionsTheme.outgoingTextColor + currencyAmountLabel.textColor = item.incoming ? incomingTextColor : outgoingTextColor + amountLabel.textColor = item.status == .pending ? TransactionsTheme.fiatAmountLabelColor50 : TransactionsTheme.fiatAmountLabelColor dateLabel.text = (item.date.map { DateHelper.instance.formatTransactionDate(from: $0) })?.uppercased() timeLabel.text = item.date.map { DateHelper.instance.formatTransactionTime(from: $0) } - amountLabel.text = ValueFormatter.instance.format(coinValue: item.coinValue, explicitSign: true) + amountLabel.text = ValueFormatter.instance.format(coinValue: item.coinValue) - if let value = item.currencyValue, let formattedValue = ValueFormatter.instance.format(currencyValue: value, approximate: true, shortFractionLimit: 10) { - fiatAmountLabel.text = formattedValue + if let value = item.currencyValue, let formattedValue = ValueFormatter.instance.format(currencyValue: value, shortFractionLimit: 10) { + currencyAmountLabel.text = formattedValue } else { - fiatAmountLabel.text = "n/a" + currencyAmountLabel.text = nil } switch item.status { case .pending: - statusImageView.image = UIImage(named: "Transaction Processing Icon") - statusImageView.alpha = TransactionsTheme.pendingStatusIconTransparency - case .processing: - statusImageView.image = UIImage(named: "Transaction Processing Icon") - statusImageView.alpha = TransactionsTheme.pendingStatusIconTransparency + pendingImageView.isHidden = false + barsProgressView.isHidden = false + completedImageView.isHidden = true + case .processing(let confirmations): + pendingImageView.isHidden = true + barsProgressView.isHidden = false + completedImageView.isHidden = true + + barsProgressView.filledCount = confirmations case .completed: - statusImageView.image = UIImage(named: "Transaction Success Icon") - statusImageView.alpha = TransactionsTheme.completeStatusIconTransparency + pendingImageView.isHidden = true + barsProgressView.isHidden = true + completedImageView.isHidden = false + } + + barsProgressView.snp.updateConstraints { maker in + maker.leading.equalTo(self.timeLabel.snp.trailing).offset(item.status == .pending ? 0 : TransactionsTheme.cellSmallMargin) } } diff --git a/BankWallet/BankWallet/Theme/TransactionInfoTheme.swift b/BankWallet/BankWallet/Theme/TransactionInfoTheme.swift index 8e3a41b3a8..54ef305d40 100644 --- a/BankWallet/BankWallet/Theme/TransactionInfoTheme.swift +++ b/BankWallet/BankWallet/Theme/TransactionInfoTheme.swift @@ -2,11 +2,14 @@ import UIKit class TransactionInfoTheme { + static let hashButtonMargin: CGFloat = 48 static let largeMargin: CGFloat = 32 static let regularMargin: CGFloat = 16 static let middleMargin: CGFloat = 8 static let smallMargin: CGFloat = 4 + static let itemHeight: CGFloat = 45 + static let titleHeight: CGFloat = 54 static let titleFont = UIFont.cryptoHeadline static var titleColor: UIColor { return .crypto_White_Black } @@ -14,30 +17,29 @@ class TransactionInfoTheme { static let dateColor = UIColor.cryptoGray static var itemBackground: UIColor { return .crypto_Steel20_White } + static let itemTitleFont: UIFont = .systemFont(ofSize: 15) static let itemTitleColor = UIColor.cryptoGray - static let itemTitleFont = UIFont.cryptoCaption1 + static let itemValueFont: UIFont = .systemFont(ofSize: 15, weight: .medium) + static var itemValueColor: UIColor { return .crypto_Bars_Dark } static let hashButtonHeight: CGFloat = 28 static let hashButtonCornerRadius: CGFloat = 4 static var hashButtonBackground: UIColor { return .crypto_Steel20_LightBackground } static var hashButtonBackgroundSelected: UIColor { return .crypto_Steel40_LightGray } static let hashButtonBorderColor = UIColor.cryptoSteel20 - static var hashButtonTextColor: UIColor { return .crypto_Bars_Dark } + static let hashButtonHashTextColor: UIColor = .cryptoGray static let hashButtonIconColor: UIColor = .cryptoGray50 - static let amountHeight: CGFloat = 99 - static let amountTopMargin: CGFloat = 20 + static let amountHeight: CGFloat = 86 static let amountFont = UIFont.cryptoTitle3 static let fiatAmountFont = UIFont.cryptoCaption1 static let fiatAmountColor = UIColor.cryptoGray static let incomingAmountColor = UIColor.cryptoGreen static let outgoingAmountColor = UIColor.cryptoYellow - static let itemHeight: CGFloat = 45 - - static let statusImageWidth: CGFloat = 13 - static let statusImageHeight: CGFloat = 12 - static let successIconTintColor = UIColor.cryptoGreen - static let processingIconTintColor = UIColor.cryptoGray + static let barsProgressBarWidth: CGFloat = 4 + static let barsProgressHeight: CGFloat = 16 + static let barsProgressColor: UIColor = .cryptoGreen + static let barsProgressInactiveColor: UIColor = .cryptoSteel20 static let closeHeight: CGFloat = 52 static let closeButtonBackground = UIColor.clear diff --git a/BankWallet/BankWallet/Theme/TransactionsTheme.swift b/BankWallet/BankWallet/Theme/TransactionsTheme.swift index 20cd1190dd..969df473ab 100644 --- a/BankWallet/BankWallet/Theme/TransactionsTheme.swift +++ b/BankWallet/BankWallet/Theme/TransactionsTheme.swift @@ -7,7 +7,7 @@ class TransactionsTheme { static var dateLabelTextColor: UIColor { return .crypto_Silver_Black } static var dateLabelTextColor50: UIColor { return .crypto_Silver_Dark50 } static let statusLabelTextColor = UIColor.gray - static let amountLabelFont = UIFont.cryptoTitle4 + static let currencyAmountLabelFont: UIFont = .systemFont(ofSize: 22, weight: .semibold) static let incomingTextColor = UIColor.cryptoGreen static let incomingTextColor50 = UIColor.cryptoGreen50 static let outgoingTextColor = UIColor.cryptoYellow @@ -20,11 +20,11 @@ class TransactionsTheme { static let cellMicroMargin: CGFloat = 3 static let cellMilliMargin: CGFloat = 4 static let separatorColor = UIColor.cryptoSteel20 - static let fiatAmountLabelFont = UIFont.cryptoCaption1 + static let amountLabelFont = UIFont.cryptoCaption1 static let fiatAmountLabelColor = UIColor.cryptoGray static let fiatAmountLabelColor50 = UIColor.cryptoGray50 static let statusImageViewSize = CGSize(width: 13, height: 12) - static let statusTopMargin: CGFloat = 13 + static let pendingIconTopMargin: CGFloat = 20 static let leftAdditionalMargin: CGFloat = 8 static let avatarSize = CGSize(width: 40, height: 40) static let timeLabelFont = UIFont.cryptoCaption1 @@ -32,5 +32,9 @@ class TransactionsTheme { static let timeLabelTextColor = UIColor.cryptoGray static let timeLabelTextColor50 = UIColor.cryptoGray50 static let pendingStatusIconTransparency: CGFloat = 0.5 - static let completeStatusIconTransparency: CGFloat = 1 + + static let barsProgressHeight: CGFloat = 10 + static let barsProgressBarWidth: CGFloat = 2 + static let barsProgressColor: UIColor = .cryptoGray + static let barsProgressInactiveColor: UIColor = .cryptoSteel20 } diff --git a/BankWallet/BankWallet/UserInterface/Controls/BarsProgressView.swift b/BankWallet/BankWallet/UserInterface/Controls/BarsProgressView.swift new file mode 100644 index 0000000000..a83fc1b654 --- /dev/null +++ b/BankWallet/BankWallet/UserInterface/Controls/BarsProgressView.swift @@ -0,0 +1,55 @@ +import UIKit +import SnapKit + +class BarsProgressView: UIView { + + private let bars: [UIView] + private let color: UIColor + private let inactiveColor: UIColor + + var filledCount: Int = 0 { + didSet { + for (index, bar) in bars.enumerated() { + bar.backgroundColor = index < filledCount ? color : inactiveColor + } + } + } + + init(count: Int, barWidth: CGFloat, color: UIColor, inactiveColor: UIColor) { + bars = (0.. 0 { + maker.leading.equalTo(self.bars[i - 1].snp.trailing).offset(barWidth * 1.5) + } + } + } + + bars.first?.snp.makeConstraints { maker in + maker.leading.equalToSuperview() + } + bars.last?.snp.makeConstraints { maker in + maker.trailing.equalToSuperview() + } + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} diff --git a/BankWallet/BankWallet/UserInterface/ValueFormatter.swift b/BankWallet/BankWallet/UserInterface/ValueFormatter.swift index c24cd4d3fa..83a53b2a0a 100644 --- a/BankWallet/BankWallet/UserInterface/ValueFormatter.swift +++ b/BankWallet/BankWallet/UserInterface/ValueFormatter.swift @@ -34,48 +34,41 @@ class ValueFormatter { return formatter }() - func format(coinValue: CoinValue, explicitSign: Bool = false) -> String? { - let value = explicitSign ? abs(coinValue.value) : coinValue.value + func format(coinValue: CoinValue) -> String? { + coinFormatter.minimumFractionDigits = coinValue.value == 0 ? 2 : 0 - coinFormatter.minimumFractionDigits = value > 0 ? 2 : 0 - - guard let formattedValue = coinFormatter.string(from: value as NSNumber) else { + guard let formattedValue = coinFormatter.string(from: abs(coinValue.value) as NSNumber) else { return nil } var result = "\(formattedValue) \(coinValue.coinCode)" - if explicitSign { - let sign = coinValue.value < 0 ? "-" : "+" - result = "\(sign) \(result)" + if coinValue.value < 0 { + result = "- \(result)" } return result } - func format(currencyValue: CurrencyValue, approximate: Bool = false, shortFractionLimit: Double? = nil) -> String? { - var value = currencyValue.value + func format(currencyValue: CurrencyValue, shortFractionLimit: Double? = nil) -> String? { + let absoluteValue = abs(currencyValue.value) let formatter = currencyFormatter formatter.currencyCode = currencyValue.currency.code formatter.currencySymbol = currencyValue.currency.symbol if let limit = shortFractionLimit { - formatter.maximumFractionDigits = abs(value) > limit ? 0 : 2 + formatter.maximumFractionDigits = absoluteValue > limit ? 0 : 2 } else { formatter.maximumFractionDigits = 2 } - if approximate { - value = abs(value) - } - - guard var result = formatter.string(from: value as NSNumber) else { + guard var result = formatter.string(from: absoluteValue as NSNumber) else { return nil } - if approximate { - result = "~ \(result)" + if currencyValue.value < 0 { + result = "- \(result)" } return result diff --git a/BankWallet/BankWallet/en.lproj/Localizable.strings b/BankWallet/BankWallet/en.lproj/Localizable.strings index cb6afac14e..1258de0b5c 100644 --- a/BankWallet/BankWallet/en.lproj/Localizable.strings +++ b/BankWallet/BankWallet/en.lproj/Localizable.strings @@ -89,12 +89,10 @@ Go to Settings - > Bank and allow access to Camera."; // Transaction Info "tx_info.title" = "Transaction"; -"tx_info.pending" = "Pending"; -"tx_info.processing" = "Processing %@"; -"tx_info.completed" = "Completed"; -"tx_info.status" = "Status:"; -"tx_info.from_hash" = "From:"; -"tx_info.to_hash" = "To:"; +"tx_info.time" = "Time"; +"tx_info.status" = "Status"; +"tx_info.from_hash" = "From"; +"tx_info.to_hash" = "To"; "tx_info.alert_close" = "Close"; "tx_info.button_more" = "Full Info"; diff --git a/BankWallet/BankWalletTests/Core/Factories/TransactionViewItemFactoryTests.swift b/BankWallet/BankWalletTests/Core/Factories/TransactionViewItemFactoryTests.swift index f9ea7dd438..c1adf9615a 100644 --- a/BankWallet/BankWalletTests/Core/Factories/TransactionViewItemFactoryTests.swift +++ b/BankWallet/BankWalletTests/Core/Factories/TransactionViewItemFactoryTests.swift @@ -227,8 +227,8 @@ class TransactionViewItemFactoryTests: XCTestCase { let item = factory.item(fromRecord: record) - let expectedProgress = 0.5 - XCTAssertEqual(item.status, TransactionStatus.processing(progress: expectedProgress)) + let expectedConfirmations = 3 + XCTAssertEqual(item.status, TransactionStatus.processing(confirmations: expectedConfirmations)) } func testStatus_Completed() {