Do not distinguish log and crash log anymore.
This commit is contained in:
parent
1c6aa43bea
commit
5accd9f139
5 changed files with 1 additions and 35 deletions
|
|
@ -23,7 +23,6 @@ sealed interface BugReportEvents {
|
||||||
|
|
||||||
data class SetDescription(val description: String) : BugReportEvents
|
data class SetDescription(val description: String) : BugReportEvents
|
||||||
data class SetSendLog(val sendLog: Boolean) : BugReportEvents
|
data class SetSendLog(val sendLog: Boolean) : BugReportEvents
|
||||||
data class SetSendCrashLog(val sendCrashlog: Boolean) : BugReportEvents
|
|
||||||
data class SetCanContact(val canContact: Boolean) : BugReportEvents
|
data class SetCanContact(val canContact: Boolean) : BugReportEvents
|
||||||
data class SetSendScreenshot(val sendScreenshot: Boolean) : BugReportEvents
|
data class SetSendScreenshot(val sendScreenshot: Boolean) : BugReportEvents
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,6 @@ class BugReportPresenter @Inject constructor(
|
||||||
is BugReportEvents.SetCanContact -> updateFormState(formState) {
|
is BugReportEvents.SetCanContact -> updateFormState(formState) {
|
||||||
copy(canContact = event.canContact)
|
copy(canContact = event.canContact)
|
||||||
}
|
}
|
||||||
is BugReportEvents.SetSendCrashLog -> updateFormState(formState) {
|
|
||||||
copy(sendCrashLogs = event.sendCrashlog)
|
|
||||||
}
|
|
||||||
is BugReportEvents.SetSendLog -> updateFormState(formState) {
|
is BugReportEvents.SetSendLog -> updateFormState(formState) {
|
||||||
copy(sendLogs = event.sendLog)
|
copy(sendLogs = event.sendLog)
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +135,7 @@ class BugReportPresenter @Inject constructor(
|
||||||
bugReporter.sendBugReport(
|
bugReporter.sendBugReport(
|
||||||
reportType = ReportType.BUG_REPORT,
|
reportType = ReportType.BUG_REPORT,
|
||||||
withDevicesLogs = formState.sendLogs,
|
withDevicesLogs = formState.sendLogs,
|
||||||
withCrashLogs = hasCrashLogs && formState.sendCrashLogs,
|
withCrashLogs = hasCrashLogs && formState.sendLogs,
|
||||||
withKeyRequestHistory = false,
|
withKeyRequestHistory = false,
|
||||||
withScreenshot = formState.sendScreenshot,
|
withScreenshot = formState.sendScreenshot,
|
||||||
theBugDescription = formState.description,
|
theBugDescription = formState.description,
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ data class BugReportState(
|
||||||
data class BugReportFormState(
|
data class BugReportFormState(
|
||||||
val description: String,
|
val description: String,
|
||||||
val sendLogs: Boolean,
|
val sendLogs: Boolean,
|
||||||
val sendCrashLogs: Boolean,
|
|
||||||
val canContact: Boolean,
|
val canContact: Boolean,
|
||||||
val sendScreenshot: Boolean
|
val sendScreenshot: Boolean
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
|
|
@ -44,7 +43,6 @@ data class BugReportFormState(
|
||||||
val Default = BugReportFormState(
|
val Default = BugReportFormState(
|
||||||
description = "",
|
description = "",
|
||||||
sendLogs = true,
|
sendLogs = true,
|
||||||
sendCrashLogs = true,
|
|
||||||
canContact = false,
|
canContact = false,
|
||||||
sendScreenshot = false
|
sendScreenshot = false
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -111,14 +111,6 @@ fun BugReportView(
|
||||||
enabled = isFormEnabled,
|
enabled = isFormEnabled,
|
||||||
title = stringResource(id = R.string.screen_bug_report_include_logs),
|
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(
|
PreferenceSwitch(
|
||||||
isChecked = state.formState.canContact,
|
isChecked = state.formState.canContact,
|
||||||
onCheckedChange = { eventSink(BugReportEvents.SetCanContact(it)) },
|
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
|
@Test
|
||||||
fun `present - send logs`() = runTest {
|
fun `present - send logs`() = runTest {
|
||||||
val presenter = BugReportPresenter(
|
val presenter = BugReportPresenter(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue