[feat] Smart Server Selection
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.acitelight.aether.viewModel
|
||||
|
||||
import android.app.Application
|
||||
import android.widget.Toast
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.lifecycle.ViewModel
|
||||
@@ -86,7 +87,7 @@ class HomeScreenViewModel(application: Application) : AndroidViewModel(applicati
|
||||
if(u=="" || p=="" || ur=="" || c=="") return@launch
|
||||
|
||||
try{
|
||||
ApiClient.apply(ur, c)
|
||||
val usedUrl = ApiClient.apply(ur, c)
|
||||
|
||||
if (MediaManager.token == "null")
|
||||
MediaManager.token = AuthManager.fetchToken(
|
||||
|
||||
@@ -76,14 +76,14 @@ class MeScreenViewModel(application: Application) : AndroidViewModel(application
|
||||
if (u == "" || c == "" || p == "" || us == "") return@launch
|
||||
|
||||
try {
|
||||
ApiClient.apply(u, c)
|
||||
val usedUrl = ApiClient.apply(u, c)
|
||||
MediaManager.token = AuthManager.fetchToken(
|
||||
us,
|
||||
p
|
||||
)!!
|
||||
|
||||
Global.loggedIn = true
|
||||
Toast.makeText(context, "Server Updated", Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, "Server Updated, Used Url: $usedUrl", Toast.LENGTH_SHORT).show()
|
||||
} catch (e: Exception) {
|
||||
print(e.message)
|
||||
Toast.makeText(context, "Invalid Account or Server Information", Toast.LENGTH_SHORT).show()
|
||||
|
||||
Reference in New Issue
Block a user