improvements for kmp
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package dev.meloda.overseerr
|
||||
|
||||
class WasmPlatform : Platform {
|
||||
override val name: String = "Web with Kotlin/Wasm"
|
||||
}
|
||||
|
||||
actual fun getPlatform(): Platform = WasmPlatform()
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package dev.meloda.overseerr.datastore
|
||||
|
||||
import dev.meloda.overseerr.datastore.model.AppSettings
|
||||
import io.github.xxfast.kstore.KStore
|
||||
import io.github.xxfast.kstore.storage.storeOf
|
||||
|
||||
actual class SettingsStoreProvider actual constructor() {
|
||||
actual fun provideStore(): KStore<AppSettings> = storeOf(key = "app_settings")
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package dev.meloda.overseerr.network
|
||||
|
||||
import io.ktor.client.engine.*
|
||||
import io.ktor.client.engine.js.*
|
||||
import io.ktor.client.engine.HttpClientEngineFactory
|
||||
import io.ktor.client.engine.js.Js
|
||||
|
||||
actual class HttpClientEngineFactoryProvider actual constructor() {
|
||||
actual fun get(): HttpClientEngineFactory<*> = Js
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package dev.meloda.overseerr.theme
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.ExperimentalBrowserHistoryApi
|
||||
import androidx.navigation.NavController
|
||||
|
||||
@Composable
|
||||
internal actual fun SystemAppearance(isDark: Boolean) {
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalBrowserHistoryApi::class)
|
||||
@Composable
|
||||
internal actual fun NavigationSettings(navController: NavController) {
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
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.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.ComposeViewport
|
||||
import dev.meloda.overseerr.App
|
||||
import dev.meloda.overseerr.di.appModule
|
||||
import kotlinx.browser.document
|
||||
import kotlinx.browser.window
|
||||
import org.koin.compose.KoinApplication
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
fun main() {
|
||||
ComposeViewport(document.body!!) {
|
||||
KoinApplication(application = { modules(appModule) }) {
|
||||
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)
|
||||
) {
|
||||
App()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Wasm App</title>
|
||||
<link type="text/css" rel="stylesheet" href="styles.css">
|
||||
<script type="application/javascript" src="composeApp.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +0,0 @@
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
Reference in New Issue
Block a user