2021-07-12 10:14:26 +02:00
|
|
|
package audio.funkwhale.ffa.activities
|
2019-10-23 20:21:18 +02:00
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.content.Intent
|
|
|
|
import android.os.Bundle
|
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
2021-07-12 10:14:26 +02:00
|
|
|
import audio.funkwhale.ffa.FFA
|
|
|
|
import audio.funkwhale.ffa.utils.AppContext
|
|
|
|
import audio.funkwhale.ffa.utils.Settings
|
2019-10-23 20:21:18 +02:00
|
|
|
|
|
|
|
class SplashActivity : AppCompatActivity() {
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
|
|
|
|
getSharedPreferences(AppContext.PREFS_CREDENTIALS, Context.MODE_PRIVATE).apply {
|
2019-11-25 23:14:16 +01:00
|
|
|
when (Settings.hasAccessToken() || Settings.isAnonymous()) {
|
2019-10-23 20:21:18 +02:00
|
|
|
true -> Intent(this@SplashActivity, MainActivity::class.java).apply {
|
|
|
|
flags = Intent.FLAG_ACTIVITY_NO_ANIMATION
|
|
|
|
|
|
|
|
startActivity(this)
|
|
|
|
}
|
|
|
|
|
|
|
|
false -> Intent(this@SplashActivity, LoginActivity::class.java).apply {
|
2021-07-12 10:14:26 +02:00
|
|
|
audio.funkwhale.ffa.FFA.get().deleteAllData()
|
2020-08-29 15:14:59 +02:00
|
|
|
|
2019-10-23 20:21:18 +02:00
|
|
|
flags = Intent.FLAG_ACTIVITY_NO_ANIMATION
|
|
|
|
|
|
|
|
startActivity(this)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-02 13:55:49 +02:00
|
|
|
}
|