From bc2519c66c3fd935a261e45d815017f29e3faca9 Mon Sep 17 00:00:00 2001 From: MykytaPimonovTD Date: Fri, 25 Oct 2024 13:58:27 +0300 Subject: [PATCH 1/2] Fix bug. --- .../io/spine/examples/pingh/desktop/Window.kt | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/desktop/src/main/kotlin/io/spine/examples/pingh/desktop/Window.kt b/desktop/src/main/kotlin/io/spine/examples/pingh/desktop/Window.kt index 2f88c42a..682f4234 100644 --- a/desktop/src/main/kotlin/io/spine/examples/pingh/desktop/Window.kt +++ b/desktop/src/main/kotlin/io/spine/examples/pingh/desktop/Window.kt @@ -50,29 +50,23 @@ import io.spine.examples.pingh.client.PinghApplication * * @param state The state of the application window. * @param app Manages the logic for the Pingh app. - * @param uriHandler The `CompositionLocal` that provides functionality for handling URL, - * such as opening a URI. + * @param uriHandler Provides functionality for handling URL, such as opening a URI. * @see [PlatformWindow] */ @Composable internal fun Window( state: WindowState, app: PinghApplication, - uriHandler: UriHandler = LocalUriHandler.current + uriHandler: UriHandler? = null ) { PlatformWindow( title = state.title, isShown = state.isShown, onClose = state::hide ) { - CompositionLocalProvider(LocalUriHandler provides uriHandler) { - Box( - modifier = Modifier - .fillMaxSize() - .clip(MaterialTheme.shapes.small) - ) { - CurrentPage(app) - } + val localUriHandler = uriHandler ?: LocalUriHandler.current + CompositionLocalProvider(LocalUriHandler provides localUriHandler) { + WindowContent(app) } } } @@ -111,6 +105,20 @@ private fun PlatformWindow( ) } +/** + * Displays a content in the Pingh window. + */ +@Composable +private fun WindowContent(app: PinghApplication) { + Box( + modifier = Modifier + .fillMaxSize() + .clip(MaterialTheme.shapes.small) + ) { + CurrentPage(app) + } +} + /** * State of [Window]. */ From 4f11eedb6726e72fd0aaf4c477e2ec4c58213a8b Mon Sep 17 00:00:00 2001 From: MykytaPimonovTD Date: Fri, 25 Oct 2024 14:33:28 +0300 Subject: [PATCH 2/2] Update versions. --- .../src/main/kotlin/io/spine/internal/dependency/Pingh.kt | 2 +- version.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop/buildSrc/src/main/kotlin/io/spine/internal/dependency/Pingh.kt b/desktop/buildSrc/src/main/kotlin/io/spine/internal/dependency/Pingh.kt index f46be3a7..e3e41640 100644 --- a/desktop/buildSrc/src/main/kotlin/io/spine/internal/dependency/Pingh.kt +++ b/desktop/buildSrc/src/main/kotlin/io/spine/internal/dependency/Pingh.kt @@ -28,7 +28,7 @@ package io.spine.internal.dependency // https://github.com/spine-examples/Pingh public object Pingh { - private const val version = "1.0.0-SNAPSHOT.11" + private const val version = "1.0.0-SNAPSHOT.12" private const val group = "io.spine.examples.pingh" public const val client: String = "$group:client:$version" diff --git a/version.gradle.kts b/version.gradle.kts index 9d292934..16b1880a 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -27,4 +27,4 @@ /** * The version of the `Pingh` to publish. */ -val pinghVersion: String by extra("1.0.0-SNAPSHOT.11") +val pinghVersion: String by extra("1.0.0-SNAPSHOT.12")