Skip to content

Commit

Permalink
bugfix: do not remove logs after sending them
Browse files Browse the repository at this point in the history
  • Loading branch information
ganfra committed Oct 31, 2024
1 parent a772f00 commit 7aa1a33
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import io.element.android.features.rageshake.api.crash.CrashDataStore
import io.element.android.features.rageshake.api.logs.LogFilesRemover
import io.element.android.features.rageshake.api.reporter.BugReporter
import io.element.android.features.rageshake.api.reporter.BugReporterListener
import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder
Expand All @@ -31,7 +30,6 @@ class BugReportPresenter @Inject constructor(
private val bugReporter: BugReporter,
private val crashDataStore: CrashDataStore,
private val screenshotHolder: ScreenshotHolder,
private val logFilesRemover: LogFilesRemover,
private val appCoroutineScope: CoroutineScope,
) : Presenter<BugReportState> {
private class BugReporterUploadListener(
Expand Down Expand Up @@ -143,6 +141,5 @@ class BugReportPresenter @Inject constructor(
private fun CoroutineScope.resetAll() = launch {
screenshotHolder.reset()
crashDataStore.reset()
logFilesRemover.perform()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@ import app.cash.molecule.moleculeFlow
import app.cash.turbine.test
import com.google.common.truth.Truth.assertThat
import io.element.android.features.rageshake.api.crash.CrashDataStore
import io.element.android.features.rageshake.api.logs.LogFilesRemover
import io.element.android.features.rageshake.api.reporter.BugReporter
import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder
import io.element.android.features.rageshake.test.crash.A_CRASH_DATA
import io.element.android.features.rageshake.test.crash.FakeCrashDataStore
import io.element.android.features.rageshake.test.logs.FakeLogFilesRemover
import io.element.android.features.rageshake.test.screenshot.A_SCREENSHOT_URI
import io.element.android.features.rageshake.test.screenshot.FakeScreenshotHolder
import io.element.android.libraries.architecture.AsyncAction
import io.element.android.libraries.matrix.test.A_FAILURE_REASON
import io.element.android.tests.testutils.WarmUpRule
import io.element.android.tests.testutils.lambda.LambdaOneParamRecorder
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import org.junit.Rule
Expand Down Expand Up @@ -111,11 +108,9 @@ class BugReportPresenterTest {

@Test
fun `present - reset all`() = runTest {
val logFilesRemover = FakeLogFilesRemover()
val presenter = createPresenter(
crashDataStore = FakeCrashDataStore(crashData = A_CRASH_DATA, appHasCrashed = true),
screenshotHolder = FakeScreenshotHolder(screenshotUri = A_SCREENSHOT_URI),
logFilesRemover = logFilesRemover,
)
moleculeFlow(RecompositionMode.Immediate) {
presenter.present()
Expand All @@ -127,7 +122,6 @@ class BugReportPresenterTest {
initialState.eventSink.invoke(BugReportEvents.ResetAll)
val resetState = awaitItem()
assertThat(resetState.hasCrashLogs).isFalse()
logFilesRemover.performLambda.assertions().isCalledOnce()
// TODO Make it live assertThat(resetState.screenshotUri).isNull()
}
}
Expand Down Expand Up @@ -236,12 +230,10 @@ class BugReportPresenterTest {
bugReporter: BugReporter = FakeBugReporter(),
crashDataStore: CrashDataStore = FakeCrashDataStore(),
screenshotHolder: ScreenshotHolder = FakeScreenshotHolder(),
logFilesRemover: LogFilesRemover = FakeLogFilesRemover(LambdaOneParamRecorder(ensureNeverCalled = true) { }),
) = BugReportPresenter(
bugReporter = bugReporter,
crashDataStore = crashDataStore,
screenshotHolder = screenshotHolder,
logFilesRemover = logFilesRemover,
appCoroutineScope = this,
)
}

0 comments on commit 7aa1a33

Please sign in to comment.