Introduce NewPipeFileLocator class

This commit is contained in:
XiangRongLin 2020-12-19 15:16:22 +01:00
parent f778c48923
commit 8fceffd6fd
2 changed files with 9 additions and 14 deletions

View file

@ -46,9 +46,7 @@ class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) {
}
fun extractDb(
filePath: String,
): Boolean {
fun extractDb(filePath: String): Boolean {
val success = ZipHelper.extractFileFromZip(filePath, fileLocator.db.path, "newpipe.db")
if (success) {
fileLocator.dbJournal.delete()
@ -59,16 +57,12 @@ class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) {
return success
}
fun containSettings(
filePath: String,
): Boolean {
fun containSettings(filePath: String): Boolean {
return ZipHelper
.extractFileFromZip(filePath, fileLocator.settings.path, "newpipe.settings")
}
fun loadSharedPreferences(
preferences: SharedPreferences,
) {
fun loadSharedPreferences(preferences: SharedPreferences) {
try {
val preferenceEditor = preferences.edit()