From 7aac21d6996d1972a858e821cf35f5c029826f1b Mon Sep 17 00:00:00 2001 From: Pantelis Giazitsis Date: Wed, 8 Oct 2025 10:53:46 +0300 Subject: [PATCH 1/6] Added tro type --- PresentationLayer/Constants/ColorEnum.swift | 2 ++ .../DomainExtensions/BoostCode+.swift | 10 +++++++ .../get_device_rewards_analytics_7d.json | 28 +++++++++++++++++++ .../NetworkDeviceRewardDetailsResponse.swift | 5 ++++ .../Colors.xcassets/Boosts/Contents.json | 6 ++++ .../betaRewardsFill.colorset/Contents.json | 0 .../betaRewardsPrimary.colorset/Contents.json | 0 .../Contents.json | 0 .../Contents.json | 0 .../otherRewardChart.colorset/Contents.json | 0 .../otherRewardFill.colorset/Contents.json | 0 .../otherRewardPrimary.colorset/Contents.json | 0 .../troRewardsFill.colorset/Contents.json | 20 +++++++++++++ .../troRewardsPrimary.colorset/Contents.json | 20 +++++++++++++ 14 files changed, 91 insertions(+) create mode 100644 wxm-ios/Resources/Colors.xcassets/Boosts/Contents.json rename wxm-ios/Resources/Colors.xcassets/{ => Boosts}/betaRewardsFill.colorset/Contents.json (100%) rename wxm-ios/Resources/Colors.xcassets/{ => Boosts}/betaRewardsPrimary.colorset/Contents.json (100%) rename wxm-ios/Resources/Colors.xcassets/{ => Boosts}/correctionRewardsFill.colorset/Contents.json (100%) rename wxm-ios/Resources/Colors.xcassets/{ => Boosts}/correctionRewardsPrimary.colorset/Contents.json (100%) rename wxm-ios/Resources/Colors.xcassets/{ => Boosts}/otherRewardChart.colorset/Contents.json (100%) rename wxm-ios/Resources/Colors.xcassets/{ => Boosts}/otherRewardFill.colorset/Contents.json (100%) rename wxm-ios/Resources/Colors.xcassets/{ => Boosts}/otherRewardPrimary.colorset/Contents.json (100%) create mode 100644 wxm-ios/Resources/Colors.xcassets/Boosts/troRewardsFill.colorset/Contents.json create mode 100644 wxm-ios/Resources/Colors.xcassets/Boosts/troRewardsPrimary.colorset/Contents.json diff --git a/PresentationLayer/Constants/ColorEnum.swift b/PresentationLayer/Constants/ColorEnum.swift index d146771c1..9438ea745 100644 --- a/PresentationLayer/Constants/ColorEnum.swift +++ b/PresentationLayer/Constants/ColorEnum.swift @@ -67,6 +67,8 @@ public enum ColorEnum: String { case betaRewardsPrimary case correctionRewardsFill case correctionRewardsPrimary + case troRewardsFill + case troRewardsPrimary case lastRun case tooltip case textDarkStable diff --git a/PresentationLayer/Extensions/DomainExtensions/BoostCode+.swift b/PresentationLayer/Extensions/DomainExtensions/BoostCode+.swift index e4fdf7351..4e1d92df7 100644 --- a/PresentationLayer/Extensions/DomainExtensions/BoostCode+.swift +++ b/PresentationLayer/Extensions/DomainExtensions/BoostCode+.swift @@ -13,6 +13,8 @@ extension BoostCode { switch self { case .betaReward: return LocalizableString.RewardAnalytics.beta.localized + case .tro: + return "Rollouts" case .correction: return LocalizableString.RewardAnalytics.compensation.localized case .unknown: @@ -24,6 +26,8 @@ extension BoostCode { switch self { case .betaReward: return .betaRewardsPrimary + case .tro: + return .troRewardsPrimary case .correction: return .correctionRewardsPrimary case .unknown: @@ -35,6 +39,8 @@ extension BoostCode { switch self { case .betaReward: return .betaRewardsFill + case .tro: + return .troRewardsFill case .correction: return .correctionRewardsFill case .unknown: @@ -46,6 +52,8 @@ extension BoostCode { switch self { case .betaReward: return .betaRewardsPrimary + case .tro: + return .troRewardsPrimary case .correction: return .correctionRewardsFill case .unknown: @@ -57,6 +65,8 @@ extension BoostCode { switch self { case .betaReward: return LocalizableString.RewardAnalytics.betaRewards.localized + case .tro: + return "Rollouts" case .correction: return LocalizableString.RewardAnalytics.compensationRewards.localized case .unknown: diff --git a/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_rewards_analytics_7d.json b/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_rewards_analytics_7d.json index 181ea2e71..a5f2be270 100644 --- a/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_rewards_analytics_7d.json +++ b/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_rewards_analytics_7d.json @@ -58,6 +58,11 @@ "type": "boost", "code": "beta_rewards", "value": 1.4353223 + }, + { + "type": "boost", + "code": "tro", + "value": 1.4353223 } ] }, @@ -78,6 +83,11 @@ "type": "boost", "code": "correction", "value": 1.4353223 + }, + { + "type": "boost", + "code": "tro", + "value": 0.4353223 } ] }, @@ -93,6 +103,11 @@ "type": "boost", "code": "beta_rewards", "value": 1.4353223 + }, + { + "type": "boost", + "code": "tro", + "value": 1.2 } ] }, @@ -108,6 +123,11 @@ "type": "boost", "code": "beta_rewards", "value": 1.4353223 + }, + { + "type": "boost", + "code": "tro", + "value": 0.6353223 } ] } @@ -138,6 +158,14 @@ "boost_period_start": "2025-09-10T00:00:00.000Z", "boost_period_end": "2025-09-11T00:00:00.000Z", "completed_percentage": 100 + }, + { + "code": "tro", + "type": "tro", + "current_rewards": 2.017276, + "boost_period_start": "2025-09-10T00:00:00.000Z", + "boost_period_end": "2025-09-11T00:00:00.000Z", + "completed_percentage": 47 } ] } diff --git a/wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Me/Network/NetworkDeviceRewardDetailsResponse.swift b/wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Me/Network/NetworkDeviceRewardDetailsResponse.swift index da519a147..c46d7cb18 100644 --- a/wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Me/Network/NetworkDeviceRewardDetailsResponse.swift +++ b/wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Me/Network/NetworkDeviceRewardDetailsResponse.swift @@ -114,12 +114,15 @@ public extension NetworkDeviceRewardDetailsResponse { public enum BoostCode: Codable, RawRepresentable, Hashable, Comparable, Sendable { case betaReward case correction(String) + case tro case unknown(String) public init?(rawValue: String) { switch rawValue { case "beta_rewards": self = .betaReward + case "tro": + self = .tro case let str where str.hasPrefix("correction"): self = .correction(rawValue) default: @@ -131,6 +134,8 @@ public enum BoostCode: Codable, RawRepresentable, Hashable, Comparable, Sendable switch self { case .betaReward: return "beta_rewards" + case .tro: + return "tro" case .correction(let raw): return raw case .unknown(let raw): diff --git a/wxm-ios/Resources/Colors.xcassets/Boosts/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/wxm-ios/Resources/Colors.xcassets/Boosts/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/wxm-ios/Resources/Colors.xcassets/betaRewardsFill.colorset/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/betaRewardsFill.colorset/Contents.json similarity index 100% rename from wxm-ios/Resources/Colors.xcassets/betaRewardsFill.colorset/Contents.json rename to wxm-ios/Resources/Colors.xcassets/Boosts/betaRewardsFill.colorset/Contents.json diff --git a/wxm-ios/Resources/Colors.xcassets/betaRewardsPrimary.colorset/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/betaRewardsPrimary.colorset/Contents.json similarity index 100% rename from wxm-ios/Resources/Colors.xcassets/betaRewardsPrimary.colorset/Contents.json rename to wxm-ios/Resources/Colors.xcassets/Boosts/betaRewardsPrimary.colorset/Contents.json diff --git a/wxm-ios/Resources/Colors.xcassets/correctionRewardsFill.colorset/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/correctionRewardsFill.colorset/Contents.json similarity index 100% rename from wxm-ios/Resources/Colors.xcassets/correctionRewardsFill.colorset/Contents.json rename to wxm-ios/Resources/Colors.xcassets/Boosts/correctionRewardsFill.colorset/Contents.json diff --git a/wxm-ios/Resources/Colors.xcassets/correctionRewardsPrimary.colorset/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/correctionRewardsPrimary.colorset/Contents.json similarity index 100% rename from wxm-ios/Resources/Colors.xcassets/correctionRewardsPrimary.colorset/Contents.json rename to wxm-ios/Resources/Colors.xcassets/Boosts/correctionRewardsPrimary.colorset/Contents.json diff --git a/wxm-ios/Resources/Colors.xcassets/otherRewardChart.colorset/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/otherRewardChart.colorset/Contents.json similarity index 100% rename from wxm-ios/Resources/Colors.xcassets/otherRewardChart.colorset/Contents.json rename to wxm-ios/Resources/Colors.xcassets/Boosts/otherRewardChart.colorset/Contents.json diff --git a/wxm-ios/Resources/Colors.xcassets/otherRewardFill.colorset/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/otherRewardFill.colorset/Contents.json similarity index 100% rename from wxm-ios/Resources/Colors.xcassets/otherRewardFill.colorset/Contents.json rename to wxm-ios/Resources/Colors.xcassets/Boosts/otherRewardFill.colorset/Contents.json diff --git a/wxm-ios/Resources/Colors.xcassets/otherRewardPrimary.colorset/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/otherRewardPrimary.colorset/Contents.json similarity index 100% rename from wxm-ios/Resources/Colors.xcassets/otherRewardPrimary.colorset/Contents.json rename to wxm-ios/Resources/Colors.xcassets/Boosts/otherRewardPrimary.colorset/Contents.json diff --git a/wxm-ios/Resources/Colors.xcassets/Boosts/troRewardsFill.colorset/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/troRewardsFill.colorset/Contents.json new file mode 100644 index 000000000..242723f9c --- /dev/null +++ b/wxm-ios/Resources/Colors.xcassets/Boosts/troRewardsFill.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x62", + "green" : "0x2F", + "red" : "0xAA" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/wxm-ios/Resources/Colors.xcassets/Boosts/troRewardsPrimary.colorset/Contents.json b/wxm-ios/Resources/Colors.xcassets/Boosts/troRewardsPrimary.colorset/Contents.json new file mode 100644 index 000000000..541e53990 --- /dev/null +++ b/wxm-ios/Resources/Colors.xcassets/Boosts/troRewardsPrimary.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0x3E", + "red" : "0xDE" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} From 7cd915b661058cebb91fbb3551c08fa0d243ff25 Mon Sep 17 00:00:00 2001 From: Pantelis Giazitsis Date: Wed, 8 Oct 2025 11:27:17 +0300 Subject: [PATCH 2/6] Show only available detail fields --- .../Screens/StationRewardDetailsView.swift | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/PresentationLayer/UIComponents/Screens/StationRewardDetailsView.swift b/PresentationLayer/UIComponents/Screens/StationRewardDetailsView.swift index 9da1f15b5..f5d889927 100644 --- a/PresentationLayer/UIComponents/Screens/StationRewardDetailsView.swift +++ b/PresentationLayer/UIComponents/Screens/StationRewardDetailsView.swift @@ -31,12 +31,27 @@ struct StationRewardDetailsView: View { .frame(height: 24) } - BoostDetailsView(items: [.init(title: LocalizableString.RewardAnalytics.totalTokensEarnedSoFar.localized, - value: (details.currentRewards ?? 0).toWXMTokenPrecisionString + " " + StringConstants.wxmCurrency), - .init(title: LocalizableString.Boosts.totalTokensToBeRewarded.localized, - value: (details.totalRewards ?? 0).toWXMTokenPrecisionString + " " + StringConstants.wxmCurrency), - .init(title: LocalizableString.Boosts.boostPeriod.localized, - value: "\(details.boostStartDateString) - \(details.boostStopDateString)")]) + BoostDetailsView(items: boostDetailsItems) } } } + +private extension StationRewardDetailsView { + var boostDetailsItems: [BoostDetailsView.Item] { + var items = [BoostDetailsView.Item]() + if let currentRewards = details.currentRewards { + items.append(.init(title: LocalizableString.RewardAnalytics.totalTokensEarnedSoFar.localized, + value: currentRewards.toWXMTokenPrecisionString + " " + StringConstants.wxmCurrency)) + } + + if let totalRewards = details.totalRewards { + items.append(.init(title: LocalizableString.Boosts.totalTokensToBeRewarded.localized, + value: totalRewards.toWXMTokenPrecisionString + " " + StringConstants.wxmCurrency)) + } + + items.append(.init(title: LocalizableString.Boosts.boostPeriod.localized, + value: "\(details.boostStartDateString) - \(details.boostStopDateString)")) + + return items + } +} From 7562c2e5aaee8a9dfba0de98b37066590a6eccee Mon Sep 17 00:00:00 2001 From: Pantelis Giazitsis Date: Wed, 8 Oct 2025 11:45:18 +0300 Subject: [PATCH 3/6] Handle tro in reward details --- .../Screens/DailyRewards/RewardDetailsViewModel.swift | 2 +- .../Networking/Mock/Jsons/get_reward_details.json | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/PresentationLayer/UIComponents/Screens/DailyRewards/RewardDetailsViewModel.swift b/PresentationLayer/UIComponents/Screens/DailyRewards/RewardDetailsViewModel.swift index 0a7bef5b5..e652075e9 100644 --- a/PresentationLayer/UIComponents/Screens/DailyRewards/RewardDetailsViewModel.swift +++ b/PresentationLayer/UIComponents/Screens/DailyRewards/RewardDetailsViewModel.swift @@ -224,7 +224,7 @@ class RewardDetailsViewModel: ObservableObject { func handleBoostTap(boost: NetworkDeviceRewardDetailsResponse.BoostReward) { switch boost.code { - case .betaReward, .correction: + case .betaReward, .correction, .tro: let viewModel = ViewModelsFactory.getRewardsBoostViewModel(boost: boost, device: device, date: rewardDetailsResponse?.timestamp) Router.shared.navigateTo(.rewardBoosts(viewModel)) default: diff --git a/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_reward_details.json b/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_reward_details.json index 91642f5d3..a19297fbb 100644 --- a/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_reward_details.json +++ b/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_reward_details.json @@ -31,6 +31,14 @@ "actual_reward": 1.23, "reward_score": 50, "max_reward": 2.46 + }, + { + "code": "tro", + "title": "Rollout", + "description": "Targeted rollout", + "img_url": "https://i0.wp.com/weatherxm.com/wp-content/uploads/2023/12/Home-header-image-1200-x-1200-px-2.png", + "doc_url": "https://docs.weatherxm.com", + "actual_reward": 1.23, } ] }, From ba72dcaafb218c927cf6a32a4da71ef192c18238 Mon Sep 17 00:00:00 2001 From: Pantelis Giazitsis Date: Wed, 8 Oct 2025 11:57:03 +0300 Subject: [PATCH 4/6] Updated boost view layout --- .../DailyRewards/Components/BoostsView.swift | 19 ++++++++++++++++--- .../Localizable+RewardDetails.swift | 3 +++ .../Localizable/Localizable.xcstrings | 11 +++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/PresentationLayer/UIComponents/Screens/DailyRewards/Components/BoostsView.swift b/PresentationLayer/UIComponents/Screens/DailyRewards/Components/BoostsView.swift index 5f3d06ce8..16bc46295 100644 --- a/PresentationLayer/UIComponents/Screens/DailyRewards/Components/BoostsView.swift +++ b/PresentationLayer/UIComponents/Screens/DailyRewards/Components/BoostsView.swift @@ -22,9 +22,14 @@ struct BoostsView: View { .foregroundColor(Color(colorEnum: .textWhite)) Spacer() - Text("+ \(rewards.toWXMTokenPrecisionString) \(StringConstants.wxmCurrency)") - .font(.system(size: CGFloat(.caption), weight: .medium)) - .foregroundColor(Color(colorEnum: .textWhite)) + HStack(spacing: CGFloat(.minimumSpacing)) { + Text(LocalizableString.RewardDetails.boostSeeDetails.localized) + .font(.system(size: CGFloat(.caption))) + + Text(FontIcon.chevronRight.rawValue) + .font(.fontAwesome(font: .FAPro, size: CGFloat(.caption))) + } + .foregroundStyle(Color(colorEnum: .textWhite)) } HStack { @@ -34,6 +39,14 @@ struct BoostsView: View { Spacer() } + + HStack { + Text("+ \(rewards.toWXMTokenPrecisionString) \(StringConstants.wxmCurrency)") + .font(.system(size: CGFloat(.caption), weight: .medium)) + .foregroundColor(Color(colorEnum: .textWhite)) + + Spacer() + } } .padding(CGFloat(.defaultSidePadding)) .background { diff --git a/wxm-ios/Resources/Localizable/Localizable+RewardDetails.swift b/wxm-ios/Resources/Localizable/Localizable+RewardDetails.swift index a85daf257..240a82c4e 100644 --- a/wxm-ios/Resources/Localizable/Localizable+RewardDetails.swift +++ b/wxm-ios/Resources/Localizable/Localizable+RewardDetails.swift @@ -68,6 +68,7 @@ extension LocalizableString { case contactSupportButtonTitle case unhandledBoostMessage case rewardsBoostFailedTitle + case boostSeeDetails } } @@ -229,6 +230,8 @@ extension LocalizableString.RewardDetails: WXMLocalizable { return "reward_details_unhandled_boost_message" case .rewardsBoostFailedTitle: return "reward_details_rewards_boost_failed_title" + case .boostSeeDetails: + return "reward_details_boost_see_details" } } } diff --git a/wxm-ios/Resources/Localizable/Localizable.xcstrings b/wxm-ios/Resources/Localizable/Localizable.xcstrings index 61c178912..e8eb126da 100644 --- a/wxm-ios/Resources/Localizable/Localizable.xcstrings +++ b/wxm-ios/Resources/Localizable/Localizable.xcstrings @@ -8679,6 +8679,17 @@ } } }, + "reward_details_boost_see_details" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "See details" + } + } + } + }, "reward_details_cell_position" : { "extractionState" : "manual", "localizations" : { From 4effe0b56a0744bcd9eefeb9e78dc82372eec1d8 Mon Sep 17 00:00:00 2001 From: Pantelis Giazitsis Date: Wed, 8 Oct 2025 13:26:31 +0300 Subject: [PATCH 5/6] Fixed the way we create details view items --- .../RewardBoosts/RewardBoostsView.swift | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/PresentationLayer/UIComponents/Screens/RewardBoosts/RewardBoostsView.swift b/PresentationLayer/UIComponents/Screens/RewardBoosts/RewardBoostsView.swift index a50b7be2f..9a7d73bf8 100644 --- a/PresentationLayer/UIComponents/Screens/RewardBoosts/RewardBoostsView.swift +++ b/PresentationLayer/UIComponents/Screens/RewardBoosts/RewardBoostsView.swift @@ -7,6 +7,7 @@ import SwiftUI import Toolkit +import DomainLayer struct RewardBoostsView: View { @StateObject var viewModel: RewardBoostsViewModel @@ -74,14 +75,7 @@ private extension RewardBoostsView { .overlay(Color(colorEnum: .layer2)) } - BoostDetailsView(items: [.init(title: LocalizableString.Boosts.rewardableStationHours.localized, - value: (details.stationHours ?? 0).localizedFormatted), - .init(title: LocalizableString.Boosts.dailyTokensToBeRewarded.localized, - value: "\((details.maxDailyReward ?? 0.0).toWXMTokenPrecisionString) \(StringConstants.wxmCurrency)"), - .init(title: LocalizableString.Boosts.totalTokensToBeRewarded.localized, - value: "\((details.maxTotalReward ?? 0.0).toWXMTokenPrecisionString) \(StringConstants.wxmCurrency)"), - .init(title: LocalizableString.Boosts.boostPeriod.localized, - value: "\(details.boostStartDateString) - \(details.boostStopDateString)")]) + BoostDetailsView(items: getDetailsItems(details: details)) } } } @@ -132,6 +126,30 @@ private extension RewardBoostsView { } .WXMCardStyle() } + + func getDetailsItems(details: NetworkDeviceRewardBoostsResponse.Details) -> [BoostDetailsView.Item] { + var items = [BoostDetailsView.Item]() + + if let stationHours = details.stationHours { + items.append(.init(title: LocalizableString.Boosts.rewardableStationHours.localized, + value: stationHours.localizedFormatted)) + } + + if let maxDailyReward = details.maxDailyReward { + items.append(.init(title: LocalizableString.Boosts.dailyTokensToBeRewarded.localized, + value: "\(maxDailyReward.toWXMTokenPrecisionString) \(StringConstants.wxmCurrency)")) + } + + if let maxTotalReward = details.maxTotalReward { + items.append(.init(title: LocalizableString.Boosts.totalTokensToBeRewarded.localized, + value: "\(maxTotalReward.toWXMTokenPrecisionString) \(StringConstants.wxmCurrency)")) + } + + items.append(.init(title: LocalizableString.Boosts.boostPeriod.localized, + value: "\(details.boostStartDateString) - \(details.boostStopDateString)")) + + return items + } } #Preview { From d8b0ffb58979f792ac0c35dc6c3764c9fc1fbb46 Mon Sep 17 00:00:00 2001 From: Pantelis Giazitsis Date: Thu, 9 Oct 2025 16:44:57 +0300 Subject: [PATCH 6/6] Updated tro case value --- .../DomainExtensions/BoostCode+.swift | 14 ++++++------ .../DailyRewards/RewardDetailsViewModel.swift | 2 +- .../Screens/StationRewardDetailsView.swift | 15 +++++++------ .../get_device_rewards_analytics_7d.json | 16 ++++++-------- .../Mock/Jsons/get_reward_details.json | 7 +++--- .../NetworkDeviceRewardDetailsResponse.swift | 10 ++++----- .../Localizable/Localizable.xcstrings | 22 +++++++++++++++++++ .../LocalizableString+RewardAnalytics.swift | 6 +++++ 8 files changed, 60 insertions(+), 32 deletions(-) diff --git a/PresentationLayer/Extensions/DomainExtensions/BoostCode+.swift b/PresentationLayer/Extensions/DomainExtensions/BoostCode+.swift index 4e1d92df7..9d2575310 100644 --- a/PresentationLayer/Extensions/DomainExtensions/BoostCode+.swift +++ b/PresentationLayer/Extensions/DomainExtensions/BoostCode+.swift @@ -13,8 +13,8 @@ extension BoostCode { switch self { case .betaReward: return LocalizableString.RewardAnalytics.beta.localized - case .tro: - return "Rollouts" + case .trov2: + return LocalizableString.RewardAnalytics.rollouts.localized case .correction: return LocalizableString.RewardAnalytics.compensation.localized case .unknown: @@ -26,7 +26,7 @@ extension BoostCode { switch self { case .betaReward: return .betaRewardsPrimary - case .tro: + case .trov2: return .troRewardsPrimary case .correction: return .correctionRewardsPrimary @@ -39,7 +39,7 @@ extension BoostCode { switch self { case .betaReward: return .betaRewardsFill - case .tro: + case .trov2: return .troRewardsFill case .correction: return .correctionRewardsFill @@ -52,7 +52,7 @@ extension BoostCode { switch self { case .betaReward: return .betaRewardsPrimary - case .tro: + case .trov2: return .troRewardsPrimary case .correction: return .correctionRewardsFill @@ -65,8 +65,8 @@ extension BoostCode { switch self { case .betaReward: return LocalizableString.RewardAnalytics.betaRewards.localized - case .tro: - return "Rollouts" + case .trov2: + return LocalizableString.RewardAnalytics.rolloutsRewards.localized case .correction: return LocalizableString.RewardAnalytics.compensationRewards.localized case .unknown: diff --git a/PresentationLayer/UIComponents/Screens/DailyRewards/RewardDetailsViewModel.swift b/PresentationLayer/UIComponents/Screens/DailyRewards/RewardDetailsViewModel.swift index e652075e9..07053d241 100644 --- a/PresentationLayer/UIComponents/Screens/DailyRewards/RewardDetailsViewModel.swift +++ b/PresentationLayer/UIComponents/Screens/DailyRewards/RewardDetailsViewModel.swift @@ -224,7 +224,7 @@ class RewardDetailsViewModel: ObservableObject { func handleBoostTap(boost: NetworkDeviceRewardDetailsResponse.BoostReward) { switch boost.code { - case .betaReward, .correction, .tro: + case .betaReward, .correction, .trov2: let viewModel = ViewModelsFactory.getRewardsBoostViewModel(boost: boost, device: device, date: rewardDetailsResponse?.timestamp) Router.shared.navigateTo(.rewardBoosts(viewModel)) default: diff --git a/PresentationLayer/UIComponents/Screens/StationRewardDetailsView.swift b/PresentationLayer/UIComponents/Screens/StationRewardDetailsView.swift index f5d889927..dd1a96a4e 100644 --- a/PresentationLayer/UIComponents/Screens/StationRewardDetailsView.swift +++ b/PresentationLayer/UIComponents/Screens/StationRewardDetailsView.swift @@ -22,13 +22,14 @@ struct StationRewardDetailsView: View { Spacer() } - let progress = details.completedPercentage ?? 0 - ProgressView(value: Float(progress), total: 100) - .progressViewStyle(ProgressBarStyle(text: "\(progress)%", - textColor: Color(colorEnum: .textDarkStable), - bgColor: Color(colorEnum: code.primaryColor), - progressColor: Color(colorEnum: code.fillColor))) - .frame(height: 24) + if let progress = details.completedPercentage { + ProgressView(value: Float(progress), total: 100) + .progressViewStyle(ProgressBarStyle(text: "\(progress)%", + textColor: Color(colorEnum: .textDarkStable), + bgColor: Color(colorEnum: code.primaryColor), + progressColor: Color(colorEnum: code.fillColor))) + .frame(height: 24) + } } BoostDetailsView(items: boostDetailsItems) diff --git a/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_rewards_analytics_7d.json b/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_rewards_analytics_7d.json index a5f2be270..f9af7b85e 100644 --- a/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_rewards_analytics_7d.json +++ b/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_rewards_analytics_7d.json @@ -61,7 +61,7 @@ }, { "type": "boost", - "code": "tro", + "code": "trov2", "value": 1.4353223 } ] @@ -86,7 +86,7 @@ }, { "type": "boost", - "code": "tro", + "code": "trov2", "value": 0.4353223 } ] @@ -106,7 +106,7 @@ }, { "type": "boost", - "code": "tro", + "code": "trov2", "value": 1.2 } ] @@ -126,7 +126,7 @@ }, { "type": "boost", - "code": "tro", + "code": "trov2", "value": 0.6353223 } ] @@ -160,12 +160,10 @@ "completed_percentage": 100 }, { - "code": "tro", - "type": "tro", - "current_rewards": 2.017276, + "code": "trov2", + "type": "TROv2", "boost_period_start": "2025-09-10T00:00:00.000Z", - "boost_period_end": "2025-09-11T00:00:00.000Z", - "completed_percentage": 47 + "boost_period_end": "2025-09-11T00:00:00.000Z" } ] } diff --git a/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_reward_details.json b/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_reward_details.json index a19297fbb..2b947fba1 100644 --- a/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_reward_details.json +++ b/wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_reward_details.json @@ -33,12 +33,13 @@ "max_reward": 2.46 }, { - "code": "tro", - "title": "Rollout", - "description": "Targeted rollout", + "code": "trov2", + "title": "TROv2 Rewards", + "description": "A reward boost used to distribute additional rewards to TROv2 devices", "img_url": "https://i0.wp.com/weatherxm.com/wp-content/uploads/2023/12/Home-header-image-1200-x-1200-px-2.png", "doc_url": "https://docs.weatherxm.com", "actual_reward": 1.23, + "reward_score": 100 } ] }, diff --git a/wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Me/Network/NetworkDeviceRewardDetailsResponse.swift b/wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Me/Network/NetworkDeviceRewardDetailsResponse.swift index c46d7cb18..c96051eeb 100644 --- a/wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Me/Network/NetworkDeviceRewardDetailsResponse.swift +++ b/wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Me/Network/NetworkDeviceRewardDetailsResponse.swift @@ -114,15 +114,15 @@ public extension NetworkDeviceRewardDetailsResponse { public enum BoostCode: Codable, RawRepresentable, Hashable, Comparable, Sendable { case betaReward case correction(String) - case tro + case trov2 case unknown(String) public init?(rawValue: String) { switch rawValue { case "beta_rewards": self = .betaReward - case "tro": - self = .tro + case "trov2": + self = .trov2 case let str where str.hasPrefix("correction"): self = .correction(rawValue) default: @@ -134,8 +134,8 @@ public enum BoostCode: Codable, RawRepresentable, Hashable, Comparable, Sendable switch self { case .betaReward: return "beta_rewards" - case .tro: - return "tro" + case .trov2: + return "trov2" case .correction(let raw): return raw case .unknown(let raw): diff --git a/wxm-ios/Resources/Localizable/Localizable.xcstrings b/wxm-ios/Resources/Localizable/Localizable.xcstrings index e8eb126da..dd8f6e543 100644 --- a/wxm-ios/Resources/Localizable/Localizable.xcstrings +++ b/wxm-ios/Resources/Localizable/Localizable.xcstrings @@ -8580,6 +8580,28 @@ } } }, + "reward_analytics_rollouts" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Rollouts" + } + } + } + }, + "reward_analytics_rollouts_rewards" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Rollouts Rewards" + } + } + } + }, "reward_analytics_station_rewards" : { "extractionState" : "manual", "localizations" : { diff --git a/wxm-ios/Resources/Localizable/LocalizableString+RewardAnalytics.swift b/wxm-ios/Resources/Localizable/LocalizableString+RewardAnalytics.swift index 0a135f70d..fcbc5299e 100644 --- a/wxm-ios/Resources/Localizable/LocalizableString+RewardAnalytics.swift +++ b/wxm-ios/Resources/Localizable/LocalizableString+RewardAnalytics.swift @@ -20,6 +20,8 @@ extension LocalizableString { case details(String) case betaRewards case beta + case rollouts + case rolloutsRewards case compensation case compensationRewards case totalTokensEarnedSoFar @@ -74,6 +76,10 @@ extension LocalizableString.RewardAnalytics: WXMLocalizable { return "reward_analytics_beta_rewards" case .beta: return "reward_analytics_beta" + case .rollouts: + return "reward_analytics_rollouts" + case .rolloutsRewards: + return "reward_analytics_rollouts_rewards" case .compensation: return "reward_analytics_compensation" case .compensationRewards: