improvements for kmp
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package dev.meloda.overseerr
|
||||
|
||||
class JsPlatform : Platform {
|
||||
override val name: String = "Web with Kotlin/JS"
|
||||
}
|
||||
|
||||
actual fun getPlatform(): Platform = JsPlatform()
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package dev.meloda.overseerr.network
|
||||
|
||||
import io.ktor.client.engine.HttpClientEngineFactory
|
||||
import io.ktor.client.engine.js.Js
|
||||
|
||||
actual class HttpClientEngineFactoryProvider actual constructor() {
|
||||
actual fun get(): HttpClientEngineFactory<*> = Js
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.browser.window
|
||||
|
||||
@Composable
|
||||
actual fun ResizableWindow(content: @Composable () -> Unit) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(window.innerWidth.coerceIn(360..600).dp)
|
||||
.height(window.innerHeight.coerceIn(minimumValue = 360, maximumValue = null).dp)
|
||||
) {
|
||||
content()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user