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