From aadfc88420d9b58f263177da19dd3b10b8edc5c4 Mon Sep 17 00:00:00 2001 From: Sargun Vohra Date: Sun, 12 Jan 2025 16:03:47 -0800 Subject: [PATCH] fix crash --- .github/workflows/daily.yml | 1 + build.gradle.kts | 8 +++++--- .../demoapp/demos/StyleSwitcherDemo.kt | 11 ++++++----- .../dev/sargunv/maplibrecompose/core/layer/Layer.kt | 4 ++-- .../dev/sargunv/maplibrecompose/core/source/Source.kt | 4 ++-- .../dev/sargunv/maplibrecompose/core/layer/Layer.kt | 3 +-- .../dev/sargunv/maplibrecompose/core/source/Source.kt | 3 +-- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index a3ea271b..ee702fa3 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -4,6 +4,7 @@ name: "Daily" on: schedule: - cron: "00 10 * * *" + workflow_dispatch: jobs: check-last-run: diff --git a/build.gradle.kts b/build.gradle.kts index d5e44b8d..2fe52683 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -62,9 +62,11 @@ spotless { target("**/*.kt") ktfmt().googleStyle() } - format("swift") { - target("iosApp/iosApp/**/*.swift") - nativeCmd("swiftFormat", "/usr/bin/env", listOf("swift", "format")) + if (System.getProperty("os.name").contains("Mac OS X")) { + format("swift") { + target("iosApp/iosApp/**/*.swift") + nativeCmd("swiftFormat", "/usr/bin/env", listOf("swift", "format")) + } } format("markdown") { target("**/*.md") diff --git a/demo-app/src/commonMain/kotlin/dev/sargunv/maplibrecompose/demoapp/demos/StyleSwitcherDemo.kt b/demo-app/src/commonMain/kotlin/dev/sargunv/maplibrecompose/demoapp/demos/StyleSwitcherDemo.kt index 7ac5c98f..1bdde024 100644 --- a/demo-app/src/commonMain/kotlin/dev/sargunv/maplibrecompose/demoapp/demos/StyleSwitcherDemo.kt +++ b/demo-app/src/commonMain/kotlin/dev/sargunv/maplibrecompose/demoapp/demos/StyleSwitcherDemo.kt @@ -58,17 +58,18 @@ object StyleSwitcherDemo : Demo { styleState = styleState, ornamentSettings = DemoOrnamentSettings(), ) { - val crags = rememberVectorSource( - id = "openbeta-crags", - uri = Res.getUri("files/data/openbeta-crags.json") - ) + val crags = + rememberVectorSource( + id = "openbeta-crags", + uri = Res.getUri("files/data/openbeta-crags.json"), + ) SymbolLayer( id = "crag-name-label", source = crags, sourceLayer = "crags", iconAnchor = const(SymbolAnchor.Center), textField = feature.get("name").convertToString(), - textFont = const(listOf("Noto Sans Regular")) + textFont = const(listOf("Noto Sans Regular")), ) } DemoMapControls(cameraState, styleState) diff --git a/lib/maplibre-compose/src/androidMain/kotlin/dev/sargunv/maplibrecompose/core/layer/Layer.kt b/lib/maplibre-compose/src/androidMain/kotlin/dev/sargunv/maplibrecompose/core/layer/Layer.kt index 3e67c128..7029861b 100644 --- a/lib/maplibre-compose/src/androidMain/kotlin/dev/sargunv/maplibrecompose/core/layer/Layer.kt +++ b/lib/maplibre-compose/src/androidMain/kotlin/dev/sargunv/maplibrecompose/core/layer/Layer.kt @@ -6,8 +6,8 @@ import org.maplibre.android.style.layers.PropertyFactory internal actual sealed class Layer { abstract val impl: MlnLayer - actual val id: String - get() = impl.id + + actual val id: String by lazy { impl.id } actual var minZoom: Float get() = impl.minZoom diff --git a/lib/maplibre-compose/src/androidMain/kotlin/dev/sargunv/maplibrecompose/core/source/Source.kt b/lib/maplibre-compose/src/androidMain/kotlin/dev/sargunv/maplibrecompose/core/source/Source.kt index 28e34494..c5f13335 100644 --- a/lib/maplibre-compose/src/androidMain/kotlin/dev/sargunv/maplibrecompose/core/source/Source.kt +++ b/lib/maplibre-compose/src/androidMain/kotlin/dev/sargunv/maplibrecompose/core/source/Source.kt @@ -6,8 +6,8 @@ import org.maplibre.android.style.sources.Source as MLNSource public actual sealed class Source { internal abstract val impl: MLNSource - internal actual val id: String - get() = impl.id + + internal actual val id: String by lazy { impl.id } public actual val attributionLinks: List get() { diff --git a/lib/maplibre-compose/src/iosMain/kotlin/dev/sargunv/maplibrecompose/core/layer/Layer.kt b/lib/maplibre-compose/src/iosMain/kotlin/dev/sargunv/maplibrecompose/core/layer/Layer.kt index a3bba7a6..55799fdf 100644 --- a/lib/maplibre-compose/src/iosMain/kotlin/dev/sargunv/maplibrecompose/core/layer/Layer.kt +++ b/lib/maplibre-compose/src/iosMain/kotlin/dev/sargunv/maplibrecompose/core/layer/Layer.kt @@ -4,8 +4,7 @@ import cocoapods.MapLibre.MLNStyleLayer internal actual sealed class Layer { abstract val impl: MLNStyleLayer - actual val id: String - get() = impl.identifier + actual val id: String by lazy { impl.identifier } actual var minZoom: Float get() = impl.minimumZoomLevel diff --git a/lib/maplibre-compose/src/iosMain/kotlin/dev/sargunv/maplibrecompose/core/source/Source.kt b/lib/maplibre-compose/src/iosMain/kotlin/dev/sargunv/maplibrecompose/core/source/Source.kt index 7e2d5a74..cbacf7e4 100644 --- a/lib/maplibre-compose/src/iosMain/kotlin/dev/sargunv/maplibrecompose/core/source/Source.kt +++ b/lib/maplibre-compose/src/iosMain/kotlin/dev/sargunv/maplibrecompose/core/source/Source.kt @@ -6,8 +6,7 @@ import cocoapods.MapLibre.MLNTileSource public actual sealed class Source { internal abstract val impl: MLNSource - internal actual val id: String - get() = impl.identifier + internal actual val id: String by lazy { impl.identifier } public actual val attributionLinks: List get() =