mirror of https://github.com/readrops/Readrops.git
Fix crash when logging with an url without scheme and improve error and info messages in AccountCredentialsScreen
This commit is contained in:
parent
cbc9d8b3c2
commit
1cb6c92edf
|
@ -156,7 +156,10 @@ class AccountCredentialsScreen(
|
|||
Text(text = state.urlError!!.errorText())
|
||||
}
|
||||
account.accountType == AccountType.FEVER -> {
|
||||
Text(text = stringResource(R.string.provide_full_api))
|
||||
Text(text = stringResource(R.string.provide_full_url))
|
||||
}
|
||||
else -> {
|
||||
Text(text = stringResource(R.string.provide_root_url))
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -56,8 +56,14 @@ class AccountCredentialsScreenModel(
|
|||
mutableState.update { it.copy(isLoginOnGoing = true) }
|
||||
|
||||
with(state.value) {
|
||||
val normalizedUrl = if (!url.contains("https://") && !url.contains("http://")) {
|
||||
"https://$url"
|
||||
} else {
|
||||
url
|
||||
}
|
||||
|
||||
val newAccount = account.copy(
|
||||
url = url,
|
||||
url = normalizedUrl,
|
||||
accountName = name,
|
||||
login = login,
|
||||
password = password,
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.readrops.app.util
|
|||
|
||||
import android.content.Context
|
||||
import com.readrops.api.utils.exceptions.HttpException
|
||||
import com.readrops.api.utils.exceptions.LoginFailedException
|
||||
import com.readrops.api.utils.exceptions.ParseException
|
||||
import com.readrops.api.utils.exceptions.UnknownFormatException
|
||||
import com.readrops.app.R
|
||||
|
@ -16,6 +17,7 @@ object ErrorMessage {
|
|||
is NoSuchFileException -> context.resources.getString(R.string.unable_open_file)
|
||||
is IOException -> context.resources.getString(R.string.network_failure, exception.message.orEmpty())
|
||||
is ParseException, is UnknownFormatException -> context.resources.getString(R.string.processing_feed_error)
|
||||
is LoginFailedException -> context.getString(R.string.login_failed)
|
||||
else -> "${exception.javaClass.simpleName}: ${exception.message}"
|
||||
}
|
||||
|
||||
|
|
|
@ -218,5 +218,6 @@
|
|||
<string name="donation_text">"Si vous considérez que mon travail vous est utile et si vous souhaitez me soutenir, vous pouvez me faire une donation. "</string>
|
||||
<string name="add_feed">Ajouter un flux</string>
|
||||
<string name="downloaded_file">Fichier téléchargé !</string>
|
||||
<string name="provide_full_api">Merci de fournir l\'URL entière de l\'API</string>
|
||||
<string name="provide_full_url">Merci de fournir l\'URL entière de l\'API</string>
|
||||
<string name="provide_root_url">Merci de fournir l\'URL racine du service</string>
|
||||
</resources>
|
|
@ -231,5 +231,6 @@
|
|||
<string name="donation_text">I you find my work useful and you would like to support me, you can consider making me a donation.</string>
|
||||
<string name="add_feed">Add feed</string>
|
||||
<string name="downloaded_file">Downloaded file!</string>
|
||||
<string name="provide_full_api">Please provide the full API URL</string>
|
||||
<string name="provide_full_url">Please provide the full API URL</string>
|
||||
<string name="provide_root_url">Please provide the service root URL</string>
|
||||
</resources>
|
Loading…
Reference in New Issue