Compare commits

...

3 Commits

Author SHA1 Message Date
4a093fd969 chore: we don't need to check if the url is valid in upsert screen.
Some checks failed
Check PR code / Lint (pull_request) Failing after 1m39s
Check PR code / build (pull_request) Has been skipped
2025-03-09 14:48:29 +01:00
03ea12000c fix: Url validation was not failing login. Added tests.
Some checks failed
Check PR code / Lint (pull_request) Successful in 2m36s
Check PR code / build (pull_request) Has been cancelled
2025-03-09 14:41:56 +01:00
f38936f9b4 Changelog for v125020581 2025-02-27 21:08:25 +00:00
5 changed files with 34 additions and 13 deletions

View File

@ -1,3 +1,10 @@
**v125020581
- fix: url can be empty ?
- Changelog for v125020471
--------------------------------------------------------------------
**v125020471
- chore: no more docker-compose.

View File

@ -60,9 +60,23 @@ class LoginActivityTest {
fun urlError() {
performLogin("10.0.2.2:8888")
onView(withId(R.id.urlView)).perform(click())
onView(withId(R.id.urlView)).check(matches(withError(R.string.login_url_problem)))
}
@Test
fun connectError() {
performLogin("http://10.0.2.2:8889")
onView(withId(R.id.urlView)).perform(click())
onView(withId(R.id.urlView)).check(matches(withError(R.string.wrong_infos)))
}
@Test
fun urlSlashError() {
performLogin("https://google.fr/toto")
onView(withId(R.id.urlView)).perform(click())
onView(withId(R.id.urlView)).check(matches(withError(R.string.login_url_problem)))
}
@Test
fun multiError() {
onView(withId(R.id.signInButton)).perform(click())

View File

@ -149,9 +149,10 @@ class LoginActivity :
.toString()
.trim()
failInvalidUrl(url)
failLoginDetails(password, login)
val cancelUrl = failInvalidUrl(url)
if (cancelUrl) return
val cancelDetails = failLoginDetails(password, login)
if (cancelDetails) return
showProgress(true)
appSettingsService.updateSelfSigned(binding.selfSigned.isChecked)
@ -193,7 +194,7 @@ class LoginActivity :
private fun failLoginDetails(
password: String,
login: String,
) {
): Boolean {
var lastFocusedView: View? = null
var cancel = false
if (isWithLogin) {
@ -210,9 +211,10 @@ class LoginActivity :
}
}
maybeCancelAndFocusView(cancel, lastFocusedView)
return cancel
}
private fun failInvalidUrl(url: String) {
private fun failInvalidUrl(url: String): Boolean {
val focusView = binding.urlView
var cancel = false
if (url.isBaseUrlInvalid()) {
@ -232,6 +234,7 @@ class LoginActivity :
}
}
maybeCancelAndFocusView(cancel, focusView)
return cancel
}
private fun maybeCancelAndFocusView(

View File

@ -9,7 +9,6 @@ import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import bou.amine.apps.readerforselfossv2.android.databinding.ActivityUpsertSourceBinding
import bou.amine.apps.readerforselfossv2.android.utils.isBaseUrlInvalid
import bou.amine.apps.readerforselfossv2.model.NetworkUnavailableException
import bou.amine.apps.readerforselfossv2.model.SelfossModel
import bou.amine.apps.readerforselfossv2.repository.Repository
@ -76,13 +75,7 @@ class UpsertSourceActivity :
override fun onResume() {
super.onResume()
val baseUrl = appSettingsService.getBaseUrl()
if (baseUrl.isEmpty() || baseUrl.isBaseUrlInvalid()) {
mustLoginToAddSource()
} else {
handleSpoutsSpinner()
}
handleSpoutsSpinner()
}
@Suppress("detekt:SwallowedException")

View File

@ -0,0 +1,4 @@
**v125020581**
- fix: url can be empty ?
- Changelog for v125020471