|
|
@ -4,64 +4,64 @@ import Foundation |
|
|
|
import AlphaWalletFoundation |
|
|
|
import AlphaWalletFoundation |
|
|
|
|
|
|
|
|
|
|
|
struct ImportMagicTokenCardRowViewModel: TokenCardRowViewModelProtocol { |
|
|
|
struct ImportMagicTokenCardRowViewModel: TokenCardRowViewModelProtocol { |
|
|
|
private var importMagicTokenViewControllerViewModel: ImportMagicTokenViewControllerViewModel |
|
|
|
private var importMagicTokenViewModel: ImportMagicTokenViewModel |
|
|
|
private let assetDefinitionStore: AssetDefinitionStore |
|
|
|
private let assetDefinitionStore: AssetDefinitionStore |
|
|
|
|
|
|
|
|
|
|
|
init(importMagicTokenViewControllerViewModel: ImportMagicTokenViewControllerViewModel, assetDefinitionStore: AssetDefinitionStore) { |
|
|
|
init(importMagicTokenViewModel: ImportMagicTokenViewModel, assetDefinitionStore: AssetDefinitionStore) { |
|
|
|
self.importMagicTokenViewControllerViewModel = importMagicTokenViewControllerViewModel |
|
|
|
self.importMagicTokenViewModel = importMagicTokenViewModel |
|
|
|
self.assetDefinitionStore = assetDefinitionStore |
|
|
|
self.assetDefinitionStore = assetDefinitionStore |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var tokenHolder: TokenHolder? { |
|
|
|
var tokenHolder: TokenHolder? { |
|
|
|
return importMagicTokenViewControllerViewModel.tokenHolder |
|
|
|
return importMagicTokenViewModel.tokenHolder |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var tokenCount: String { |
|
|
|
var tokenCount: String { |
|
|
|
return importMagicTokenViewControllerViewModel.tokenCount |
|
|
|
return importMagicTokenViewModel.tokenCount |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var city: String { |
|
|
|
var city: String { |
|
|
|
return importMagicTokenViewControllerViewModel.city |
|
|
|
return importMagicTokenViewModel.city |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var category: String { |
|
|
|
var category: String { |
|
|
|
return importMagicTokenViewControllerViewModel.category |
|
|
|
return importMagicTokenViewModel.category |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var teams: String { |
|
|
|
var teams: String { |
|
|
|
return importMagicTokenViewControllerViewModel.teams |
|
|
|
return importMagicTokenViewModel.teams |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var match: String { |
|
|
|
var match: String { |
|
|
|
return importMagicTokenViewControllerViewModel.match |
|
|
|
return importMagicTokenViewModel.match |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var venue: String { |
|
|
|
var venue: String { |
|
|
|
return importMagicTokenViewControllerViewModel.venue |
|
|
|
return importMagicTokenViewModel.venue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var date: String { |
|
|
|
var date: String { |
|
|
|
return importMagicTokenViewControllerViewModel.date |
|
|
|
return importMagicTokenViewModel.date |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var numero: String { |
|
|
|
var numero: String { |
|
|
|
return importMagicTokenViewControllerViewModel.numero |
|
|
|
return importMagicTokenViewModel.numero |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var time: String { |
|
|
|
var time: String { |
|
|
|
return importMagicTokenViewControllerViewModel.time |
|
|
|
return importMagicTokenViewModel.time |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var onlyShowTitle: Bool { |
|
|
|
var onlyShowTitle: Bool { |
|
|
|
return importMagicTokenViewControllerViewModel.onlyShowTitle |
|
|
|
return importMagicTokenViewModel.onlyShowTitle |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var isMeetupContract: Bool { |
|
|
|
var isMeetupContract: Bool { |
|
|
|
return importMagicTokenViewControllerViewModel.tokenHolder?.isSpawnableMeetupContract ?? false |
|
|
|
return importMagicTokenViewModel.tokenHolder?.isSpawnableMeetupContract ?? false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func subscribeBuilding(withBlock block: @escaping (String) -> Void) { |
|
|
|
func subscribeBuilding(withBlock block: @escaping (String) -> Void) { |
|
|
|
if let subscribable = importMagicTokenViewControllerViewModel.tokenHolder?.values.buildingSubscribableValue { |
|
|
|
if let subscribable = importMagicTokenViewModel.tokenHolder?.values.buildingSubscribableValue { |
|
|
|
subscribable.subscribe { value in |
|
|
|
subscribable.subscribe { value in |
|
|
|
value?.stringValue.flatMap { block($0) } |
|
|
|
value?.stringValue.flatMap { block($0) } |
|
|
|
} |
|
|
|
} |
|
|
@ -74,9 +74,9 @@ struct ImportMagicTokenCardRowViewModel: TokenCardRowViewModelProtocol { |
|
|
|
let string = values.joined(separator: ", ") |
|
|
|
let string = values.joined(separator: ", ") |
|
|
|
block(string) |
|
|
|
block(string) |
|
|
|
} |
|
|
|
} |
|
|
|
if let subscribable = importMagicTokenViewControllerViewModel.tokenHolder?.values.streetSubscribableValue { |
|
|
|
if let subscribable = importMagicTokenViewModel.tokenHolder?.values.streetSubscribableValue { |
|
|
|
subscribable.subscribe { value in |
|
|
|
subscribable.subscribe { value in |
|
|
|
guard let tokenHolder = self.importMagicTokenViewControllerViewModel.tokenHolder else { return } |
|
|
|
guard let tokenHolder = self.importMagicTokenViewModel.tokenHolder else { return } |
|
|
|
if let value = value?.stringValue { |
|
|
|
if let value = value?.stringValue { |
|
|
|
updateStreetLocalityStateCountry( |
|
|
|
updateStreetLocalityStateCountry( |
|
|
|
street: value, |
|
|
|
street: value, |
|
|
@ -87,9 +87,9 @@ struct ImportMagicTokenCardRowViewModel: TokenCardRowViewModelProtocol { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if let subscribable = importMagicTokenViewControllerViewModel.tokenHolder?.values.stateSubscribableValue { |
|
|
|
if let subscribable = importMagicTokenViewModel.tokenHolder?.values.stateSubscribableValue { |
|
|
|
subscribable.subscribe { value in |
|
|
|
subscribable.subscribe { value in |
|
|
|
guard let tokenHolder = self.importMagicTokenViewControllerViewModel.tokenHolder else { return } |
|
|
|
guard let tokenHolder = self.importMagicTokenViewModel.tokenHolder else { return } |
|
|
|
if let value = value?.stringValue { |
|
|
|
if let value = value?.stringValue { |
|
|
|
updateStreetLocalityStateCountry( |
|
|
|
updateStreetLocalityStateCountry( |
|
|
|
street: tokenHolder.values.streetSubscribableStringValue, |
|
|
|
street: tokenHolder.values.streetSubscribableStringValue, |
|
|
@ -100,9 +100,9 @@ struct ImportMagicTokenCardRowViewModel: TokenCardRowViewModelProtocol { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if let subscribable = importMagicTokenViewControllerViewModel.tokenHolder?.values.localitySubscribableValue { |
|
|
|
if let subscribable = importMagicTokenViewModel.tokenHolder?.values.localitySubscribableValue { |
|
|
|
subscribable.subscribe { value in |
|
|
|
subscribable.subscribe { value in |
|
|
|
guard let tokenHolder = self.importMagicTokenViewControllerViewModel.tokenHolder else { return } |
|
|
|
guard let tokenHolder = self.importMagicTokenViewModel.tokenHolder else { return } |
|
|
|
if let value = value?.stringValue { |
|
|
|
if let value = value?.stringValue { |
|
|
|
updateStreetLocalityStateCountry( |
|
|
|
updateStreetLocalityStateCountry( |
|
|
|
street: tokenHolder.values.streetSubscribableStringValue, |
|
|
|
street: tokenHolder.values.streetSubscribableStringValue, |
|
|
@ -113,8 +113,8 @@ struct ImportMagicTokenCardRowViewModel: TokenCardRowViewModelProtocol { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if let country = importMagicTokenViewControllerViewModel.tokenHolder?.values.countryStringValue { |
|
|
|
if let country = importMagicTokenViewModel.tokenHolder?.values.countryStringValue { |
|
|
|
guard let tokenHolder = self.importMagicTokenViewControllerViewModel.tokenHolder else { return } |
|
|
|
guard let tokenHolder = self.importMagicTokenViewModel.tokenHolder else { return } |
|
|
|
updateStreetLocalityStateCountry( |
|
|
|
updateStreetLocalityStateCountry( |
|
|
|
street: tokenHolder.values.streetSubscribableStringValue, |
|
|
|
street: tokenHolder.values.streetSubscribableStringValue, |
|
|
|
locality: tokenHolder.values.localitySubscribableStringValue, |
|
|
|
locality: tokenHolder.values.localitySubscribableStringValue, |
|
|
@ -125,7 +125,7 @@ struct ImportMagicTokenCardRowViewModel: TokenCardRowViewModelProtocol { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var tokenScriptHtml: String { |
|
|
|
var tokenScriptHtml: String { |
|
|
|
guard let tokenHolder = importMagicTokenViewControllerViewModel.tokenHolder else { return "" } |
|
|
|
guard let tokenHolder = importMagicTokenViewModel.tokenHolder else { return "" } |
|
|
|
let xmlHandler = XMLHandler(contract: tokenHolder.contractAddress, tokenType: tokenHolder.tokenType, assetDefinitionStore: assetDefinitionStore) |
|
|
|
let xmlHandler = XMLHandler(contract: tokenHolder.contractAddress, tokenType: tokenHolder.tokenType, assetDefinitionStore: assetDefinitionStore) |
|
|
|
let (html: html, style: style) = xmlHandler.tokenViewIconifiedHtml |
|
|
|
let (html: html, style: style) = xmlHandler.tokenViewIconifiedHtml |
|
|
|
|
|
|
|
|
|
|
|