Fix fiat value display in UI when importing ticket

pull/560/head
Hwee-Boon Yar 6 years ago
parent ffab48983b
commit 71a70919d6
  1. 16
      AlphaWallet.xcodeproj/project.pbxproj
  2. 1
      AlphaWallet/Market/ViewModels/ImportTicketViewControllerViewModel.swift
  3. 28
      AlphaWalletTests/Market/ViewControllers/ImportTicketViewControllerTests.swift
  4. BIN
      AlphaWalletTests/Snapshots/ReferenceImage_64/AlphaWalletTests.ImportTicketViewControllerTests/testImportTicketViewControllerDisplay_iPhone11_3_320x568@2x.png
  5. BIN
      AlphaWalletTests/Snapshots/ReferenceImage_64/AlphaWalletTests.ImportTicketViewControllerTests/testImportTicketViewControllerDisplay_iPhone11_3_375x812@3x.png
  6. BIN
      AlphaWalletTests/Snapshots/ReferenceImage_64/AlphaWalletTests.ImportTicketViewControllerTests/testImportTicketViewControllerDisplay_iPhone11_4_375x812@3x.png

@ -324,8 +324,8 @@
5E7C75E81F85353844CACECC /* EnterSellTicketsPriceQuantityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7F610139D24D947B1625 /* EnterSellTicketsPriceQuantityViewController.swift */; };
5E7C75F80A7E178B49830BCD /* TicketsViewControllerHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C796039C0F47CDCA236C0 /* TicketsViewControllerHeader.swift */; };
5E7C760C7D55C97424F55138 /* TicketTableViewCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C75F877B2F2E24C7EF258 /* TicketTableViewCellViewModel.swift */; };
5E7C760F9D7C178E17C75C52 /* ImportTicketViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7487BDF72352446E1266 /* ImportTicketViewControllerTests.swift */; };
5E7C764D3C130AAB26E80EC1 /* AmountTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C73617E3A4C0B9A90A5F8 /* AmountTextField.swift */; };
5E7C76605A5102FBD376F32A /* ImportTicketViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7535095323B035CA47C0 /* ImportTicketViewController.swift */; };
5E7C76696EF7F27EC0788CDD /* GenerateTransferMagicLinkViewControllerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7EEAAE9C23B68419E9F5 /* GenerateTransferMagicLinkViewControllerViewModel.swift */; };
5E7C7669BBE6255A2377E070 /* SetSellTicketsExpiryDateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7962AE417E12F13FF58E /* SetSellTicketsExpiryDateViewController.swift */; };
5E7C7692C981580CD32228EB /* ChooseTicketTransferModeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C70FB40612BB02594EC00 /* ChooseTicketTransferModeViewController.swift */; };
@ -364,6 +364,7 @@
5E7C7AB2ECFB589632F2A26C /* WalletFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7E2DCCE0D775ECF83088 /* WalletFilter.swift */; };
5E7C7AB6950E43BD6E8D0CBE /* TokensViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7B3302309706CA0F972A /* TokensViewController.swift */; };
5E7C7AE1389D3179239249F0 /* ImportWalletTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C743172FCBDCD362C03A6 /* ImportWalletTabBar.swift */; };
5E7C7AE2EF04A23EC7C5ADFD /* ImportTicketViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7535095323B035CA47C0 /* ImportTicketViewController.swift */; };
5E7C7B0367CFB413C6885474 /* GenerateSellMagicLinkViewControllerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7624D6F7EA55F6F167B3 /* GenerateSellMagicLinkViewControllerViewModel.swift */; };
5E7C7B3E08EEA63C5B68B9C4 /* TicketRedemptionInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C778F20D32B70D7FF2135 /* TicketRedemptionInfoViewController.swift */; };
5E7C7B4E3DEA90147A5A9E0A /* TokensDataStoreTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C71E355BD14E975AF7491 /* TokensDataStoreTest.swift */; };
@ -846,6 +847,7 @@
5E7C741196D9D9C9C3EE5E30 /* LockCreatePasscodeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockCreatePasscodeViewController.swift; sourceTree = "<group>"; };
5E7C7419F47CC8B2996AA8F9 /* TransferTicketsQuantitySelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTicketsQuantitySelectionViewController.swift; sourceTree = "<group>"; };
5E7C743172FCBDCD362C03A6 /* ImportWalletTabBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportWalletTabBar.swift; sourceTree = "<group>"; };
5E7C7487BDF72352446E1266 /* ImportTicketViewControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportTicketViewControllerTests.swift; sourceTree = "<group>"; };
5E7C74A2C738BF2412D412A7 /* TicketSellInfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TicketSellInfoViewController.swift; sourceTree = "<group>"; };
5E7C74B82783A94091A43470 /* EthTokenViewCellViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EthTokenViewCellViewModel.swift; sourceTree = "<group>"; };
5E7C74B9EB81C51E956566E7 /* TokensDataStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokensDataStore.swift; sourceTree = "<group>"; };
@ -2440,6 +2442,14 @@
path = Models;
sourceTree = "<group>";
};
5E7C77C33FD8D5653F051136 /* ViewControllers */ = {
isa = PBXGroup;
children = (
5E7C7487BDF72352446E1266 /* ImportTicketViewControllerTests.swift */,
);
path = ViewControllers;
sourceTree = "<group>";
};
5E7C78E79A2C45A2124F259D /* Tokens */ = {
isa = PBXGroup;
children = (
@ -2688,6 +2698,7 @@
76F1DE8ADA3176D0277EDF20 /* OrderSigningTests.swift */,
B1DC375E203AEB4800C9756D /* MarketQueueHandlerTests.swift */,
76F1D96298E216CBFC3DD78B /* UniversalLinkHandlerTests.swift */,
5E7C77C33FD8D5653F051136 /* ViewControllers */,
);
path = Market;
sourceTree = "<group>";
@ -3624,7 +3635,6 @@
5E7C72E1D4B4B4C8443F3DA1 /* SendHeaderView.swift in Sources */,
5E7C713ACE8C72642B1C9F93 /* SendHeaderViewViewModel.swift in Sources */,
5E7C7376B566E5A59CC8F463 /* ImportTicketViewControllerViewModel.swift in Sources */,
5E7C76605A5102FBD376F32A /* ImportTicketViewController.swift in Sources */,
5E7C79F30A324D75DF42DDDE /* SellTicketsViewModel.swift in Sources */,
5E7C7E1B18EC7F7FD6D64439 /* SellTicketsViewController.swift in Sources */,
5E7C75E81F85353844CACECC /* EnterSellTicketsPriceQuantityViewController.swift in Sources */,
@ -3688,6 +3698,7 @@
76F1DF0A4667F618D2BAE78C /* GetIsERC721Encode.swift in Sources */,
76F1D439D545AA9B7E686DCC /* ContractERC721Transfer.swift in Sources */,
5E7C79DE8864702C51C0A7CC /* ResultResult.swift in Sources */,
5E7C7AE2EF04A23EC7C5ADFD /* ImportTicketViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -3768,6 +3779,7 @@
5E7C7705B09D780E84E2FDA5 /* XMLHandlerTest.swift in Sources */,
5E7C7D5843B705ACD26E9090 /* AssetDefinitionDiskBackingStoreWithOverridesTests.swift in Sources */,
5E7C71D1D16FE09032EB4B7E /* TokenObjectTest.swift in Sources */,
5E7C760F9D7C178E17C75C52 /* ImportTicketViewControllerTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

@ -216,6 +216,7 @@ struct ImportTicketViewControllerViewModel {
case .free:
return ""
case .paid(_, let dollarCost):
guard let dollarCost = dollarCost else { return "" }
return "$\(dollarCost)"
}
}

@ -0,0 +1,28 @@
//Copyright © 2018 Stormbird PTE. LTD.
import FBSnapshotTestCase
@testable import Trust
import UIKit
class ImportTicketViewControllerTests: FBSnapshotTestCase {
override func setUp() {
super.setUp()
isDeviceAgnostic = true
recordMode = false
}
func testImportTicketViewControllerDisplay() {
let controller = ImportTicketViewController(config: Config())
var viewModel: ImportTicketViewControllerViewModel = .init(state: .validating)
let ticket = Ticket(id: "1", index: 1, city: "", name: "", venue: "", match: 9, date: GeneralisedTime(string: "20010203160500+0300")!, seatId: 1, category: "MATCH CLUB", countryA: "Team A", countryB: "Team B")
let ticketHolder = TokenHolder(tickets: [ticket], status: .available, contractAddress: "0x1")
let cost: ImportTicketViewControllerViewModel.Cost = .paid(eth: Decimal(1), dollar: Decimal(400))
viewModel.ticketHolder = ticketHolder
viewModel.state = .promptImport
viewModel.cost = cost
controller.configure(viewModel: viewModel)
FBSnapshotVerifyView(controller.view)
}
}
Loading…
Cancel
Save