chore(turnier-feature): remove unused ViewModels and UI components
- Removed `AbteilungViewModel`, `BewerbAnlegenViewModel`, `BewerbViewModel`, and `CreateBewerbWizardScreen`. - Cleaned up related imports and unused domain models.
This commit is contained in:
@@ -10,13 +10,11 @@ version = "1.0.0"
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js {
|
||||
binaries.library()
|
||||
browser {
|
||||
testTask {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
wasmJs {
|
||||
browser()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -63,6 +61,11 @@ kotlin {
|
||||
implementation(libs.ktor.client.cio)
|
||||
}
|
||||
|
||||
wasmJsMain.dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-wasm-js:2.3.20")
|
||||
implementation(libs.ktor.client.js)
|
||||
}
|
||||
|
||||
jsMain.dependencies {
|
||||
implementation(libs.ktor.client.js)
|
||||
}
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package at.mocode.frontend.core.auth.data
|
||||
|
||||
/**
|
||||
* Wasm-Implementierung für OIDC Redirect.
|
||||
*/
|
||||
actual suspend fun launchOidcFlow(
|
||||
authUrl: String,
|
||||
callbackPort: Int
|
||||
): OidcCallbackResult {
|
||||
setWindowLocationHref(authUrl)
|
||||
return OidcCallbackResult.Redirecting
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun setWindowLocationHref(url: String): Unit = js("window.location.href = url")
|
||||
|
||||
/**
|
||||
* Prüft auf OIDC Callback-Parameter in der URL.
|
||||
*/
|
||||
actual fun consumePendingOidcCallback(): OidcCallbackResult? {
|
||||
val search: String = getWindowLocationSearch()
|
||||
if (!search.contains("code=")) return null
|
||||
|
||||
val query = search.removePrefix("?")
|
||||
val params = parseQueryParams(query)
|
||||
|
||||
val code = params["code"] ?: return null
|
||||
val state = params["state"] ?: return null
|
||||
val error = params["error"]
|
||||
|
||||
try {
|
||||
replaceWindowState(getWindowLocationPathname())
|
||||
} catch (_: Throwable) {}
|
||||
|
||||
return if (error != null) {
|
||||
OidcCallbackResult.Error(
|
||||
error = error,
|
||||
description = params["error_description"]
|
||||
)
|
||||
} else {
|
||||
OidcCallbackResult.Success(code = code, state = state)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getWindowLocationSearch(): String = js("window.location.search")
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getWindowLocationPathname(): String = js("window.location.pathname")
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun replaceWindowState(path: String): Unit = js("window.history.replaceState(null, '', path)")
|
||||
|
||||
private fun parseQueryParams(query: String): Map<String, String> =
|
||||
query.split("&")
|
||||
.filter { it.contains("=") }
|
||||
.associate {
|
||||
val parts = it.split("=", limit = 2)
|
||||
val key = parts[0]
|
||||
val value = decodeURIComponent(parts.getOrElse(1) { "" })
|
||||
key to value
|
||||
}
|
||||
|
||||
actual fun getOidcRedirectUri(): String {
|
||||
val origin: String = try {
|
||||
getWindowLocationOrigin()
|
||||
} catch (_: Throwable) {
|
||||
"http://localhost"
|
||||
}
|
||||
return origin + at.mocode.frontend.core.domain.AppConstants.OIDC_REDIRECT_URI_JS_PATH
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getWindowLocationOrigin(): String = js("window.location.origin")
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun decodeURIComponent(encoded: String): String =
|
||||
js("decodeURIComponent(encoded)")
|
||||
@@ -7,13 +7,11 @@ plugins {
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js {
|
||||
binaries.library()
|
||||
browser {
|
||||
testTask {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
wasmJs {
|
||||
browser()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -5,14 +5,11 @@ plugins {
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js {
|
||||
binaries.library()
|
||||
// Re-enabled browser environment after Root NodeJs fix
|
||||
browser {
|
||||
testTask {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
wasmJs {
|
||||
browser()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -10,13 +10,12 @@ version = "1.0.0"
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js {
|
||||
binaries.library()
|
||||
browser {
|
||||
testTask {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
|
||||
wasmJs {
|
||||
browser()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
@file:OptIn(ExperimentalWasmDsl::class)
|
||||
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
alias(libs.plugins.kotlinSerialization)
|
||||
@@ -5,13 +9,11 @@ plugins {
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js {
|
||||
binaries.library()
|
||||
browser {
|
||||
testTask {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
wasmJs {
|
||||
browser()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -38,6 +40,12 @@ kotlin {
|
||||
implementation(libs.jmdns)
|
||||
}
|
||||
|
||||
wasmJsMain.dependencies {
|
||||
implementation(libs.kotlin.stdlib.wasm.js)
|
||||
implementation(libs.ktor.client.js)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
}
|
||||
|
||||
jsMain.dependencies {
|
||||
implementation(libs.ktor.client.js)
|
||||
}
|
||||
|
||||
+10
-6
@@ -1,6 +1,8 @@
|
||||
package at.mocode.frontend.core.network
|
||||
|
||||
import kotlinx.browser.window
|
||||
// Import explicitly from the wasm package if it exists, or use external declarations
|
||||
// Kotlin 2.3.20 might have moved things or the compiler needs hints.
|
||||
// We'll use external declarations for maximum compatibility.
|
||||
|
||||
@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING")
|
||||
actual object PlatformConfig {
|
||||
@@ -18,10 +20,8 @@ actual object PlatformConfig {
|
||||
if (fromGlobal.isNotEmpty()) return fromGlobal.removeSuffix("/")
|
||||
|
||||
// 2) Try window location origin (same origin gateway/proxy setup)
|
||||
// In Wasm, we can access a window directly if we are in the browser main thread.
|
||||
// However, we need to be careful about exceptions.
|
||||
val origin = try {
|
||||
window.location.origin
|
||||
getOrigin()
|
||||
} catch (e: Throwable) {
|
||||
null
|
||||
}
|
||||
@@ -33,9 +33,11 @@ actual object PlatformConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getOrigin(): String = js("window.location.origin")
|
||||
|
||||
// Helper function for JS interop in Wasm
|
||||
// Kotlin/Wasm does not support 'dynamic' type or complex js() blocks inside functions.
|
||||
// We must use top-level external functions or simple js() expressions.
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getGlobalApiBaseUrl(): String = js(
|
||||
"""
|
||||
(function() {
|
||||
@@ -45,6 +47,7 @@ private fun getGlobalApiBaseUrl(): String = js(
|
||||
"""
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getGlobalKeycloakUrl(): String = js(
|
||||
"""
|
||||
(function() {
|
||||
@@ -54,6 +57,7 @@ private fun getGlobalKeycloakUrl(): String = js(
|
||||
"""
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getWindowHostname(): String = js(
|
||||
"""
|
||||
(function() {
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package at.mocode.frontend.core.network.discovery
|
||||
|
||||
import org.koin.core.module.Module
|
||||
import org.koin.dsl.module
|
||||
|
||||
/**
|
||||
* Wasm-spezifische Implementierung (vorerst No-op).
|
||||
*/
|
||||
actual val discoveryModule: Module = module {
|
||||
single<NetworkDiscoveryService> { NoOpDiscoveryService() }
|
||||
}
|
||||
|
||||
class NoOpDiscoveryService : NetworkDiscoveryService {
|
||||
override fun startDiscovery() {}
|
||||
override fun stopDiscovery() {}
|
||||
override fun registerService(port: Int) {}
|
||||
override fun getDiscoveredServices(): List<DiscoveredService> = emptyList()
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package at.mocode.frontend.core.network.sync
|
||||
|
||||
import org.koin.core.module.Module
|
||||
import org.koin.dsl.module
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.emptyFlow
|
||||
|
||||
/**
|
||||
* Wasm-spezifische Implementierung (vorerst No-op).
|
||||
*/
|
||||
actual val syncModule: Module = module {
|
||||
single<P2pSyncService> { NoOpP2pSyncService() }
|
||||
single { SyncManager(get(), get()) }
|
||||
}
|
||||
|
||||
class NoOpP2pSyncService : P2pSyncService {
|
||||
override fun startServer(port: Int) {}
|
||||
override fun stopServer() {}
|
||||
override suspend fun connectToPeer(host: String, port: Int) {}
|
||||
override suspend fun broadcastEvent(event: SyncEvent) {}
|
||||
override val incomingEvents: Flow<SyncEvent> = emptyFlow()
|
||||
override val connectedPeers: Flow<List<String>> = emptyFlow()
|
||||
}
|
||||
Reference in New Issue
Block a user