|
|
@ -86,6 +86,8 @@ class TokensDataStore { |
|
|
|
self.addEthToken() |
|
|
|
self.addEthToken() |
|
|
|
self.scheduledTimerForPricesUpdate() |
|
|
|
self.scheduledTimerForPricesUpdate() |
|
|
|
self.scheduledTimerForEthBalanceUpdate() |
|
|
|
self.scheduledTimerForEthBalanceUpdate() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateTicketTokenToLocalizedName() |
|
|
|
} |
|
|
|
} |
|
|
|
private func addEthToken() { |
|
|
|
private func addEthToken() { |
|
|
|
//Check if we have previos values. |
|
|
|
//Check if we have previos values. |
|
|
@ -335,6 +337,23 @@ class TokensDataStore { |
|
|
|
self?.refreshETHBalance() |
|
|
|
self?.refreshETHBalance() |
|
|
|
}, selector: #selector(Operation.main), userInfo: nil, repeats: true) |
|
|
|
}, selector: #selector(Operation.main), userInfo: nil, repeats: true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func updateTicketTokenToLocalizedName() { |
|
|
|
|
|
|
|
if let token = config.createDefaultTicketToken() { |
|
|
|
|
|
|
|
let contract = token.contract.eip55String |
|
|
|
|
|
|
|
let localizedName = token.name |
|
|
|
|
|
|
|
if let storedTicketToken = enabledObject.first(where: { $0.contract == contract}) { |
|
|
|
|
|
|
|
updateTicketTokenName(token: storedTicketToken, to: localizedName) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func updateTicketTokenName(token: TokenObject, to name: String) { |
|
|
|
|
|
|
|
try! realm.write { |
|
|
|
|
|
|
|
token.name = name |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
deinit { |
|
|
|
deinit { |
|
|
|
//We should make sure that timer is invalidate. |
|
|
|
//We should make sure that timer is invalidate. |
|
|
|
pricesTimer.invalidate() |
|
|
|
pricesTimer.invalidate() |
|
|
|