add russian string to xml, change xml to mainnet and get name from XML in ticket

pull/270/head
James Sangalli 7 years ago
parent a2dd3cdca8
commit ef4d4683d5
  1. 9
      Trust/Foundation/AssetDefinitionXML.swift
  2. 9
      Trust/Foundation/XMLHandler.swift

@ -14,10 +14,11 @@ class AssetDefinitionXML {
"<asset>\n" + "<asset>\n" +
" <contract>\n" + " <contract>\n" +
" <address type=\"issuing\">0xB032532c03ce9212749193e12E03bA8062808faD</address>\n" + " <address type=\"issuing\">0xB032532c03ce9212749193e12E03bA8062808faD</address>\n" +
" <name lang=\"en\">FIFA 2018 Tickets</name>\n" + " <name lang=\"ru\">2018 Билеты</name>\n" +
" <name lang=\"zh\">世界杯2018承兑票</name>\n" + " <name lang=\"en\">2018 Tickets</name>\n" +
" <name lang=\"es\">Entradas de FIFA 2018</name>\n" + " <name lang=\"zh\">2018承兑票</name>\n" +
" <network>3</network> <!-- ROPSTEN -->\n" + " <name lang=\"es\">Entradas de 2018</name>\n" +
" <network>1</network> <!-- MAINNET -->\n" +
" </contract>\n" + " </contract>\n" +
" <!-- consider metadata of tokens, e.g. quantifier in each languages -->\n" + " <!-- consider metadata of tokens, e.g. quantifier in each languages -->\n" +
" <features>\n" + " <features>\n" +

@ -33,7 +33,7 @@ public class XMLHandler {
id: MarketQueueHandler.bytesToHexa(tokenId.serialize().array), id: MarketQueueHandler.bytesToHexa(tokenId.serialize().array),
index: index, index: index,
city: location, city: location,
name: "FIFA WC", name: getName(lang: lang),
venue: venue, venue: venue,
match: match, match: match,
date: Date(timeIntervalSince1970: TimeInterval(time)), date: Date(timeIntervalSince1970: TimeInterval(time)),
@ -44,6 +44,13 @@ public class XMLHandler {
) )
} }
func getName(lang: Int) -> String {
if let name = xml["asset"]["contract"]["name"][lang].text {
return name
}
return "N/A"
}
func getLang() -> Int { func getLang() -> Int {
let lang = Locale.preferredLanguages[0] let lang = Locale.preferredLanguages[0]
var langNum = 0 var langNum = 0

Loading…
Cancel
Save