Do not delete downloads on authentication error (prepare for new authentication system).

This commit is contained in:
Antoine POPINEAU 2020-08-29 15:14:59 +02:00
parent 0056faee8e
commit 998dab0fb5
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
2 changed files with 7 additions and 3 deletions

View File

@ -20,6 +20,7 @@ import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.lifecycleScope
import com.github.apognu.otter.Otter
import com.github.apognu.otter.R
import com.github.apognu.otter.fragments.*
import com.github.apognu.otter.playback.MediaControlsManager
@ -191,6 +192,8 @@ class MainActivity : AppCompatActivity() {
if (resultCode == ResultCode.LOGOUT.code) {
Intent(this, LoginActivity::class.java).apply {
Otter.get().deleteAllData()
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
stopService(Intent(this@MainActivity, PlayerService::class.java))
@ -227,9 +230,7 @@ class MainActivity : AppCompatActivity() {
EventBus.get().collect { message ->
when (message) {
is Event.LogOut -> {
PowerPreference.clearAllData()
cacheDir.deleteRecursively()
Otter.get().deleteAllData()
startActivity(Intent(this@MainActivity, LoginActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NO_HISTORY

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.apognu.otter.Otter
import com.github.apognu.otter.utils.AppContext
import com.github.apognu.otter.utils.Settings
@ -20,6 +21,8 @@ class SplashActivity : AppCompatActivity() {
}
false -> Intent(this@SplashActivity, LoginActivity::class.java).apply {
Otter.get().deleteAllData()
flags = Intent.FLAG_ACTIVITY_NO_ANIMATION
startActivity(this)