mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Merge remote-tracking branch 'origin/main' into develop
This commit is contained in:
+4
-2
@@ -12,6 +12,7 @@ import dev.zacsweers.metro.AppScope
|
|||||||
import dev.zacsweers.metro.ContributesBinding
|
import dev.zacsweers.metro.ContributesBinding
|
||||||
import io.element.android.libraries.matrix.api.auth.OAuthRedirectUrlProvider
|
import io.element.android.libraries.matrix.api.auth.OAuthRedirectUrlProvider
|
||||||
import io.element.android.libraries.oauth.api.OAuthAction
|
import io.element.android.libraries.oauth.api.OAuthAction
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
fun interface OAuthUrlParser {
|
fun interface OAuthUrlParser {
|
||||||
fun parse(url: String): OAuthAction?
|
fun parse(url: String): OAuthAction?
|
||||||
@@ -38,7 +39,8 @@ class DefaultOAuthUrlParser(
|
|||||||
if (url.contains("error=access_denied")) return OAuthAction.GoBack()
|
if (url.contains("error=access_denied")) return OAuthAction.GoBack()
|
||||||
if (url.contains("code=")) return OAuthAction.Success(url)
|
if (url.contains("code=")) return OAuthAction.Success(url)
|
||||||
|
|
||||||
// Other case not supported, let's crash the app for now
|
// Other cases are not supported, log an error and return null
|
||||||
error("Not supported: $url")
|
Timber.w("Unsupported OAuth url")
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -13,7 +13,6 @@ import androidx.core.net.toUri
|
|||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import io.element.android.libraries.matrix.test.auth.FakeOAuthRedirectUrlProvider
|
import io.element.android.libraries.matrix.test.auth.FakeOAuthRedirectUrlProvider
|
||||||
import io.element.android.libraries.oauth.api.OAuthAction
|
import io.element.android.libraries.oauth.api.OAuthAction
|
||||||
import org.junit.Assert.assertThrows
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.robolectric.RobolectricTestRunner
|
import org.robolectric.RobolectricTestRunner
|
||||||
@@ -54,9 +53,8 @@ class DefaultOAuthIntentResolverTest {
|
|||||||
action = Intent.ACTION_VIEW
|
action = Intent.ACTION_VIEW
|
||||||
data = "io.element.android:/invalid".toUri()
|
data = "io.element.android:/invalid".toUri()
|
||||||
}
|
}
|
||||||
assertThrows(IllegalStateException::class.java) {
|
val result = sut.resolve(intent)
|
||||||
sut.resolve(intent)
|
assertThat(result).isNull()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createDefaultOAuthIntentResolver(): DefaultOAuthIntentResolver {
|
private fun createDefaultOAuthIntentResolver(): DefaultOAuthIntentResolver {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ private const val versionMonth = 6
|
|||||||
* Release number in the month. Value must be in [0,99].
|
* Release number in the month. Value must be in [0,99].
|
||||||
* Do not update this value. it is updated by the release script.
|
* Do not update this value. it is updated by the release script.
|
||||||
*/
|
*/
|
||||||
private const val versionReleaseNumber = 1
|
private const val versionReleaseNumber = 2
|
||||||
|
|
||||||
object Versions {
|
object Versions {
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user