From 60f82bd108eb113f3d6e5a1afa4a9b41dc9e4114 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Thu, 20 Feb 2025 16:02:20 +0100 Subject: [PATCH 1/3] Disable minification. Some other fixes. --- rhodium-core/build.gradle.kts | 8 +++++++- .../kotlin/rhodium/nostr/client/ClientMessage.kt | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rhodium-core/build.gradle.kts b/rhodium-core/build.gradle.kts index 7716307..2e5ab3c 100644 --- a/rhodium-core/build.gradle.kts +++ b/rhodium-core/build.gradle.kts @@ -208,7 +208,13 @@ android { aarMetadata { } - isMinifyEnabled = true + isMinifyEnabled = false + } + debug { + aarMetadata { + + } + isMinifyEnabled = false } } compileOptions { diff --git a/rhodium-core/src/commonMain/kotlin/rhodium/nostr/client/ClientMessage.kt b/rhodium-core/src/commonMain/kotlin/rhodium/nostr/client/ClientMessage.kt index 98e2e80..27a4913 100644 --- a/rhodium-core/src/commonMain/kotlin/rhodium/nostr/client/ClientMessage.kt +++ b/rhodium-core/src/commonMain/kotlin/rhodium/nostr/client/ClientMessage.kt @@ -12,6 +12,7 @@ import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.* +import rhodium.crypto.toHexString import rhodium.nostr.Event import rhodium.nostr.NostrFilter @@ -114,7 +115,7 @@ open class RequestMessage( companion object { fun singleFilterRequest( - subscriptionId: String = uuid4().bytes.decodeToString().substring(0, 5), + subscriptionId: String = uuid4().bytes.toHexString().substring(0, 5), filter: NostrFilter ): RequestMessage { return RequestMessage(messageType = "REQ", subscriptionId, listOf(filter)) From 1faa8e7c10e5539b1eeb222a3e524c5f51f3a063 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Thu, 20 Feb 2025 16:04:06 +0100 Subject: [PATCH 2/3] Move to new version: v1.0-beta-15. --- README.md | 6 +++--- build.gradle.kts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ee2c290..dc4b037 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can include the library from either Maven Central or Jitpack. You can include the library in the common source set like this: ```kotlin dependencies { - implementation("io.github.kotlingeekdev:rhodium:1.0-beta-14") + implementation("io.github.kotlingeekdev:rhodium:1.0-beta-15") } ``` @@ -74,7 +74,7 @@ then, in your module's `build.gradle(.kts)`, you need to add: // build.gradle.kts dependencies { //... - implementation("com.github.KotlinGeekDev.Rhodium:rhodium:1.0-beta-14") + implementation("com.github.KotlinGeekDev.Rhodium:rhodium:1.0-beta-15") } @@ -85,7 +85,7 @@ If you're including it in an Android app, you can just add: // app/build.gradle.kts dependencies { //... - implementation("com.github.KotlinGeekDev.Rhodium:rhodium-android:1.0-beta-14") + implementation("com.github.KotlinGeekDev.Rhodium:rhodium-android:1.0-beta-15") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index c7e0273..585aba7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,7 +31,7 @@ allprojects { val isJitpack = System.getenv("JITPACK") == "true" group = "io.github.kotlingeekdev" - version = "1.0-beta-14" + version = "1.0-beta-15" // val javadocJar = tasks.register("javadocJar") { From 360bc261020f71c7ca6d96a8d50f8f8f3922a03e Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Thu, 20 Feb 2025 16:50:40 +0100 Subject: [PATCH 3/3] Use proguard rules. Change some source set related configs. --- rhodium-core/build.gradle.kts | 12 ++++++++---- rhodium-core/consumer-rules.pro | 2 ++ rhodium-core/proguard-rules.pro | 26 ++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 rhodium-core/consumer-rules.pro create mode 100644 rhodium-core/proguard-rules.pro diff --git a/rhodium-core/build.gradle.kts b/rhodium-core/build.gradle.kts index 2e5ab3c..8d9cdb9 100644 --- a/rhodium-core/build.gradle.kts +++ b/rhodium-core/build.gradle.kts @@ -149,7 +149,6 @@ kotlin { val androidMain by getting { - dependsOn(commonJvmMain) dependencies { implementation("androidx.appcompat:appcompat:1.7.0") @@ -158,11 +157,11 @@ kotlin { } androidInstrumentedTest.configure { - dependsOn(commonJvmTest) +// dependsOn(commonJvmTest) } val androidUnitTest by getting { - dependsOn(commonJvmTest) +// dependsOn(commonJvmTest) } linuxMain.configure { @@ -201,6 +200,7 @@ android { compileSdk = 34 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") } buildTypes { @@ -208,7 +208,11 @@ android { aarMetadata { } - isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + isMinifyEnabled = true } debug { aarMetadata { diff --git a/rhodium-core/consumer-rules.pro b/rhodium-core/consumer-rules.pro new file mode 100644 index 0000000..3d56318 --- /dev/null +++ b/rhodium-core/consumer-rules.pro @@ -0,0 +1,2 @@ +# preserve access to native classses +-keep class fr.acinq.secp256k1.** { *; } \ No newline at end of file diff --git a/rhodium-core/proguard-rules.pro b/rhodium-core/proguard-rules.pro new file mode 100644 index 0000000..1a928c7 --- /dev/null +++ b/rhodium-core/proguard-rules.pro @@ -0,0 +1,26 @@ +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# preserve the line number information for debugging stack traces. +-dontobfuscate +-keepattributes LocalVariableTable +-keepattributes LocalVariableTypeTable +-keepattributes *Annotation* +-keepattributes SourceFile +-keepattributes LineNumberTable +-keepattributes Signature +-keepattributes Exceptions +-keepattributes InnerClasses +-keepattributes EnclosingMethod +-keepattributes MethodParameters +-keepparameternames + + +# Keep all names +-keepnames class ** { *; } + +# Keep All enums +-keep enum ** { *; } + +# preserve access to native classses +-keep class fr.acinq.secp256k1.** { *; }