Merge pull request #625 from alpha-wallet/no-longer-add-default-ticket-token-for-new-users

No longer add the default ticket token for new users
pull/631/head
James Sangalli 6 years ago committed by GitHub
commit 12e5ccbc83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      AlphaWallet/Settings/Types/Config.swift
  2. 9
      AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift

@ -140,39 +140,6 @@ struct Config {
///Debugging flag. Set to false to disable auto fetching prices, etc to cut down on network calls
let isAutoFetchingDisabled = false
func createDefaultTicketToken() -> ERCToken? {
guard let contract = ticketContractAddress else { return nil }
guard let contractAddress = Address(string: contract) else { return nil }
let xmlHandler = XMLHandler(contract: contract)
let lang = xmlHandler.getLang()
let name = xmlHandler.getName(lang: lang)
//TODO get symbol from RPC node, but this doesn't provide much benefit as it is a hardcoded
//placeholder anyway
//GetSymbolCoordinator(web3: Web3Swift()).getSymbol(for: contractAddress) { result in }
switch server {
case .main:
return ERCToken(
contract: contractAddress,
name: Constants.event + " " + name,
symbol: "SHANKAI",
decimals: 0,
type: .erc875,
balance: []
)
case .ropsten:
return ERCToken(
contract: contractAddress,
name: name,
symbol: "TEST",
decimals: 0,
type: .erc875,
balance: []
)
case .kovan, .rinkeby, .poa, .sokol, .classic, .callisto, .custom:
return nil
}
}
func createDefaultTicketToken(forContract contract: String) -> ERCToken? {
guard let contractAddress = Address(string: contract) else { return nil }
let xmlHandler = XMLHandler(contract: contract)

@ -62,7 +62,6 @@ class TokensCoordinator: Coordinator {
}
func start() {
addFIFAToken()
autoDetectTokens()
showTokens()
refreshUponAssetDefinitionChanges()
@ -192,14 +191,6 @@ class TokensCoordinator: Coordinator {
// navigationController.pushViewController(controller, animated: true)
}
//FIFA add the FIFA token with a hardcoded address for appropriate network if not already present
private func addFIFAToken() {
if let token = session.config.createDefaultTicketToken(), !storage.enabledObject.contains { $0.address.eip55String == token.contract.eip55String } {
storage.addCustom(token: token)
}
tokensViewController.fetch()
}
/// Failure to obtain contract data may be due to no-connectivity. So we should check .failed(networkReachable: Bool)
private func fetchContractData(for address: String, completion: @escaping (ContractData) -> Void) {
var completedName: String?

Loading…
Cancel
Save