From 5ad709dcd3ff26c3d66092a87ba02125c0f11962 Mon Sep 17 00:00:00 2001 From: Joseph Roque Date: Thu, 26 Oct 2023 17:37:23 -0700 Subject: [PATCH 1/2] Chore: Introduce statistics issues report feature flag --- ios/Approach/Sources/FeatureFlagsLibrary/FeatureFlags.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ios/Approach/Sources/FeatureFlagsLibrary/FeatureFlags.swift b/ios/Approach/Sources/FeatureFlagsLibrary/FeatureFlags.swift index 1e04a5bc4..580caf0b3 100644 --- a/ios/Approach/Sources/FeatureFlagsLibrary/FeatureFlags.swift +++ b/ios/Approach/Sources/FeatureFlagsLibrary/FeatureFlags.swift @@ -22,6 +22,7 @@ extension FeatureFlag { public static let dataExport = Self(name: "dataExport", introduced: "2023-09-17", stage: .release) public static let dataImport = Self(name: "dataImport", introduced: "2023-09-17", stage: .development) public static let statisticsDescriptions = Self(name: "statisticsDescriptions", introduced: "2023-10-06", stage: .release) + public static let statisticsIssueReports = Self(name: "statisticsIssueReports", introduced: "2023-10-26", stage: .development) public static let allFlags: [Self] = [ .accessoriesTab, @@ -43,6 +44,7 @@ extension FeatureFlag { .sharingGame, .sharingSeries, .statisticsDescriptions, + .statisticsIssueReports, .statisticsTab, .teams, ] From 88fdf37abb3e33a8c0bab670d173c0d8c9accbb1 Mon Sep 17 00:00:00 2001 From: Joseph Roque Date: Thu, 26 Oct 2023 17:52:09 -0700 Subject: [PATCH 2/2] Feat: Add report issue button to StatisticsDetailsList --- .../Data/StatisticsDetailsList.swift | 29 +++++++++++++++++++ .../StringsLibrary/Strings+Generated.swift | 4 +++ .../en.lproj/Localizable.strings | 1 + 3 files changed, 34 insertions(+) diff --git a/ios/Approach/Sources/StatisticsDetailsFeature/Data/StatisticsDetailsList.swift b/ios/Approach/Sources/StatisticsDetailsFeature/Data/StatisticsDetailsList.swift index 0faecdc90..2b113bbe0 100644 --- a/ios/Approach/Sources/StatisticsDetailsFeature/Data/StatisticsDetailsList.swift +++ b/ios/Approach/Sources/StatisticsDetailsFeature/Data/StatisticsDetailsList.swift @@ -21,6 +21,7 @@ public struct StatisticsDetailsList: Reducer { public var entryToHighlight: Statistics.ListEntry.ID? public let hasTappableElements: Bool + public let isStatisticsIssueReportsEnabled: Bool public let isStatisticsDescriptionsEnabled: Bool public var isShowingStatisticDescriptionTip: Bool @@ -30,6 +31,7 @@ public struct StatisticsDetailsList: Reducer { @Dependency(\.featureFlags) var featureFlags self.isStatisticsDescriptionsEnabled = featureFlags.isEnabled(.statisticsDescriptions) + self.isStatisticsIssueReportsEnabled = featureFlags.isEnabled(.statisticsIssueReports) @Dependency(\.preferences) var preferences self.isHidingZeroStatistics = preferences.bool(forKey: .statisticsHideZeroStatistics) ?? true @@ -44,6 +46,7 @@ public struct StatisticsDetailsList: Reducer { public enum ViewAction: BindableAction, Equatable { case didTapEntry(id: String) case didTapDismissDescriptionsTip + case didTapReportIssue case binding(BindingAction) } public enum DelegateAction: Equatable { @@ -79,6 +82,10 @@ public struct StatisticsDetailsList: Reducer { case let .didTapEntry(id): return .send(.delegate(.didRequestEntryDetails(id: id))) + case .didTapReportIssue: + // TODO: report issue + return .none + case .didTapDismissDescriptionsTip: state.isShowingStatisticDescriptionTip = false return .run { _ in await tips.hide(tipFor: .statisticsDescriptionTip) } @@ -239,6 +246,28 @@ public struct StatisticsDetailsListView: View { Text(Strings.Statistics.List.StatisticsDescription.help) } } + + if viewStore.isStatisticsIssueReportsEnabled { + Section { + Button { viewStore.send(.didTapReportIssue) } label: { + HStack { + Image(systemSymbol: .exclamationmarkBubble) + .resizable() + .scaledToFit() + .frame(width: .extraTinyIcon, height: .extraTinyIcon) + .foregroundColor(Asset.Colors.Error.default) + + Text(Strings.Statistics.List.Issues.report) + .font(.caption) + .opacity(0.7) + } + .contentShape(Rectangle()) + } + .buttonStyle(TappableElement()) + } + .listRowInsets(EdgeInsets()) + .listRowBackground(Color.clear) + } } .onChange(of: viewStore.entryToHighlight) { guard let id = $0 else { return } diff --git a/ios/Approach/Sources/StringsLibrary/Strings+Generated.swift b/ios/Approach/Sources/StringsLibrary/Strings+Generated.swift index c8d7d7963..60c9f17b0 100644 --- a/ios/Approach/Sources/StringsLibrary/Strings+Generated.swift +++ b/ios/Approach/Sources/StringsLibrary/Strings+Generated.swift @@ -1629,6 +1629,10 @@ public enum Strings { /// Some statistics have been hidden from the list because they were empty. You can choose to show these statistics to get a better view of your play. public static let help = Strings.tr("Localizable", "statistics.list.hideZeroStatistics.help", fallback: "Some statistics have been hidden from the list because they were empty. You can choose to show these statistics to get a better view of your play.") } + public enum Issues { + /// Noticed something wrong with your statistics? Send an email by tapping here. It will automatically include details about your game and the statistics + public static let report = Strings.tr("Localizable", "statistics.list.issues.report", fallback: "Noticed something wrong with your statistics? Send an email by tapping here. It will automatically include details about your game and the statistics") + } public enum StatisticsDescription { /// You can hide the descriptions to see more stats at once. public static let help = Strings.tr("Localizable", "statistics.list.statisticsDescription.help", fallback: "You can hide the descriptions to see more stats at once.") diff --git a/ios/Approach/Sources/StringsLibrary/en.lproj/Localizable.strings b/ios/Approach/Sources/StringsLibrary/en.lproj/Localizable.strings index d5cdf4887..bcde0cfd6 100644 --- a/ios/Approach/Sources/StringsLibrary/en.lproj/Localizable.strings +++ b/ios/Approach/Sources/StringsLibrary/en.lproj/Localizable.strings @@ -319,6 +319,7 @@ "statistics.list.statisticsDescription" = "Hide descriptions?"; "statistics.list.statisticsDescription.help" = "You can hide the descriptions to see more stats at once."; "statistics.list.new" = "New"; +"statistics.list.issues.report" = "Noticed something wrong with your statistics? Send an email by tapping here. It will automatically include details about your game and the statistics"; "statistics.picker.title" = "Statistic"; "statistics.filter.filterByGame" = "Filter by game"; "statistics.filter.allGames" = "All games";