Skip to content

Commit

Permalink
Contract urls from response
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantelis Giazitsis committed May 24, 2024
1 parent c57ef53 commit f26caeb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
6 changes: 0 additions & 6 deletions PresentationLayer/Constants/Strings/DisplayedLinks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ enum DisplayedLinks {
case heliumTroubleshooting
case heliumRegionFrequencies
case shopLink
case tokenContractAddress
case rewardsContractAddress
case shareDevice
case shareCells
case rewardMechanism
Expand Down Expand Up @@ -66,10 +64,6 @@ enum DisplayedLinks {
return "https://docs.helium.com/iot/lorawan-region-plans"
case .shopLink:
return "https://shop.weatherxm.com"
case .tokenContractAddress:
return "https://etherscan.io/token/0xde654f497a563dd7a121c176a125dd2f11f13a83"
case .rewardsContractAddress:
return "https://arbiscan.io/address/0x3d5aA83d830398ad93fBAF98ee7079278b9DCD49"
case .shareDevice:
return "https://explorer.weatherxm.com/stations/"
case .shareCells:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ extension NetworkStatsViewModel {
},
analyticsItemId: nil)

let rewardsDescription = LocalizableString.NetStats.wxmRewardsDescriptionMarkdown(DisplayedLinks.rewardsContractAddress.linkURL).localized.attributedMarkdown
var rewardsDescription: AttributedString?
if let rewwardsUrl = response?.contracts?.rewardsUrl {
rewardsDescription = LocalizableString.NetStats.wxmRewardsDescriptionMarkdown(rewwardsUrl).localized.attributedMarkdown
}

let accessory = NetworkStatsView.Accessory(fontIcon: .infoCircle) { [weak self] in
self?.showInfo(title: LocalizableString.NetStats.wxmRewardsTitle.localized,
description: LocalizableString.NetStats.totalAllocatedInfoText.localized,
Expand Down Expand Up @@ -117,7 +121,11 @@ extension NetworkStatsViewModel {
progress: tokens.supplyProgress,
analyticsItemId: .circulatingSupply)

let tokenDescription = LocalizableString.NetStats.wxmTokenDescriptionMarkdown(DisplayedLinks.tokenContractAddress.linkURL).localized.attributedMarkdown
var tokenDescription: AttributedString?
if let tokenUrl = response?.contracts?.tokenUrl {
tokenDescription = LocalizableString.NetStats.wxmTokenDescriptionMarkdown(tokenUrl).localized.attributedMarkdown
}

return getStatistics(from: nil,
title: LocalizableString.NetStats.wxmTokenTitle.localized,
description: tokenDescription,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@
"value": 742462
}
],
"contracts": {
"token_url": "https://etherscan.io/token/0xde654f497a563dd7a121c176a125dd2f11f13a83",
"rewards_url": "https://arbiscan.io/address/0x3d5aA83d830398ad93fBAF98ee7079278b9DCD49"
},
"tokens": {
"total_supply" : 100000000,
"daily_minted": 14246,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ public struct NetworkStationsStatsTokens: Codable {

public struct NetworkStatsContracts: Codable {
public let tokenUrl: String?
public let rewardUrl: String?
public let rewardsUrl: String?

enum CodingKeys: String, CodingKey {
case tokenUrl = "token_url"
case rewardUrl = "reward_url"
case rewardsUrl = "rewards_url"
}
}

Expand Down

0 comments on commit f26caeb

Please sign in to comment.