mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
comments
This commit is contained in:
parent
bcc475102a
commit
cf6a0e2937
@ -61,6 +61,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
RetrofitInstance.url =
|
RetrofitInstance.url =
|
||||||
PreferenceHelper.getString(this, "selectInstance", "https://pipedapi.kavin.rocks/")!!
|
PreferenceHelper.getString(this, "selectInstance", "https://pipedapi.kavin.rocks/")!!
|
||||||
|
// set auth instance
|
||||||
RetrofitInstance.authUrl =
|
RetrofitInstance.authUrl =
|
||||||
if (PreferenceHelper.getBoolean(this, "auth_instance_toggle", false)) {
|
if (PreferenceHelper.getBoolean(this, "auth_instance_toggle", false)) {
|
||||||
PreferenceHelper.getString(
|
PreferenceHelper.getString(
|
||||||
|
@ -69,7 +69,6 @@ class LoginDialog : DialogFragment() {
|
|||||||
private fun login(login: Login) {
|
private fun login(login: Login) {
|
||||||
fun run() {
|
fun run() {
|
||||||
lifecycleScope.launchWhenCreated {
|
lifecycleScope.launchWhenCreated {
|
||||||
Log.e(TAG, RetrofitInstance.authUrl)
|
|
||||||
val response = try {
|
val response = try {
|
||||||
RetrofitInstance.authApi.login(login)
|
RetrofitInstance.authApi.login(login)
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
|
@ -34,7 +34,6 @@ import java.io.IOException
|
|||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.util.zip.ZipEntry
|
import java.util.zip.ZipEntry
|
||||||
import java.util.zip.ZipInputStream
|
import java.util.zip.ZipInputStream
|
||||||
import kotlin.math.log
|
|
||||||
|
|
||||||
class InstanceSettings : PreferenceFragmentCompat() {
|
class InstanceSettings : PreferenceFragmentCompat() {
|
||||||
val TAG = "InstanceSettings"
|
val TAG = "InstanceSettings"
|
||||||
@ -138,6 +137,7 @@ class InstanceSettings : PreferenceFragmentCompat() {
|
|||||||
}
|
}
|
||||||
authInstance.setOnPreferenceChangeListener { _, newValue ->
|
authInstance.setOnPreferenceChangeListener { _, newValue ->
|
||||||
requireMainActivityRestart = true
|
requireMainActivityRestart = true
|
||||||
|
// save new auth url
|
||||||
RetrofitInstance.authUrl = newValue.toString()
|
RetrofitInstance.authUrl = newValue.toString()
|
||||||
RetrofitInstance.lazyMgr.reset()
|
RetrofitInstance.lazyMgr.reset()
|
||||||
logout()
|
logout()
|
||||||
@ -149,6 +149,7 @@ class InstanceSettings : PreferenceFragmentCompat() {
|
|||||||
requireMainActivityRestart = true
|
requireMainActivityRestart = true
|
||||||
authInstance.isVisible = newValue == true
|
authInstance.isVisible = newValue == true
|
||||||
logout()
|
logout()
|
||||||
|
// either use new auth url or the normal api url if auth instance disabled
|
||||||
RetrofitInstance.authUrl = if (newValue == false) RetrofitInstance.url
|
RetrofitInstance.authUrl = if (newValue == false) RetrofitInstance.url
|
||||||
else authInstance.value
|
else authInstance.value
|
||||||
true
|
true
|
||||||
|
Loading…
Reference in New Issue
Block a user