Merge commit from fork

* Log error on unsupported OAuth URL.

* Bump version to 26.06.2
This commit is contained in:
Benoit Marty
2026-06-10 12:22:13 +02:00
committed by GitHub
parent 8bafc84210
commit 33f64ca5a1
2 changed files with 6 additions and 6 deletions
@@ -12,6 +12,7 @@ import dev.zacsweers.metro.AppScope
import dev.zacsweers.metro.ContributesBinding
import io.element.android.libraries.matrix.api.auth.OAuthRedirectUrlProvider
import io.element.android.libraries.oauth.api.OAuthAction
import timber.log.Timber
fun interface OAuthUrlParser {
fun parse(url: String): OAuthAction?
@@ -38,7 +39,8 @@ class DefaultOAuthUrlParser(
if (url.contains("error=access_denied")) return OAuthAction.GoBack()
if (url.contains("code=")) return OAuthAction.Success(url)
// Other case not supported, let's crash the app for now
error("Not supported: $url")
// Other cases are not supported, log an error and return null
Timber.w("Unsupported OAuth url")
return null
}
}
@@ -13,7 +13,6 @@ import androidx.core.net.toUri
import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.matrix.test.auth.FakeOAuthRedirectUrlProvider
import io.element.android.libraries.oauth.api.OAuthAction
import org.junit.Assert.assertThrows
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@@ -54,9 +53,8 @@ class DefaultOAuthIntentResolverTest {
action = Intent.ACTION_VIEW
data = "io.element.android:/invalid".toUri()
}
assertThrows(IllegalStateException::class.java) {
sut.resolve(intent)
}
val result = sut.resolve(intent)
assertThat(result).isNull()
}
private fun createDefaultOAuthIntentResolver(): DefaultOAuthIntentResolver {