mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Fix auth api url when restoring backup in welcome page
This commit is contained in:
parent
406520a703
commit
eb1382e154
@ -8,6 +8,7 @@ import androidx.activity.viewModels
|
||||
import androidx.core.view.isGone
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.api.RetrofitInstance
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.databinding.ActivityWelcomeBinding
|
||||
import com.github.libretube.helpers.BackupHelper
|
||||
@ -31,7 +32,8 @@ class WelcomeActivity : BaseActivity() {
|
||||
BackupHelper.restoreAdvancedBackup(this@WelcomeActivity, uri)
|
||||
|
||||
// only skip the welcome activity if the restored backup contains an instance
|
||||
if (PreferenceHelper.getString(PreferenceKeys.FETCH_INSTANCE, "").isNotEmpty()) {
|
||||
val instancePref = PreferenceHelper.getString(PreferenceKeys.FETCH_INSTANCE, "")
|
||||
if (instancePref.isNotEmpty()) {
|
||||
withContext(Dispatchers.Main) { startMainActivity() }
|
||||
}
|
||||
}
|
||||
@ -72,6 +74,9 @@ class WelcomeActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
private fun startMainActivity() {
|
||||
// refresh the api urls since they have changed likely
|
||||
RetrofitInstance.initialize()
|
||||
RetrofitInstance.lazyMgr.reset()
|
||||
val mainActivityIntent = Intent(this@WelcomeActivity, MainActivity::class.java)
|
||||
startActivity(mainActivityIntent)
|
||||
finish()
|
||||
|
@ -65,6 +65,7 @@ class LoginDialog(
|
||||
|
||||
private fun signIn(username: String, password: String, createNewAccount: Boolean = false) {
|
||||
val login = Login(username, password)
|
||||
Log.e("url", RetrofitInstance.authUrl)
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val response = try {
|
||||
if (createNewAccount) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user