|
|
@ -13,6 +13,7 @@ protocol TokensCoordinatorDelegate: class { |
|
|
|
class TokensCoordinator: Coordinator { |
|
|
|
class TokensCoordinator: Coordinator { |
|
|
|
|
|
|
|
|
|
|
|
let navigationController: UINavigationController |
|
|
|
let navigationController: UINavigationController |
|
|
|
|
|
|
|
let config: Config |
|
|
|
let session: WalletSession |
|
|
|
let session: WalletSession |
|
|
|
let keystore: Keystore |
|
|
|
let keystore: Keystore |
|
|
|
var coordinators: [Coordinator] = [] |
|
|
|
var coordinators: [Coordinator] = [] |
|
|
@ -35,12 +36,14 @@ class TokensCoordinator: Coordinator { |
|
|
|
|
|
|
|
|
|
|
|
init( |
|
|
|
init( |
|
|
|
navigationController: UINavigationController = NavigationController(), |
|
|
|
navigationController: UINavigationController = NavigationController(), |
|
|
|
|
|
|
|
config: Config, |
|
|
|
session: WalletSession, |
|
|
|
session: WalletSession, |
|
|
|
keystore: Keystore, |
|
|
|
keystore: Keystore, |
|
|
|
tokensStorage: TokensDataStore |
|
|
|
tokensStorage: TokensDataStore |
|
|
|
) { |
|
|
|
) { |
|
|
|
self.navigationController = navigationController |
|
|
|
self.navigationController = navigationController |
|
|
|
self.navigationController.modalPresentationStyle = .formSheet |
|
|
|
self.navigationController.modalPresentationStyle = .formSheet |
|
|
|
|
|
|
|
self.config = config |
|
|
|
self.session = session |
|
|
|
self.session = session |
|
|
|
self.keystore = keystore |
|
|
|
self.keystore = keystore |
|
|
|
self.storage = tokensStorage |
|
|
|
self.storage = tokensStorage |
|
|
@ -82,35 +85,11 @@ class TokensCoordinator: Coordinator { |
|
|
|
// navigationController.pushViewController(controller, animated: true) |
|
|
|
// navigationController.pushViewController(controller, animated: true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//FIFA add the FIFA token with a hardcoded address if not already present |
|
|
|
//FIFA add the FIFA token with a hardcoded address for appropriate network if not already present |
|
|
|
//TODO Handle ropsten hardcoding as well as the one for real tickets |
|
|
|
|
|
|
|
private func addFIFAToken() { |
|
|
|
private func addFIFAToken() { |
|
|
|
let fifaTokenPresent = storage.enabledObject.contains{ $0.address.eip55String == Constants.ticketContractAddress |
|
|
|
if let token = config.createDefaultTicketToken(), !storage.enabledObject.contains { $0.address.eip55String == token.contract.eip55String } { |
|
|
|
|
|
|
|
storage.addCustom(token: token) |
|
|
|
} |
|
|
|
} |
|
|
|
if fifaTokenPresent { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//for now just add both |
|
|
|
|
|
|
|
let token = ERC20Token( |
|
|
|
|
|
|
|
contract: Address(string: Constants.ticketContractAddress)!, |
|
|
|
|
|
|
|
name: "Tickets", |
|
|
|
|
|
|
|
symbol: "TICK", |
|
|
|
|
|
|
|
decimals: 0, |
|
|
|
|
|
|
|
isStormBird: true, |
|
|
|
|
|
|
|
balance: [] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let testToken = ERC20Token( |
|
|
|
|
|
|
|
contract: Address(string: Constants.ticketContractAddressRopsten)!, |
|
|
|
|
|
|
|
name: "Test Tickets", |
|
|
|
|
|
|
|
symbol: "AWTT", |
|
|
|
|
|
|
|
decimals: 0, |
|
|
|
|
|
|
|
isStormBird: true, |
|
|
|
|
|
|
|
balance: [] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
storage.addCustom(token: token) |
|
|
|
|
|
|
|
storage.addCustom(token: testToken) |
|
|
|
|
|
|
|
tokensViewController.fetch() |
|
|
|
tokensViewController.fetch() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|