diff --git a/unstoppable-ios-app/domains-manager-ios/Entities/Debugger.swift b/unstoppable-ios-app/domains-manager-ios/Entities/Debugger.swift index 1f8f4c222..2ba99b6af 100644 --- a/unstoppable-ios-app/domains-manager-ios/Entities/Debugger.swift +++ b/unstoppable-ios-app/domains-manager-ios/Entities/Debugger.swift @@ -61,7 +61,7 @@ public struct Debugger { case .debugUI: return [.Error, .Navigation, .UI, .Images, .Debug] case .debugNetwork: - return [.Network, .WebSockets, .Error, .Debug, .mpc] + return [.Network, .WebSockets, .Error, .Debug] case .custom(let topics): return topics } diff --git a/unstoppable-ios-app/domains-manager-ios/Entities/DefaultAppVersionFetcher.swift b/unstoppable-ios-app/domains-manager-ios/Entities/DefaultAppVersionFetcher.swift index 8575c1c8a..d8d312d29 100644 --- a/unstoppable-ios-app/domains-manager-ios/Entities/DefaultAppVersionFetcher.swift +++ b/unstoppable-ios-app/domains-manager-ios/Entities/DefaultAppVersionFetcher.swift @@ -23,7 +23,6 @@ struct DefaultAppVersionFetcher: AppVersionApi { polygonMintingReleased: response.polygonClaimingReleased, mintingZilTldOnPolygonReleased: response.mintingZilTldOnPolygonReleased, dotcoinDeprecationReleased: response.dotcoinDeprecationReleased, - mobileUnsReleaseVersion: response.mobileUnsReleaseVersion, tlds: response.tlds, tldsToPurchase: response.tldsToPurchase, dnsTlds: response.dnsTlds, diff --git a/unstoppable-ios-app/domains-manager-ios/Entities/Version.swift b/unstoppable-ios-app/domains-manager-ios/Entities/Version.swift index 021d118ba..4df90901a 100644 --- a/unstoppable-ios-app/domains-manager-ios/Entities/Version.swift +++ b/unstoppable-ios-app/domains-manager-ios/Entities/Version.swift @@ -88,7 +88,6 @@ struct AppVersionAPIResponse: Decodable { let tldsToPurchase: [String] let dnsTlds: [String] var dotcoinDeprecationReleased: Bool? - var mobileUnsReleaseVersion: String? var limits: AppConfigurationLimits? } @@ -103,7 +102,6 @@ struct AppVersionInfo: Codable { var polygonMintingReleased: Bool = true var mintingZilTldOnPolygonReleased: Bool = false var dotcoinDeprecationReleased: Bool? - var mobileUnsReleaseVersion: String? var tlds: [String] = ["x", "crypto", "coin", diff --git a/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/BlockchainType.swift b/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/BlockchainType.swift index 88d56c148..ab11b4668 100644 --- a/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/BlockchainType.swift +++ b/unstoppable-ios-app/domains-manager-ios/Entities/Wallets/BlockchainType.swift @@ -40,6 +40,17 @@ enum BlockchainType: BlockchainProtocol { } } + /// This is a temporary property to map MATIC->POL transition until all services are updated. + /// Eventually "POL" should be set as a shortCode for Matic and this property should be removed + var migratedShortCode: String { + switch self { + case .Matic: + return "POL" + default: + return shortCode + } + } + var fullName: String { switch self { case .Ethereum: @@ -59,7 +70,7 @@ enum BlockchainType: BlockchainProtocol { switch chainShortCode.uppercased().trimmedSpaces { case "ETH": self = .Ethereum - case "MATIC": + case "MATIC", "POL": self = .Matic case "BASE": self = .Base diff --git a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Entities/FB_UD_MPCAccountAsset.swift b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Entities/FB_UD_MPCAccountAsset.swift index a569488cc..63d2ea838 100644 --- a/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Entities/FB_UD_MPCAccountAsset.swift +++ b/unstoppable-ios-app/domains-manager-ios/Modules/MPC/MPCWalletsService/MPCWalletSubServices/Fireblocks+UD/Entities/FB_UD_MPCAccountAsset.swift @@ -90,7 +90,12 @@ extension Array where Element == FB_UD_MPC.WalletAccountAsset { func findWith(symbol: String, chain: String) -> Element? { guard let id = FB_UD_MPC.WalletAccountAsset.mpcIDFor(symbol: chain) else { return nil } + var symbols: Set = [symbol] + if let blockchainType = BlockchainType(chainShortCode: symbol) { + symbols.insert(blockchainType.migratedShortCode) + } + // TODO: - Check for $0.blockchainAsset.blockchain.symbol when BE ready - return first(where: { $0.blockchainAsset.symbol == symbol && $0.blockchainAsset.blockchain.id == id }) + return first(where: { symbols.contains($0.blockchainAsset.symbol) && $0.blockchainAsset.blockchain.id == id }) } } diff --git a/unstoppable-ios-app/domains-manager-ios/Services/AppLaunchService/AppLaunchService.swift b/unstoppable-ios-app/domains-manager-ios/Services/AppLaunchService/AppLaunchService.swift index bca297f35..949b46763 100644 --- a/unstoppable-ios-app/domains-manager-ios/Services/AppLaunchService/AppLaunchService.swift +++ b/unstoppable-ios-app/domains-manager-ios/Services/AppLaunchService/AppLaunchService.swift @@ -147,8 +147,8 @@ private extension AppLaunchService { Task.detached(priority: .medium) { [weak self] in guard let self else { return } + appContext.coinRecordsService.refreshCurrencies() let appVersion = await appContext.userDataService.getLatestAppVersion() - appContext.coinRecordsService.refreshCurrencies(version: appVersion.mobileUnsReleaseVersion ?? Constants.defaultUNSReleaseVersion) await self.appVersionUpdated(appVersion) await self.stateMachine.set(appVersionInfo: appVersion) diff --git a/unstoppable-ios-app/domains-manager-ios/Services/CoinRecordsService/CoinRecordsService.swift b/unstoppable-ios-app/domains-manager-ios/Services/CoinRecordsService/CoinRecordsService.swift index b72ef2da8..c8410add1 100644 --- a/unstoppable-ios-app/domains-manager-ios/Services/CoinRecordsService/CoinRecordsService.swift +++ b/unstoppable-ios-app/domains-manager-ios/Services/CoinRecordsService/CoinRecordsService.swift @@ -33,13 +33,13 @@ extension CoinRecordsService: CoinRecordsServiceProtocol { return currencies } - func refreshCurrencies(version: String) { + func refreshCurrencies() { Task.detached(priority: .background) { do { - let data = try await self.fetchCurrenciesData(version: version) + let data = try await self.fetchCurrenciesData() guard let coins = self.parseCurrencies(from: data) else { - Debugger.printFailure("Failed to parse uns version: \(version)", critical: true) + Debugger.printFailure("Failed to parse resolver-keys", critical: true) return } @@ -47,7 +47,7 @@ extension CoinRecordsService: CoinRecordsServiceProtocol { self.storeCoinRecords(data: data) self.detectAndReportRecordsWithoutPrimaryChain() } catch { - Debugger.printFailure("Failed to fetch uns version: \(version)", critical: false) + Debugger.printFailure("Failed to fetch resolver-keys with error \(error.localizedDescription)", critical: false) } } } @@ -63,7 +63,7 @@ private extension CoinRecordsService { } } - func fetchCurrenciesData(version: String) async throws -> Data { + func fetchCurrenciesData() async throws -> Data { var cursor: String? = "" var records: [TokenRecord] = [] var counter = 0 diff --git a/unstoppable-ios-app/domains-manager-ios/Services/CoinRecordsService/CoinRecordsServiceProtocol.swift b/unstoppable-ios-app/domains-manager-ios/Services/CoinRecordsService/CoinRecordsServiceProtocol.swift index e31c736f5..ded40c25f 100644 --- a/unstoppable-ios-app/domains-manager-ios/Services/CoinRecordsService/CoinRecordsServiceProtocol.swift +++ b/unstoppable-ios-app/domains-manager-ios/Services/CoinRecordsService/CoinRecordsServiceProtocol.swift @@ -12,7 +12,7 @@ protocol CoinRecordsServiceProtocol { var eventsPublisher: PassthroughSubject { get } func getCurrencies() async -> [CoinRecord] - func refreshCurrencies(version: String) + func refreshCurrencies() } enum CoinRecordsEvent { diff --git a/unstoppable-ios-app/domains-manager-ios/Services/Networking/NetworkService.swift b/unstoppable-ios-app/domains-manager-ios/Services/Networking/NetworkService.swift index 2218270e2..d7aaa6840 100644 --- a/unstoppable-ios-app/domains-manager-ios/Services/Networking/NetworkService.swift +++ b/unstoppable-ios-app/domains-manager-ios/Services/Networking/NetworkService.swift @@ -79,7 +79,7 @@ struct NetworkService { using keyDecodingStrategy: JSONDecoder.KeyDecodingStrategy = .useDefaultKeys, dateDecodingStrategy: JSONDecoder.DateDecodingStrategy = .iso8601) async throws -> T { let data = try await makeAPIRequest(apiRequest) - logMPC("Raw Response: \(try? JSONSerialization.jsonObject(with: data))") + if let object = T.objectFromData(data, using: keyDecodingStrategy, dateDecodingStrategy: dateDecodingStrategy) { diff --git a/unstoppable-ios-app/domains-manager-ios/SupportingFiles/Constants.swift b/unstoppable-ios-app/domains-manager-ios/SupportingFiles/Constants.swift index 579bb6f98..bff1705a4 100644 --- a/unstoppable-ios-app/domains-manager-ios/SupportingFiles/Constants.swift +++ b/unstoppable-ios-app/domains-manager-ios/SupportingFiles/Constants.swift @@ -41,7 +41,6 @@ struct Constants { static let standardWebHosts = ["https://", "http://"] static let downloadedImageMaxSize: CGFloat = 512 static let downloadedIconMaxSize: CGFloat = 128 - static let defaultUNSReleaseVersion = "v0.7.6" static let defaultInitials: String = "N/A" static let appStoreAppId = "1544748602" static let refreshDomainBadgesInterval: TimeInterval = 60 * 3 // 3 min