PlatformWebView.wasm.kt
composeApp/src/wasmJsMain/kotlin/eu/friedcutlet/yokan/ui/screens/webview/PlatformWebView.wasm.kt
1package eu.friedcutlet.yokan.ui.screens.webview23import androidx.compose.foundation.layout.Box4import androidx.compose.foundation.layout.fillMaxSize5import androidx.compose.material3.Text6import androidx.compose.runtime.Composable7import androidx.compose.runtime.LaunchedEffect8import androidx.compose.ui.Alignment9import androidx.compose.ui.Modifier10import eu.friedcutlet.yokan.services.http.cookies.CookieJar11import eu.friedcutlet.yokan.services.system.openSystemBrowser1213/**14 * Browsers cannot nest a controllable cross-origin browser view; the in-app15 * WebView screen offers to open the page in a new tab instead.16 */17@Composable18internal actual fun RenderPlatformWebView(19 url: String,20 cookieJar: CookieJar,21 modifier: Modifier,22 userAgent: String?,23 isObscuredByOverlay: Boolean,24 onNavigated: (String) -> Unit,25 onLoadingProgress: (Float) -> Unit,26 interceptUrlPrefix: String?,27 onVerificationRequired: (String) -> Unit,28) {29 LaunchedEffect(url, cookieJar) {30 if (!cookieJar.canUseBrowserStorage) return@LaunchedEffect31 onLoadingProgress(1f)32 openSystemBrowser(url)33 }34 Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) {35 Text("The in-app WebView is unavailable on the web; the page opened in a new browser tab.")36 }37}3839internal actual val platformWebViewReportsNavigation: Boolean = false40