Delete downloaded tracks on logout. Cache is not deleted for now (until I find a way).
This commit is contained in:
parent
874b79d0d5
commit
bab7040b8f
|
@ -75,6 +75,12 @@ class Otter : Application() {
|
|||
}
|
||||
}
|
||||
|
||||
fun deleteAllData() {
|
||||
PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).clear()
|
||||
|
||||
exoDownloadManager.removeAllDownloads()
|
||||
}
|
||||
|
||||
inner class CrashReportHandler : Thread.UncaughtExceptionHandler {
|
||||
override fun uncaughtException(t: Thread, e: Throwable) {
|
||||
val now = Date(Date().time - (5 * 60 * 1000))
|
||||
|
|
|
@ -11,6 +11,7 @@ import androidx.preference.Preference
|
|||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.SeekBarPreference
|
||||
import com.github.apognu.otter.BuildConfig
|
||||
import com.github.apognu.otter.Otter
|
||||
import com.github.apognu.otter.R
|
||||
import com.github.apognu.otter.utils.*
|
||||
import com.preference.PowerPreference
|
||||
|
@ -78,12 +79,10 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
|
|||
.setTitle(context.getString(R.string.logout_title))
|
||||
.setMessage(context.getString(R.string.logout_content))
|
||||
.setPositiveButton(android.R.string.yes) { _, _ ->
|
||||
PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).clear()
|
||||
|
||||
context.cacheDir.deleteRecursively()
|
||||
|
||||
CommandBus.send(Command.ClearQueue)
|
||||
|
||||
Otter.get().deleteAllData()
|
||||
|
||||
activity?.setResult(MainActivity.ResultCode.LOGOUT.code)
|
||||
activity?.finish()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue