Update api login information with user input

This commit is contained in:
davide 2022-07-25 15:20:36 +02:00
parent da4bdd2355
commit b14b34441b
4 changed files with 14 additions and 11 deletions

View File

@ -203,13 +203,7 @@ class LoginActivity() : AppCompatActivity(), DIAware {
} else {
showProgress(true)
settings.putString("url", url)
settings.putString("login", login)
settings.putString("httpUserName", httpLogin)
settings.putString("password", password)
settings.putString("httpPassword", httpPassword)
settings.putBoolean("isSelfSignedCert", isWithSelfSignedCert)
repository.refreshLoginInformation()
repository.refreshLoginInformation(url, login, password, httpLogin, httpPassword, isWithSelfSignedCert)
if (this@LoginActivity.isNetworkAvailable(this@LoginActivity.findViewById(R.id.loginForm))) {
CoroutineScope(Dispatchers.IO).launch {

View File

@ -35,5 +35,7 @@ interface Repository {
suspend fun deleteSource(id: Int): Boolean
suspend fun updateRemote(): Boolean
suspend fun login(): Boolean
fun refreshLoginInformation()
fun refreshLoginInformation(url: String, login: String, password: String,
httpLogin: String, httpPassword: String,
isSelfSignedCert: Boolean)
}

View File

@ -275,9 +275,17 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
return result
}
override fun refreshLoginInformation() {
override fun refreshLoginInformation(url: String, login: String, password: String,
httpLogin: String, httpPassword: String,
isSelfSignedCert: Boolean) {
settings.putString("url", url)
settings.putString("login", login)
settings.putString("httpUserName", httpLogin)
settings.putString("password", password)
settings.putString("httpPassword", httpPassword)
settings.putBoolean("isSelfSignedCert", isSelfSignedCert)
baseUrl = url
api.refreshLoginInformation()
baseUrl = apiDetails.getBaseUrl()
}
private suspend fun updateApiVersion() {

View File

@ -47,7 +47,6 @@ class ApiDetailsServiceImpl : ApiDetailsService {
_password = settings.getString("password", "")
_userName = settings.getString("login", "")
_baseUrl = settings.getString("url", "")
_baseUrl = settings.getString("url", "")
_apiVersion = settings.getInt("apiVersionMajor", -1)
}
}