Skip to content

Commit

Permalink
feat: add proguard rules and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayagikei committed Feb 12, 2023
1 parent 7294999 commit 079619a
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 10 deletions.
5 changes: 4 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ compose.desktop {
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "lifeup-desktop"
packageVersion = "1.0.2"
packageVersion = "1.0.0"
macOS {
iconFile.set(project.file("icon.icns"))
}
Expand All @@ -58,5 +58,8 @@ compose.desktop {
iconFile.set(project.file("icon.png"))
}
}
buildTypes.release.proguard {
configurationFiles.from(project.file("compose-desktop.pro"))
}
}
}
28 changes: 28 additions & 0 deletions compose-desktop.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

# A resource is loaded with a relative path so the package of this class must be preserved.
-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
-dontwarn okhttp3.internal.platform.**
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**

# Kotlin serialization looks up the generated serializer classes through a function on companion
# objects. The companions are looked up reflectively so we need to explicitly keep these functions.
-keepclasseswithmembers class **.*$Companion {
kotlinx.serialization.KSerializer serializer(...);
}
# If a companion has the serializer function, keep the companion field on the original type so that
# the reflective lookup succeeds.
-if class **.*$Companion {
kotlinx.serialization.KSerializer serializer(...);
}
-keepclassmembers class <1>.<2> {
<1>.<2>$Companion Companion;
}
5 changes: 3 additions & 2 deletions src/jvmMain/kotlin/base/Val.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package base

object Val {
val version: String = "0.1.0"
// FIXME: get version from gradle
val version: String = "1.0.0"

val targetLifeUpCloudVersion = "1.1.0+"
val targetLifeUpCloudVersion = "1.1.1+"

val targetLifeUpAndroidVersion = "1.91.0+"
}
1 change: 0 additions & 1 deletion src/jvmMain/kotlin/datasource/ApiService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package datasource

import datasource.data.*
import datasource.net.HttpResponse
import net.lifeupapp.lifeup.api.content.achievements.category.AchievementCategory

interface ApiService {

Expand Down
4 changes: 3 additions & 1 deletion src/jvmMain/kotlin/datasource/ApiServiceImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.long
import net.lifeupapp.lifeup.api.content.achievements.category.AchievementCategory
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request

Expand Down Expand Up @@ -132,6 +131,9 @@ object ApiServiceImpl : ApiService {
}

override fun getIconUrl(icon: String): String {
if (icon.isEmpty()) {
return ""
}
val host = OkHttpClientHolder.host
val url = (host).toHttpUrl().newBuilder()
.addPathSegment("files")
Expand Down
2 changes: 1 addition & 1 deletion src/jvmMain/kotlin/datasource/data/AchievementCategory.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.lifeupapp.lifeup.api.content.achievements.category
package datasource.data

import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import datasource.data.Achievement
import datasource.data.AchievementCategory
import logger
import net.lifeupapp.lifeup.api.content.achievements.category.AchievementCategory
import ui.Strings
import ui.page.config.Spacer4dpH
import ui.page.list.MARGIN_SCROLLBAR
Expand Down
2 changes: 1 addition & 1 deletion src/jvmMain/kotlin/ui/page/achievement/AchievementStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import androidx.compose.runtime.setValue
import base.launchSafely
import datasource.ApiServiceImpl
import datasource.data.Achievement
import datasource.data.AchievementCategory
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import logger
import net.lifeupapp.lifeup.api.content.achievements.category.AchievementCategory
import ui.AppStoreImpl
import java.util.logging.Level

Expand Down
2 changes: 1 addition & 1 deletion src/jvmMain/kotlin/ui/page/feelings/FeelingsContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal fun FeelingsContent(

Column(modifier) {
TopAppBar(title = {
Text(text = Strings.status)
Text(text = Strings.module_feelings)
}, backgroundColor = MaterialTheme.colors.primarySurface, elevation = 0.dp, actions = {
IconButton(onRefreshClick) {
Icon(Icons.Default.Refresh, "Refresh")
Expand Down
2 changes: 1 addition & 1 deletion src/jvmMain/kotlin/ui/page/item/ShopContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private fun Item(

logger.log(Level.INFO, "item.icon: ${item.icon}")
AsyncImage(
condition = item.icon.isNotBlank(),
condition = item.icon.isNotBlank() && item.icon.endsWith("/").not(),
load = {
loadImageBitmap(item.icon)
},
Expand Down

0 comments on commit 079619a

Please sign in to comment.