Skip to content

Commit

Permalink
Use external app for OIDC fallback instead of webview
Browse files Browse the repository at this point in the history
  • Loading branch information
msusman1 committed Feb 21, 2025
1 parent 2518191 commit e18a04e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ class LoginFlowNode @AssistedInject constructor(
oidcEntryPoint.openUrlInCustomTab(it, darkTheme, oidcDetails.url)
}
} else {
// Fallback to WebView mode
backstack.push(NavTarget.OidcView(oidcDetails))
activity?.let {
oidcEntryPoint.openUrlInExternalApp(it, oidcDetails.url)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ import com.bumble.appyx.core.node.Node
interface OidcEntryPoint {
fun canUseCustomTab(): Boolean
fun openUrlInCustomTab(activity: Activity, darkTheme: Boolean, url: String)
fun openUrlInExternalApp(activity: Activity, url: String)
fun createFallbackWebViewNode(parentNode: Node, buildContext: BuildContext, url: String): Node
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.bumble.appyx.core.modality.BuildContext
import com.bumble.appyx.core.node.Node
import com.squareup.anvil.annotations.ContributesBinding
import io.element.android.libraries.androidutils.browser.openUrlInChromeCustomTab
import io.element.android.libraries.androidutils.system.openUrlInExternalApp
import io.element.android.libraries.architecture.createNode
import io.element.android.libraries.di.AppScope
import io.element.android.libraries.matrix.api.auth.OidcDetails
Expand All @@ -32,6 +33,10 @@ class DefaultOidcEntryPoint @Inject constructor(
activity.openUrlInChromeCustomTab(null, darkTheme, url)
}

override fun openUrlInExternalApp(activity: Activity, url: String) {
activity.openUrlInExternalApp(url)
}

override fun createFallbackWebViewNode(parentNode: Node, buildContext: BuildContext, url: String): Node {
assert(!canUseCustomTab()) { "Custom tab should be used instead of the fallback node." }
val inputs = OidcNode.Inputs(OidcDetails(url))
Expand Down

0 comments on commit e18a04e

Please sign in to comment.