diff --git a/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java b/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java index 2cd31860e..ab002d2bd 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/activity/MainActivity.java @@ -202,6 +202,7 @@ private void onPeriodicWorkComplete(WorkInfo workInfo) { } public void fetchManualUpdate() { + updatesViewModel.clearDescriptors(); OneTimeWorkRequest manualWorkRequest = new OneTimeWorkRequest.Builder(ManualUpdateDescriptorsWorker.class) .setConstraints( new Constraints.Builder() diff --git a/app/src/main/java/org/openobservatory/ooniprobe/activity/reviewdescriptorupdates/AvailableUpdatesViewModel.kt b/app/src/main/java/org/openobservatory/ooniprobe/activity/reviewdescriptorupdates/AvailableUpdatesViewModel.kt index 7468c8c2d..34435682a 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/activity/reviewdescriptorupdates/AvailableUpdatesViewModel.kt +++ b/app/src/main/java/org/openobservatory/ooniprobe/activity/reviewdescriptorupdates/AvailableUpdatesViewModel.kt @@ -10,14 +10,16 @@ import javax.inject.Singleton @Singleton class AvailableUpdatesViewModel @Inject() constructor(var gson: Gson) : ViewModel() { var descriptors: MutableLiveData> = MutableLiveData() - var descriptorString: MutableLiveData = MutableLiveData() fun setDescriptorsWith(descriptorJson: String) { - descriptorString.value = descriptorJson descriptors.value = gson.fromJson(descriptorJson, Array::class.java).toList() } fun getUpdatedDescriptor(runId: Long): String { return gson.toJson(arrayOf(descriptors.value?.find { it.runId == runId })) } + + fun clearDescriptors() { + descriptors.value = emptyList() + } } \ No newline at end of file