diff --git a/app/src/main/java/com/topjohnwu/magisk/data/repository/ModuleRepository.kt b/app/src/main/java/com/topjohnwu/magisk/data/repository/ModuleRepository.kt index a9edbfa14..407e3ee1d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/data/repository/ModuleRepository.kt +++ b/app/src/main/java/com/topjohnwu/magisk/data/repository/ModuleRepository.kt @@ -12,6 +12,7 @@ import com.topjohnwu.magisk.utils.Utils import com.topjohnwu.magisk.utils.toSingle import com.topjohnwu.magisk.utils.writeToFile import com.topjohnwu.magisk.utils.writeToString +import io.reactivex.Completable import io.reactivex.Single class ModuleRepository( @@ -59,7 +60,7 @@ class ModuleRepository( .fetchModuleInstaller() .map { it.writeToFile(context, FILE_MODULE_INSTALLER_SH) } - fun deleteAllCached() = repoDao.deleteAll() + fun deleteAllCached() = Completable.fromCallable { repoDao.deleteAll() } private fun fetchProperties(module: String, lastChanged: Long) = apiRaw diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.java index 4071a8e1d..b8c092d9c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.java @@ -110,7 +110,9 @@ public final class SettingsFragment extends BasePreferenceFragment { Preference clear = findPreference("clear"); clear.setOnPreferenceClickListener(pref -> { getPrefs().edit().remove(Config.Key.ETAG_KEY).apply(); - getModuleRepo().deleteAllCached(); + getModuleRepo().deleteAllCached().subscribeOn(Schedulers.io()).subscribe(() -> { + }, throwable -> { + }); Utils.toast(R.string.repo_cache_cleared, Toast.LENGTH_SHORT); return true; });