Do not distinguish log and crash log anymore.
This commit is contained in:
committed by
Benoit Marty
parent
1c6aa43bea
commit
5accd9f139
@@ -23,7 +23,6 @@ sealed interface BugReportEvents {
|
||||
|
||||
data class SetDescription(val description: String) : BugReportEvents
|
||||
data class SetSendLog(val sendLog: Boolean) : BugReportEvents
|
||||
data class SetSendCrashLog(val sendCrashlog: Boolean) : BugReportEvents
|
||||
data class SetCanContact(val canContact: Boolean) : BugReportEvents
|
||||
data class SetSendScreenshot(val sendScreenshot: Boolean) : BugReportEvents
|
||||
}
|
||||
|
||||
@@ -100,9 +100,6 @@ class BugReportPresenter @Inject constructor(
|
||||
is BugReportEvents.SetCanContact -> updateFormState(formState) {
|
||||
copy(canContact = event.canContact)
|
||||
}
|
||||
is BugReportEvents.SetSendCrashLog -> updateFormState(formState) {
|
||||
copy(sendCrashLogs = event.sendCrashlog)
|
||||
}
|
||||
is BugReportEvents.SetSendLog -> updateFormState(formState) {
|
||||
copy(sendLogs = event.sendLog)
|
||||
}
|
||||
@@ -138,7 +135,7 @@ class BugReportPresenter @Inject constructor(
|
||||
bugReporter.sendBugReport(
|
||||
reportType = ReportType.BUG_REPORT,
|
||||
withDevicesLogs = formState.sendLogs,
|
||||
withCrashLogs = hasCrashLogs && formState.sendCrashLogs,
|
||||
withCrashLogs = hasCrashLogs && formState.sendLogs,
|
||||
withKeyRequestHistory = false,
|
||||
withScreenshot = formState.sendScreenshot,
|
||||
theBugDescription = formState.description,
|
||||
|
||||
@@ -36,7 +36,6 @@ data class BugReportState(
|
||||
data class BugReportFormState(
|
||||
val description: String,
|
||||
val sendLogs: Boolean,
|
||||
val sendCrashLogs: Boolean,
|
||||
val canContact: Boolean,
|
||||
val sendScreenshot: Boolean
|
||||
) : Parcelable {
|
||||
@@ -44,7 +43,6 @@ data class BugReportFormState(
|
||||
val Default = BugReportFormState(
|
||||
description = "",
|
||||
sendLogs = true,
|
||||
sendCrashLogs = true,
|
||||
canContact = false,
|
||||
sendScreenshot = false
|
||||
)
|
||||
|
||||
@@ -111,14 +111,6 @@ fun BugReportView(
|
||||
enabled = isFormEnabled,
|
||||
title = stringResource(id = R.string.screen_bug_report_include_logs),
|
||||
)
|
||||
if (state.hasCrashLogs) {
|
||||
PreferenceSwitch(
|
||||
isChecked = state.formState.sendCrashLogs,
|
||||
onCheckedChange = { eventSink(BugReportEvents.SetSendCrashLog(it)) },
|
||||
enabled = isFormEnabled,
|
||||
title = stringResource(id = R.string.screen_bug_report_include_crash_logs),
|
||||
)
|
||||
}
|
||||
PreferenceSwitch(
|
||||
isChecked = state.formState.canContact,
|
||||
onCheckedChange = { eventSink(BugReportEvents.SetCanContact(it)) },
|
||||
|
||||
@@ -92,26 +92,6 @@ class BugReportPresenterTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `present - send crash logs`() = runTest {
|
||||
val presenter = BugReportPresenter(
|
||||
FakeBugReporter(),
|
||||
FakeCrashDataStore(),
|
||||
FakeScreenshotHolder(),
|
||||
this,
|
||||
)
|
||||
moleculeFlow(RecompositionClock.Immediate) {
|
||||
presenter.present()
|
||||
}.test {
|
||||
val initialState = awaitItem()
|
||||
// Since this is true by default, start by disabling
|
||||
initialState.eventSink.invoke(BugReportEvents.SetSendCrashLog(false))
|
||||
assertThat(awaitItem().formState).isEqualTo(BugReportFormState.Default.copy(sendCrashLogs = false))
|
||||
initialState.eventSink.invoke(BugReportEvents.SetSendCrashLog(true))
|
||||
assertThat(awaitItem().formState).isEqualTo(BugReportFormState.Default.copy(sendCrashLogs = true))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `present - send logs`() = runTest {
|
||||
val presenter = BugReportPresenter(
|
||||
|
||||
Reference in New Issue
Block a user