From 06d31a55d1908325df115e3017f0af1a17317c56 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Fri, 25 Oct 2024 13:51:55 +0100 Subject: [PATCH] Stop resetting entities with instances --- .../android/injection/config/AppDependencyModule.java | 4 ++-- .../org/odk/collect/android/projects/ProjectResetter.kt | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/collect_app/src/main/java/org/odk/collect/android/injection/config/AppDependencyModule.java b/collect_app/src/main/java/org/odk/collect/android/injection/config/AppDependencyModule.java index ff00be36f83..34af678eab1 100644 --- a/collect_app/src/main/java/org/odk/collect/android/injection/config/AppDependencyModule.java +++ b/collect_app/src/main/java/org/odk/collect/android/injection/config/AppDependencyModule.java @@ -550,8 +550,8 @@ public ProjectDeleter providesProjectDeleter(ProjectsRepository projectsReposito } @Provides - public ProjectResetter providesProjectResetter(StoragePathProvider storagePathProvider, PropertyManager propertyManager, SettingsProvider settingsProvider, FormsRepositoryProvider formsRepositoryProvider, SavepointsRepositoryProvider savepointsRepositoryProvider, InstancesDataService instancesDataService, ProjectsDataService projectsDataService, EntitiesRepositoryProvider entitiesRepositoryProvider) { - return new ProjectResetter(storagePathProvider, propertyManager, settingsProvider, formsRepositoryProvider, savepointsRepositoryProvider, instancesDataService, projectsDataService.getCurrentProject().getUuid(), entitiesRepositoryProvider); + public ProjectResetter providesProjectResetter(StoragePathProvider storagePathProvider, PropertyManager propertyManager, SettingsProvider settingsProvider, FormsRepositoryProvider formsRepositoryProvider, SavepointsRepositoryProvider savepointsRepositoryProvider, InstancesDataService instancesDataService, ProjectsDataService projectsDataService) { + return new ProjectResetter(storagePathProvider, propertyManager, settingsProvider, formsRepositoryProvider, savepointsRepositoryProvider, instancesDataService, projectsDataService.getCurrentProject().getUuid()); } @Provides diff --git a/collect_app/src/main/java/org/odk/collect/android/projects/ProjectResetter.kt b/collect_app/src/main/java/org/odk/collect/android/projects/ProjectResetter.kt index 53a48d122a7..140c629fd71 100644 --- a/collect_app/src/main/java/org/odk/collect/android/projects/ProjectResetter.kt +++ b/collect_app/src/main/java/org/odk/collect/android/projects/ProjectResetter.kt @@ -19,7 +19,6 @@ import org.odk.collect.android.fastexternalitemset.ItemsetDbAdapter import org.odk.collect.android.instancemanagement.InstancesDataService import org.odk.collect.android.storage.StoragePaths import org.odk.collect.android.utilities.WebCredentialsUtils -import org.odk.collect.entities.storage.EntitiesRepository import org.odk.collect.forms.FormsRepository import org.odk.collect.forms.savepoints.SavepointsRepository import org.odk.collect.metadata.PropertyManager @@ -34,8 +33,7 @@ class ProjectResetter( private val formsRepositoryProvider: ProjectDependencyFactory, private val savepointsRepositoryProvider: ProjectDependencyFactory, private val instancesDataService: InstancesDataService, - private val projectId: String, - private val entitiesRepositoryFactory: ProjectDependencyFactory + private val projectId: String ) { private val storagePaths = storagePathProvider.create(projectId) @@ -70,8 +68,6 @@ class ProjectResetter( } private fun resetInstances() { - entitiesRepositoryFactory.create(projectId).clear() - if (!instancesDataService.reset(projectId) || !deleteFolderContent(storagePaths.instancesDir) ) {