Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add Report button to Statistics list #365

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ios/Approach/Sources/FeatureFlagsLibrary/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -43,6 +44,7 @@ extension FeatureFlag {
.sharingGame,
.sharingSeries,
.statisticsDescriptions,
.statisticsIssueReports,
.statisticsTab,
.teams,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -44,6 +46,7 @@ public struct StatisticsDetailsList: Reducer {
public enum ViewAction: BindableAction, Equatable {
case didTapEntry(id: String)
case didTapDismissDescriptionsTip
case didTapReportIssue
case binding(BindingAction<State>)
}
public enum DelegateAction: Equatable {
Expand Down Expand Up @@ -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) }
Expand Down Expand Up @@ -239,6 +246,28 @@ public struct StatisticsDetailsListView<Header: View>: 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 }
Expand Down
4 changes: 4 additions & 0 deletions ios/Approach/Sources/StringsLibrary/Strings+Generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down