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