Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ismai117/kottie
Browse files Browse the repository at this point in the history
  • Loading branch information
ismail committed Mar 5, 2024
1 parent 2e0b8bb commit a505bb8
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ kotlin.mpp.applyDefaultHierarchyTemplate=false
#Compose
org.jetbrains.compose.experimental.uikit.enabled=true
org.jetbrains.compose.experimental.jscanvas.enabled=true
org.jetbrains.compose.experimental.wasm.enabled=true
#org.jetbrains.compose.experimental.wasm.enabled=true

#Android
android.useAndroidX=true
Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ compose-plugin = "1.6.0"
dokka = "1.9.10"
klint = "12.1.0"
maven-publish = "0.27.0"
ktor = "3.0.0-wasm2"
#ktor = "3.0.0-wasm2"
ktor = "2.3.9"
lottie = "6.2.0"

[libraries]
Expand Down
17 changes: 9 additions & 8 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ kotlin {
binaries.executable()
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
binaries.executable()
}
// @OptIn(ExperimentalWasmDsl::class)
// wasmJs {
// browser()
// binaries.executable()
// }

iosX64()
iosArm64()
iosSimulatorArm64()

cocoapods {
version = "1.0"
ios.deploymentTarget = "17.2"
pod("lottie-ios"){
moduleName = "Lottie"
extraOpts += listOf("-compiler-option", "-fmodules")
Expand Down Expand Up @@ -95,9 +96,9 @@ kotlin {
}
}

val wasmJsMain by getting {
dependsOn(skiaMain)
}
// val wasmJsMain by getting {
// dependsOn(skiaMain)
// }

}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/lib.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |spec|
spec.summary = ''
spec.vendored_frameworks = 'build/cocoapods/framework/lib.framework'
spec.libraries = 'c++'
spec.ios.deployment_target = '17.2'
spec.dependency 'lottie-ios'

if !Dir.exist?('build/cocoapods/framework/lib.framework') || Dir.empty?('build/cocoapods/framework/lib.framework')
Expand Down
12 changes: 6 additions & 6 deletions sample/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ kotlin {
binaries.executable()
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
binaries.executable()
}
// @OptIn(ExperimentalWasmDsl::class)
// wasmJs {
// browser()
// binaries.executable()
// }

iosX64()
iosArm64()
Expand All @@ -31,7 +31,7 @@ kotlin {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "17.0"
ios.deploymentTarget = "17.2"
podfile = project.file("../iosApp/Podfile")
pod("lottie-ios") {
version = "4.4.0"
Expand Down
5 changes: 4 additions & 1 deletion sample/shared/src/commonMain/kotlin/App.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import kottieComposition.KottieCompositionSpec
Expand All @@ -19,7 +21,7 @@ fun App(


val composition = rememberKottieComposition(
spec = KottieCompositionSpec.File("files/Animation.json")
spec = KottieCompositionSpec.File("files/loading.json")
)

val animationState by animateKottieCompositionAsState(
Expand All @@ -30,6 +32,7 @@ fun App(
MaterialTheme {
Box(
modifier = modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {

KottieAnimation(
Expand Down
10 changes: 10 additions & 0 deletions sample/webApp-wasm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ plugins {
alias(libs.plugins.jetbrainsCompose)
}

val copyWasmResources = tasks.create("copyWasmResourcesWorkaround", Copy::class.java) {
from(project(":shared").file("src/commonMain/composeResources"))
into("build/processedResources/wasmJs/main")
}

afterEvaluate {
project.tasks.getByName("wasmJsProcessResources").finalizedBy(copyWasmResources)
project.tasks.getByName("wasmJsDevelopmentExecutableCompileSync").mustRunAfter(copyWasmResources)x
project.tasks.getByName("wasmJsProductionExecutableCompileSync").mustRunAfter(copyWasmResources)
}

kotlin {
@OptIn(ExperimentalWasmDsl::class)
Expand Down
11 changes: 11 additions & 0 deletions sample/webApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ plugins {
alias(libs.plugins.jetbrainsCompose)
}

val copyJsResources = tasks.create("copyJsResourcesWorkaround", Copy::class.java) {
from(project(":sample:shared").file("src/commonMain/composeResources"))
into("build/processedResources/js/main")
}

afterEvaluate {
project.tasks.getByName("jsProcessResources").finalizedBy(copyJsResources)
project.tasks.getByName("jsBrowserProductionExecutableDistributeResources").mustRunAfter(copyJsResources)
project.tasks.getByName("jsDevelopmentExecutableCompileSync").mustRunAfter(copyJsResources)
project.tasks.getByName("jsProductionExecutableCompileSync").mustRunAfter(copyJsResources)
}

kotlin {
js {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include(":lib")
include(":sample:desktopApp")
include(":sample:shared")
include(":sample:webApp")
include(":sample:webApp-wasm")
//include(":sample:webApp-wasm")

pluginManagement {
repositories {
Expand Down

0 comments on commit a505bb8

Please sign in to comment.