Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzhirkevich committed Jul 10, 2024
1 parent 4ef0218 commit cd768aa
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
import kotlin.js.Promise

external class DecompressionStream(alg : String)
internal external class DecompressionStream(alg : String)

external interface UnderlyingSource {
internal external interface UnderlyingSource {
fun start(controller: SourceController)
}

external interface SourceController {
internal external interface SourceController {
fun enqueue(data : ByteArray)

fun close()
}

external class ReadableStream(
internal external class ReadableStream(
source: UnderlyingSource
) {
fun pipeThrough(decompressionStream: DecompressionStream) : ReadableStream

fun getReader() : StreamReader
}

external interface StreamReader {
internal external interface StreamReader {
fun read() : Promise<StreamReadResult>
}

external interface StreamReadResult {
internal external interface StreamReadResult {
val done : Boolean

val value : ArrayBufferView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
import kotlin.js.Promise

external class DecompressionStream(alg : String)
internal external class DecompressionStream(alg : String)

external class ReadableStream(
internal external class ReadableStream(
source: JsAny
) {
fun pipeThrough(decompressionStream: DecompressionStream) : ReadableStream

fun getReader() : StreamReader
}

external interface StreamReader {
internal external interface StreamReader {
fun read() : Promise<StreamReadResult>
}

external interface StreamReadResult : JsAny {
internal external interface StreamReadResult : JsAny {
val done : Boolean

val value : ArrayBufferView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import okio.Sink
import okio.Source

@InternalCompottieApi
internal actual fun defaultFileSystem() : FileSystem = ThrowingFileSystem
public actual fun defaultFileSystem() : FileSystem = ThrowingFileSystem

private object ThrowingFileSystem : FileSystem() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.github.alexzhirkevich.compottie
import android.content.Context
import androidx.startup.Initializer

class CompottieInitializer : Initializer<Compottie> {
public class CompottieInitializer : Initializer<Compottie> {

@OptIn(InternalCompottieApi::class)
override fun create(context: Context): Compottie {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.text.font.Font

actual fun ImageBitmap.Companion.fromBytes(bytes: ByteArray) : ImageBitmap {
public actual fun ImageBitmap.Companion.fromBytes(bytes: ByteArray) : ImageBitmap {
return BitmapFactory
.decodeByteArray(bytes, 0, bytes.size)
.asImageBitmap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal actual fun CharSequence.codePointAt(index : Int) =
internal actual fun charCount(codePoint : Int): Int = Character.charCount(codePoint)


val modifierSet = setOf(
private val modifierSet = setOf(
Character.FORMAT,
Character.MODIFIER_SYMBOL,
Character.NON_SPACING_MARK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ internal class DynamicShapeLayerProvider(
val key = nRoot.eachShapes.keys
.filter { it.second == clazz }
.fastMaxBy { it.first.orEmpty().commonPrefixWith(path).length }
?.takeIf { it.first?.commonPrefixWith(path)?.length != 0 }
?: return null

return nRoot.eachShapes[key]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package io.github.alexzhirkevich.compottie
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers

actual fun ioDispatcher() = Dispatchers.Default
public actual fun ioDispatcher() : CoroutineDispatcher = Dispatchers.Default
18 changes: 8 additions & 10 deletions convention-plugins/src/main/kotlin/module.publication.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ publishing {
}
}

if (System.getenv("GPG_KEY") != null || findProperty("GPG_KEY") != null) {
signing {
useInMemoryPgpKeys(
Base64.getDecoder().decode(
System.getenv("GPG_KEY") ?: findProperty("GPG_KEY") as String
).decodeToString(),
System.getenv("GPG_KEY_PWD") ?: findProperty("GPG_KEY_PWD") as String,
)
sign(publishing.publications)
}
signing {
useInMemoryPgpKeys(
Base64.getDecoder().decode(
rootProject.ext.takeIf { it.has("GPG_KEY") }?.get("GPG_KEY") as? String ?: return@signing
).decodeToString(),
rootProject.ext.takeIf { it.has("GPG_KEY_PWD") }?.get("GPG_KEY_PWD") as? String ?: return@signing
)
sign(publishing.publications)
}
26 changes: 19 additions & 7 deletions convention-plugins/src/main/kotlin/root.publication.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
import gradle.kotlin.dsl.accessors._2502cef48cff830615fe1c6d6ab5e104.ext
import java.io.FileInputStream
import java.util.Properties

plugins {
id("io.github.gradle-nexus.publish-plugin")
}

rootProject.projectDir.resolve("local.properties").let {
if (it.exists()) {
Properties().apply {
load(FileInputStream(it))
}.also {
it.forEach { (k,v)-> rootProject.ext.set(k.toString(), v) }
}
System.getenv().forEach { (k,v) ->
rootProject.ext.set(k, v)
}
}
}

allprojects {
group = findProperty("group") as String
version = findProperty("version") as String
Expand All @@ -15,13 +32,8 @@ nexusPublishing {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))

if (System.getenv("OSSRH_PASSWORD") != null) {
username.set(System.getenv("OSSRH_USERNAME"))
password.set(System.getenv("OSSRH_PASSWORD"))
} else if (findProperty("OSSRH_PASSWORD") != null) {
username.set(findProperty("OSSRH_USERNAME") as String)
password.set(findProperty("OSSRH_PASSWORD") as String)
}
username.set(rootProject.ext.takeIf { it.has("OSSRH_USERNAME") }?.get("OSSRH_USERNAME") as? String? ?: return@sonatype)
password.set(rootProject.ext.takeIf { it.has("OSSRH_PASSWORD") }?.get("OSSRH_PASSWORD") as? String? ?: return@sonatype)
}
}
}
2 changes: 1 addition & 1 deletion example/shared/src/commonMain/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public suspend fun LottieCompositionSpec.Companion.ResourceString(
public fun App() {

// return LottieFontExample()
// return AllExamples()
return AllExamples()
// return LottieList()

val composition = rememberLottieComposition() {
Expand Down
3 changes: 2 additions & 1 deletion example/shared/src/iosMain/kotlin/main.ios.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import androidx.compose.ui.window.ComposeUIViewController
import platform.UIKit.UIViewController

fun MainViewController() = ComposeUIViewController {
public fun MainViewController() : UIViewController = ComposeUIViewController {
App()
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ compose="1.6.11"
agp = "8.1.1"
okio = "3.9.0"
serialization="1.6.3"
ktor="2.3.11"
ktor="2.3.12"
atomicfu="0.23.2"
coroutines="1.8.0"
nexus-publish="2.0.0"
Expand Down

0 comments on commit cd768aa

Please sign in to comment.