Skip to content
This repository has been archived by the owner on Jun 2, 2019. It is now read-only.

Add new line with wallet name on Transaction Confirmation #866

Merged
merged 13 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Trust.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
61FC5ECF1FCFBAE500CCB12A /* EtherNumberFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FC5ECE1FCFBAE500CCB12A /* EtherNumberFormatter.swift */; };
61FC5ED11FCFBDEB00CCB12A /* EtherNumberFormatterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FC5ED01FCFBDEB00CCB12A /* EtherNumberFormatterTests.swift */; };
664D11A12007D59F0041A0B0 /* EstimateGasRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 664D11A02007D59F0041A0B0 /* EstimateGasRequest.swift */; };
71A433702113860900985ADC /* ConfirmPaymentDetailsViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71A4336F2113860900985ADC /* ConfirmPaymentDetailsViewModelTests.swift */; };
7301BA9220A3117000E1AFE5 /* AutoLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7301BA9120A3117000E1AFE5 /* AutoLock.swift */; };
7301BA9620AB1E5600E1AFE5 /* CookiesStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7301BA9520AB1E5600E1AFE5 /* CookiesStore.swift */; };
7302405C204C65DF00B327DF /* NonFungibleTokenCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7302405B204C65DF00B327DF /* NonFungibleTokenCategory.swift */; };
Expand Down Expand Up @@ -746,6 +747,7 @@
61FC5ED01FCFBDEB00CCB12A /* EtherNumberFormatterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EtherNumberFormatterTests.swift; sourceTree = "<group>"; };
646C8C822C986358D7388602 /* Pods_Trust.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Trust.framework; sourceTree = BUILT_PRODUCTS_DIR; };
664D11A02007D59F0041A0B0 /* EstimateGasRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EstimateGasRequest.swift; sourceTree = "<group>"; };
71A4336F2113860900985ADC /* ConfirmPaymentDetailsViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmPaymentDetailsViewModelTests.swift; sourceTree = "<group>"; };
7301BA9120A3117000E1AFE5 /* AutoLock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoLock.swift; sourceTree = "<group>"; };
7301BA9520AB1E5600E1AFE5 /* CookiesStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CookiesStore.swift; sourceTree = "<group>"; };
7302405B204C65DF00B327DF /* NonFungibleTokenCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonFungibleTokenCategory.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1611,6 +1613,7 @@
children = (
299B5E371FCBCDF70051361C /* RequestViewModelTests.swift */,
771A8521203588C900528D28 /* ConfirmPaymentViewModelTests.swift */,
71A4336F2113860900985ADC /* ConfirmPaymentDetailsViewModelTests.swift */,
);
path = ViewModels;
sourceTree = "<group>";
Expand Down Expand Up @@ -3261,6 +3264,7 @@
2912CD101F6A830700C6CBE3 /* TrustTests.swift in Sources */,
29FF130D1F7626E800AFD326 /* FakeNavigationController.swift in Sources */,
299573A41FA27A15006F17FD /* TestKeyStore.swift in Sources */,
71A433702113860900985ADC /* ConfirmPaymentDetailsViewModelTests.swift in Sources */,
CCA4FE3A1FD42B4100749AE4 /* FakeJailbreakChecker.swift in Sources */,
4E9A9D0820B2C52500180054 /* CoinTicker.swift in Sources */,
29F114F81FA8165200114A29 /* SendCoordinatorTests.swift in Sources */,
Expand Down
10 changes: 1 addition & 9 deletions Trust/Transfer/ViewModels/ConfirmPaymentDetailsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,8 @@ struct ConfirmPaymentDetailsViewModel {
return transaction.gasLimit
}

var currentWalletName: String {
return session.account.info.name
}

var currentWalletAddress: String {
return session.account.address.description
}

var currentWalletDescriptionString: String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you combine all in one string? no need to create separate variables.

maybe one test case?

return currentWalletName + " " + ("(\(currentWalletAddress))")
return session.account.info.name + " " + ("(\(session.account.address.description))")
}

var paymentFromTitle: String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use paymentFromTitle property

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright DApps Platform Inc. All rights reserved.

import XCTest
import Realm
import RealmSwift
import BigInt
@testable import Trust

class ConfirmPaymentDetailsViewModelTests: XCTestCase {

func testActionButtonTitleOnSignAndSend() {
let bigInt = BigInt("11274902618710000000000")!

let transaction = PreviewTransaction(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make factory for PreviewTransaction, so you don't need to specify so much

value: bigInt,
account: .make(),
address: .make(),
contract: .make(),
nonce: bigInt,
data: Data(),
gasPrice: bigInt,
gasLimit: bigInt,
transfer: .init(server: .make(), type: .ether(.make(), destination: .none))
)

let session = WalletSession.make(realm: .make(), sharedRealm: .make())

let viewModel = ConfirmPaymentDetailsViewModel(
transaction: transaction,
session: session,
server: .make()
)

let description = session.account.info.name + " " + "(\(session.account.address.description))"

XCTAssertEqual(description, viewModel.currentWalletDescriptionString)
}

}