@@ -27,6 +27,7 @@ import androidx.compose.runtime.mutableStateOf
27
27
import androidx.compose.runtime.remember
28
28
import androidx.compose.runtime.setValue
29
29
import androidx.compose.ui.Modifier
30
+ import androidx.compose.ui.platform.LocalInspectionMode
30
31
import androidx.compose.ui.tooling.preview.PreviewParameter
31
32
import androidx.compose.ui.viewinterop.AndroidView
32
33
import io.element.android.libraries.core.bool.orFalse
@@ -45,6 +46,7 @@ fun OidcView(
45
46
onNavigateBack : () -> Unit ,
46
47
modifier : Modifier = Modifier ,
47
48
) {
49
+ val isPreview = LocalInspectionMode .current
48
50
val oidcUrlParser = remember { OidcUrlParser () }
49
51
var webView by remember { mutableStateOf<WebView ?>(null ) }
50
52
fun shouldOverrideUrl (url : String ): Boolean {
@@ -86,16 +88,18 @@ fun OidcView(
86
88
modifier = Modifier .padding(contentPadding),
87
89
factory = { context ->
88
90
WebView (context).apply {
89
- webViewClient = oidcWebViewClient
90
- settings.apply {
91
- @SuppressLint(" SetJavaScriptEnabled" )
92
- javaScriptEnabled = true
93
- allowContentAccess = true
94
- allowFileAccess = true
95
- databaseEnabled = true
96
- domStorageEnabled = true
91
+ if (! isPreview) {
92
+ webViewClient = oidcWebViewClient
93
+ settings.apply {
94
+ @SuppressLint(" SetJavaScriptEnabled" )
95
+ javaScriptEnabled = true
96
+ allowContentAccess = true
97
+ allowFileAccess = true
98
+ databaseEnabled = true
99
+ domStorageEnabled = true
100
+ }
101
+ loadUrl(state.oidcDetails.url)
97
102
}
98
- loadUrl(state.oidcDetails.url)
99
103
}.also {
100
104
webView = it
101
105
}
0 commit comments