diff --git a/Trust/Foundation/AssetDefinitionXML.swift b/Trust/Foundation/AssetDefinitionXML.swift index 85df727ee..4337aa470 100644 --- a/Trust/Foundation/AssetDefinitionXML.swift +++ b/Trust/Foundation/AssetDefinitionXML.swift @@ -11,7 +11,7 @@ import Foundation class AssetDefinitionXML { private static let xmlInputStream = InputStream(fileAtPath: "./contracts/AssetDefinition.xml") // swiftlint:disable:this - public static let assetDefinition = "\n" + + public static let assetDefinition = "\n" + "\n" + "\n" + "\n" + @@ -428,86 +428,103 @@ class AssetDefinitionXML { " Mordovia Arena\n" + " \n" + " \n" + + "\t UNSW Michael Crouch Innovation Center\t\n" + " UNSW Michael Crouch Innovation Center\n" + " 新南威尔大学Michael Crouch创新中心\n" + " Centro de Innovación de Michael Crouch UNSW\n" + " \n" + "\t \n" + + "\t FOUR SEASONS HOTEL SHENZHEN\t \n" + " FOUR SEASONS HOTEL SHENZHEN\n" + " 深圳四季酒店\n" + " FOUR SEASONS HOTEL SHENZHEN\n" + " \n" + "\t \n" + + "\t Paypal Innovation Lab\t\t \n" + " Paypal Innovation Lab\n" + " Paypal Innovation Lab\n" + " Paypal Innovation Lab\n" + " \n" + "\t \n" + + "\t The Centrepoint\t \n" + " The Centrepoint\n" + " The Centrepoint\n" + " The Centrepoint\n" + " \n" + "\t \n" + + "\t The Centrepoint\t \n" + " TBC\n" + " 待定\n" + " Por determinar\n" + " \n" + "\t \n" + + "\t thebridge\t \n" + " thebridge\n" + " thebridge\n" + " thebridge\n" + " \n" + "\t \n" + + "\t BASH\t \n" + " BASH\n" + " BASH\n" + " BASH\n" + " \n" + "\t \n" + + "\t Spacemob\t \n" + " Spacemob\n" + " Spacemob\n" + " Spacemob\n" + " \n" + "\t \n" + + "\t 32 Carpenter Street\n" + " 32 Carpenter Street\n" + " 32 Carpenter Street\n" + " 32 Carpenter Street\n" + " \n" + "\t \n" + + "\t Block 71\t \n" + " Block 71\n" + " Block 71\n" + " Block 71\n" + " \n" + "\t \n" + + "\t Microsoft Singapore\n" + " Microsoft Singapore\n" + " Microsoft Singapore\n" + " Microsoft Singapore\n" + " \n" + "\t \n" + + "\t Google Singapore\t \n" + " Google Singapore\n" + " Google Singapore\n" + " Google Singapore\n" + " \t \n" + "\t \n" + + "\t The Blockchain Hub\t \n" + " The Blockchain Hub\n" + " The Blockchain Hub\n" + " The Blockchain Hub\n" + " \t \n" + "\t \n" + + "\t BitTemple\t \n" + " BitTemple\n" + " BitTemple\n" + " BitTemple\n" + " \n" + "\t \n" + + "\t ADD BLOCKCHAIN STUDIO\t \n" + " ADD BLOCKCHAIN STUDIO\n" + " ADD BLOCKCHAIN STUDIO\n" + " ADD BLOCKCHAIN STUDIO\n" + " \n" + "\t \n" + + "\t Rosewood Beijing\t \n" + " Rosewood Beijing\n" + " 北京瑰丽酒店\n" + " Rosewood Beijing\n" + " \n" + "\t \n" + + "\t Stratum\n" + " Stratum\n" + " Stratum\n" + " Stratum\n" + @@ -515,7 +532,7 @@ class AssetDefinitionXML { " \n" + " \n" + " \n" + - " время\n" + + " время\n" + " Time\n" + " 时间\n" + " Tiempo\n" + @@ -545,125 +562,185 @@ class AssetDefinitionXML { " Cat\n" + " \n" + " \n" + + "\t Category 1\n" + " Category 1\n" + " 一类票\n" + + "\t Category 1\n" + " \n" + " \n" + + "\t Category 2\n" + " Category 2\n" + " 二类票\n" + + "\t Category 2\n" + " \n" + - "\t \n" + + "\t \n" + + "\t Category 3\n" + " Category 3\n" + " 三类票\n" + + "\t Category 3 \t \n" + " \n" + "\t \n" + + "\t Category 4\t \n" + " Category 4\n" + " 四类票\n" + + "\t Category 4\t \n" + " \n" + " \n" + + "\t Match Club\t\n" + " Match Club\n" + " 俱乐部坐席\n" + + "\t Match Club\t\n" + " \n" + "\t\n" + + "\t\tMatch House Premier\n" + "\t\tMatch House Premier\n" + "\t\t比赛之家坐席\n" + + "\t\tMatch House Premier\n" + "\t\n" + "\t \n" + + " MATCH PAVILION\n" + " MATCH PAVILION\n" + " 款待大厅坐席\n" + + " \t MATCH PAVILION\n" + " \n" + "\t \n" + + "\t MATCH BUSINESS SEAT\t \n" + " MATCH BUSINESS SEAT\n" + " 商务坐席\n" + + "\t MATCH BUSINESS SEAT\t \n" + " \n" + "\t \n" + + "\t MATCH SHARED SUITE\n" + " MATCH SHARED SUITE\n" + " 公共包厢\n" + + "\t MATCH SHARED SUITE\t \n" + " \n" + "\t \n" + + " TSARSKY LOUNGE\n" + " TSARSKY LOUNGE\n" + " 特拉斯基豪华包厢\n" + + "\t TSARSKY LOUNGE\t \n" + " \n" + "\t \n" + + "\t MATCH PRIVATE SUITE\t\t \n" + " MATCH PRIVATE SUITE\n" + " 私人包厢\n" + + "\t MATCH PRIVATE SUITE\n" + " \n" + " \n" + " \n" + + "\t Singapore Blockchain Event\n" + " Singapore Blockchain Event\n" + " 新加坡区块链活动\n" + + "\t Singapore Blockchain Event\n" + " \n" + "\t\n" + + "\t Singapore Blockchain Event\t\n" + " TECHNOLOGY RADAR SUMMIT 2018\n" + " 技术雷达峰会2018\n" + + "\t Singapore Blockchain Event\t\n" + " \n" + "\t \n" + + " Sydney Blockchain Event\n" + " Sydney Blockchain Event\n" + " 悉尼区块链活动\n" + + "\t Sydney Blockchain Event\t \n" + " \n" + "\t \n" + + " Beijing Blockchain Event\n" + " Beijing Blockchain Event\n" + " 北京区块链活动\n" + + " Beijing Blockchain Event\n" + " \n" + "\t \n" + + " Shanghai Blockchain Event\n" + " Shanghai Blockchain Event\n" + " 上海区块链活动\n" + + " Shanghai Blockchain Event\n" + " \n" + "\t \n" + + " Tokyo Blockchain Event\n" + " Tokyo Blockchain Event\n" + " 东京区块链活动\n" + + " Tokyo Blockchain Event\n" + " \n" + "\t \n" + + "\t Blockchain Event\n" + " Blockchain Event\n" + " 区块链活动\n" + + "\t Blockchain Event\n" + " \n" + "\t \n" + + " Other Events\n" + " Other Events\n" + " 其他活动\n" + + "\t Other Events\t \n" + " \n" + "\t \n" + + " Seoul Blockchain Event\n" + " Seoul Blockchain Event\n" + " 首尔区块链活动\n" + + " Seoul Blockchain Event\n" + " \n" + "\t \n" + + " Bangkok Blockchain Event\n" + " Bangkok Blockchain Event\n" + " 曼谷区块链活动\n" + + " Bangkok Blockchain Event\n" + " \n" + "\t \n" + + " AlphaWallet Event\n" + " AlphaWallet Event\n" + " AlphaWallet活动\n" + + " AlphaWallet Event\n" + " \n" + "\t \n" + + "\t Stormbird Event\t \n" + " Stormbird Event\n" + " Stormbird活动\n" + + "\t Stormbird Event\t \n" + " \n" + "\t \n" + + " UNITY VENTURES Event\n" + " UNITY VENTURES Event\n" + " 九合创投活动\n" + + " UNITY VENTURES Event\n" + " \n" + "\t \n" + + "\t Max's Event\t \n" + " Max's Event\n" + " Max的活动\n" + + " Max's Event\n" + " \n" + "\t \n" + + " Chongqing Blockchain Event\n" + " Chongqing Blockchain Event\n" + " 重庆区块链活动\n" + + " Chongqing Blockchain Event\n" + " \n" + "\t \n" + + " Dubai Blockchain Event\n" + " Dubai Blockchain Event\n" + " 迪拜区块链活动\n" + + "\t Dubai Blockchain Event\t \n" + " \n" + "\t \n" + + " Silicon Valley Blockchain Event\n" + " Silicon Valley Blockchain Event\n" + " 硅谷区块链活动\n" + + " Silicon Valley Blockchain Event\n" + " \n" + "\t \n" + + " Melbourne Blockchain Event\n" + " Melbourne Blockchain Event\n" + " 墨尔本区块链活动\n" + + "\t Melbourne Blockchain Event\n" + " \n" + "\t \n" + + " General Event\n" + " General Event\n" + " 通用活动\n" + + "\t General Event\t \n" + " \n" + " \n" + " \n" + @@ -672,5 +749,5 @@ class AssetDefinitionXML { " \n" + " \n" + " \n" + - "" + "\n" } diff --git a/Trust/Foundation/XMLHandler.swift b/Trust/Foundation/XMLHandler.swift index 73128ef6d..ad3ad6cef 100644 --- a/Trust/Foundation/XMLHandler.swift +++ b/Trust/Foundation/XMLHandler.swift @@ -55,7 +55,7 @@ public class XMLHandler { match: match, date: formatDateToMoscow(time), seatId: number, - category: category, + category: getCategory(category, lang: lang), countryA: countryAString, countryB: countryBString ) @@ -105,6 +105,13 @@ public class XMLHandler { } return "N/A" } + + func getCategory(_ cat: Int, lang: Int) -> String { + if let category = xml["asset"]["fields"]["field"][6][0]["mapping"]["entity"][cat - 1]["name"][lang].text { + return category + } + return "N/A" + } func getVenue(attribute: String, lang: Int) -> String { let venueNumber = Int(attribute, radix: 16)! - 1 diff --git a/Trust/Tokens/Types/Ticket.swift b/Trust/Tokens/Types/Ticket.swift index 6a58f43d4..4dc4c528f 100644 --- a/Trust/Tokens/Types/Ticket.swift +++ b/Trust/Tokens/Types/Ticket.swift @@ -17,7 +17,7 @@ struct Ticket { let match: Int let date: Date let seatId: Int - let category: Int + let category: String let countryA: String let countryB: String static var empty: Ticket { @@ -30,7 +30,7 @@ struct Ticket { match: 0, date: Date(), seatId: 0, - category: 0, + category: "N/A", countryA: "N/A", countryB: "N/A" ) diff --git a/Trust/Tokens/Types/TicketHolder.swift b/Trust/Tokens/Types/TicketHolder.swift index 33749a9a1..b1be5561b 100644 --- a/Trust/Tokens/Types/TicketHolder.swift +++ b/Trust/Tokens/Types/TicketHolder.swift @@ -19,7 +19,7 @@ class TicketHolder { var venue: String { return tickets[0].venue } var match: Int { return tickets[0].match } var date: Date { return tickets[0].date } - var category: Int { return tickets[0].category } + var category: String { return tickets[0].category } var countryA: String { return tickets[0].countryA } var countryB: String { return tickets[0].countryB } var status: TicketHolderStatus