-
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automatically update downloads to new system
- Loading branch information
1 parent
883c14b
commit 1f98e34
Showing
3 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/src/main/java/ani/dantotsu/settings/saving/internal/Compat.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ani.dantotsu.settings.saving.internal | ||
|
||
import android.content.Context | ||
import ani.dantotsu.settings.saving.PrefName | ||
import ani.dantotsu.settings.saving.PrefWrapper | ||
|
||
class Compat { | ||
companion object { | ||
fun importOldPrefs(context: Context) { | ||
if (PrefWrapper.getVal(PrefName.HasUpdatedPrefs, false)) return | ||
val oldPrefs = context.getSharedPreferences("downloads_pref", Context.MODE_PRIVATE) | ||
val jsonString = oldPrefs.getString("downloads_key", null) | ||
PrefWrapper.setVal(PrefName.DownloadsKeys, jsonString) | ||
oldPrefs.edit().clear().apply() | ||
PrefWrapper.setVal(PrefName.HasUpdatedPrefs, true) | ||
} | ||
} | ||
} |