Fix a crash when attempting to send a bug report with excessively large logs. (#4243)

* Alert the user when there are excessively large log files.
This commit is contained in:
Doug
2025-06-24 09:47:20 +01:00
committed by GitHub
parent 0bf6ed1c63
commit 0f9d700c99
10 changed files with 50 additions and 16 deletions
@@ -14,6 +14,7 @@ struct BugReportScreen: View {
@Bindable var context: BugReportScreenViewModel.Context
var canSendLogFiles: Bool { context.viewState.canSendLogFiles }
var photosPickerTitle: String { context.viewState.screenshot == nil ? L10n.screenBugReportAttachScreenshot : L10n.screenBugReportEditScreenshot }
var body: some View {
@@ -56,15 +57,23 @@ struct BugReportScreen: View {
private var sendLogsSection: some View {
Section {
ListRow(label: .plain(title: L10n.screenBugReportIncludeLogs),
kind: .toggle($context.sendingLogsEnabled))
.accessibilityIdentifier(A11yIdentifiers.bugReportScreen.sendLogs)
if canSendLogFiles {
ListRow(label: .plain(title: L10n.screenBugReportIncludeLogs),
kind: .toggle($context.sendingLogsEnabled))
.accessibilityIdentifier(A11yIdentifiers.bugReportScreen.sendLogs)
}
ListRow(label: .plain(title: L10n.screenBugReportViewLogs),
kind: .navigationLink { context.send(viewAction: .viewLogs) })
.accessibilityIdentifier(A11yIdentifiers.bugReportScreen.sendLogs)
} footer: {
Text(L10n.screenBugReportLogsDescription)
.compoundListSectionFooter()
if canSendLogFiles {
Text(L10n.screenBugReportLogsDescription)
.compoundListSectionFooter()
} else {
Label(L10n.screenBugReportIncludeLogsError, icon: \.errorSolid, iconSize: .xSmall, relativeTo: .compound.bodySM)
.foregroundStyle(.compound.textCriticalPrimary)
.compoundListSectionFooter()
}
}
}