Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Add button to test menu to flush tek cache (#5768)
Browse files Browse the repository at this point in the history
  • Loading branch information
schauersbergern authored Dec 20, 2022
1 parent 416978c commit 644cab9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class SubmissionTestFragment : Fragment(R.layout.fragment_test_submission), Auto
binding.apply {
tekRetrieval.setOnClickListener { vm.updateStorage() }
tekEmail.setOnClickListener { vm.emailTEKs() }
tekClearCache.setOnClickListener { vm.clearTekCache() }
}
vm.permissionRequestEvent.observe2(this) { permissionRequest ->
permissionRequest.invoke(requireActivity())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ class SubmissionTestFragmentViewModel @AssistedInject constructor(
}
}

fun clearTekCache() = launch {
tekHistoryUpdater.clearTekCache()
}

@AssistedFactory
interface Factory : SimpleCWAViewModelFactory<SubmissionTestFragmentViewModel>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tek_history_description" />

<Button
android:id="@+id/tek_clear_cache"
style="@style/buttonPrimary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_tiny"
android:text="Clear TEK cache"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tek_retrieval" />

<Button
android:id="@+id/tek_email"
style="@style/buttonPrimary"
Expand All @@ -170,7 +181,7 @@
android:text="Email TEKs"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tek_retrieval" />
app:layout_constraintTop_toBottomOf="@id/tek_clear_cache" />

<TextView
android:id="@+id/tek_storage_count"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class TEKHistoryUpdater @AssistedInject constructor(
)
}

suspend fun clearTekCache() {
tekCache.reset()
}

fun getTeksForTesting() {
scope.launch {
if (!enfClient.isTracingEnabled.first()) {
Expand Down

0 comments on commit 644cab9

Please sign in to comment.