Added back clearing repository cache
This commit is contained in:
parent
ea1f75f80e
commit
0119ebddbe
@ -59,6 +59,8 @@ class ModuleRepository(
|
||||
.fetchModuleInstaller()
|
||||
.map { it.writeToFile(context, FILE_MODULE_INSTALLER_SH) }
|
||||
|
||||
fun deleteAllCached() = repoDao.deleteAll()
|
||||
|
||||
|
||||
private fun fetchProperties(module: String, lastChanged: Long) = apiRaw
|
||||
.fetchFile(module, "module.prop")
|
||||
|
@ -13,6 +13,7 @@ import androidx.preference.*
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.topjohnwu.magisk.App
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.data.repository.ModuleRepository
|
||||
import com.topjohnwu.magisk.data.repository.SettingRepository
|
||||
import org.koin.android.ext.android.inject
|
||||
|
||||
@ -22,6 +23,7 @@ abstract class BasePreferenceFragment : PreferenceFragmentCompat(),
|
||||
protected val prefs: SharedPreferences by inject()
|
||||
protected val app: App by inject()
|
||||
protected val settingRepo: SettingRepository by inject()
|
||||
protected val moduleRepo: ModuleRepository by inject()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
|
@ -106,9 +106,9 @@ public final class SettingsFragment extends BasePreferenceFragment {
|
||||
return true;
|
||||
});
|
||||
Preference clear = findPreference("clear");
|
||||
clear.setEnabled(false); // temporarily disable clearing cache as repos are not cached atm
|
||||
clear.setOnPreferenceClickListener(pref -> {
|
||||
getPrefs().edit().remove(Config.Key.ETAG_KEY).apply();
|
||||
getModuleRepo().deleteAllCached();
|
||||
Utils.toast(R.string.repo_cache_cleared, Toast.LENGTH_SHORT);
|
||||
return true;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user