Skip to content

Commit 39e788f

Browse files
authored
Merge pull request #258 from rainxchzed/download-cache-localization-impr
2 parents 8830799 + fd02ce9 commit 39e788f

File tree

22 files changed

+712
-161
lines changed

22 files changed

+712
-161
lines changed

build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
3030
}
3131
buildTypes {
3232
getByName("release") {
33-
isMinifyEnabled = false
33+
isMinifyEnabled = true
34+
isShrinkResources = true
35+
36+
proguardFiles(
37+
getDefaultProguardFile("proguard-android-optimize.txt"),
38+
"proguard-rules.pro"
39+
)
3440
}
3541
}
3642

composeApp/proguard-rules.pro

Lines changed: 172 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,198 @@
1-
# === CRITICAL: Keep Everything for Networking ===
2-
-keeppackagenames io.ktor.**
3-
-keeppackagenames okhttp3.**
4-
-keeppackagenames okio.**
5-
6-
# Kotlin
7-
-keep class kotlin.** { *; }
8-
-keep class kotlinx.** { *; }
9-
-keepclassmembers class kotlin.** { *; }
10-
11-
# Coroutines
12-
-keep class kotlinx.coroutines.** { *; }
1+
# ============================================================================
2+
# ProGuard / R8 Rules for GitHub Store (KMP + Compose Multiplatform)
3+
# ============================================================================
4+
# Used with: proguard-android-optimize.txt (enables optimization passes)
5+
# ============================================================================
6+
7+
# ── General Attributes ──────────────────────────────────────────────────────
8+
-keepattributes Signature
9+
-keepattributes *Annotation*
10+
-keepattributes InnerClasses,EnclosingMethod
11+
-keepattributes SourceFile,LineNumberTable
12+
-keepattributes Exceptions
13+
14+
# ── Kotlin Core ─────────────────────────────────────────────────────────────
15+
# Keep Kotlin metadata for reflection used by serialization & Koin
16+
-keep class kotlin.Metadata { *; }
17+
-keep class kotlin.reflect.jvm.internal.** { *; }
18+
-dontwarn kotlin.**
19+
-dontwarn kotlinx.**
20+
21+
# ── Kotlin Coroutines ──────────────────────────────────────────────────────
1322
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
1423
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
1524
-keepclassmembernames class kotlinx.** { volatile <fields>; }
25+
-dontwarn kotlinx.coroutines.**
1626

17-
# === Ktor - Keep EVERYTHING ===
18-
-keep class io.ktor.** { *; }
19-
-keep interface io.ktor.** { *; }
20-
-keepclassmembers class io.ktor.** { *; }
27+
# ── Kotlinx Serialization ──────────────────────────────────────────────────
28+
# Serialization engine internals
29+
-keep class kotlinx.serialization.** { *; }
30+
-keepclassmembers class kotlinx.serialization.json.** { *** Companion; }
31+
-dontnote kotlinx.serialization.**
32+
33+
# Generated serializers for ALL @Serializable classes
34+
-keep class **$$serializer { *; }
35+
-keepclassmembers @kotlinx.serialization.Serializable class ** {
36+
*** Companion;
37+
*** INSTANCE;
38+
kotlinx.serialization.KSerializer serializer(...);
39+
}
40+
41+
# App @Serializable classes (DTOs, models, navigation routes) across all packages
42+
-keep @kotlinx.serialization.Serializable class zed.rainxch.** { *; }
43+
-keep,includedescriptorclasses class zed.rainxch.**$$serializer { *; }
44+
-keepclassmembers @kotlinx.serialization.Serializable class zed.rainxch.** {
45+
*** Companion;
46+
}
47+
48+
# ── Navigation Routes ──────────────────────────────────────────────────────
49+
# Type-safe navigation requires these classes to survive R8
50+
-keep class zed.rainxch.githubstore.app.navigation.GithubStoreGraph { *; }
51+
-keep class zed.rainxch.githubstore.app.navigation.GithubStoreGraph$* { *; }
52+
53+
# ── Network DTOs – Core Module ─────────────────────────────────────────────
54+
-keep class zed.rainxch.core.data.dto.** { *; }
55+
56+
# ── Network DTOs – Feature Modules ─────────────────────────────────────────
57+
-keep class zed.rainxch.search.data.dto.** { *; }
58+
-keep class zed.rainxch.devprofile.data.dto.** { *; }
59+
-keep class zed.rainxch.home.data.dto.** { *; }
60+
61+
# ── Domain Models ──────────────────────────────────────────────────────────
62+
-keep class zed.rainxch.core.domain.model.GithubRepoSummary { *; }
63+
-keep class zed.rainxch.core.domain.model.GithubUser { *; }
64+
65+
# Keep enums used by Room TypeConverters and serialization
66+
-keep class zed.rainxch.core.domain.model.InstallSource { *; }
67+
-keep class zed.rainxch.core.domain.model.AppTheme { *; }
68+
-keep class zed.rainxch.core.domain.model.FontTheme { *; }
69+
-keep class zed.rainxch.core.domain.model.Platform { *; }
70+
-keep class zed.rainxch.core.domain.model.SystemArchitecture { *; }
71+
-keep class zed.rainxch.core.domain.model.PackageChangeType { *; }
72+
73+
# ── Room Database ──────────────────────────────────────────────────────────
74+
# Database class and generated implementation
75+
-keep class zed.rainxch.core.data.local.db.AppDatabase { *; }
76+
-keep class zed.rainxch.core.data.local.db.AppDatabase_Impl { *; }
77+
78+
# Entities
79+
-keep class zed.rainxch.core.data.local.db.entities.** { *; }
80+
81+
# DAOs
82+
-keep interface zed.rainxch.core.data.local.db.dao.** { *; }
83+
-keep class zed.rainxch.core.data.local.db.dao.** { *; }
84+
85+
# Room runtime
86+
-keep class androidx.room.** { *; }
87+
-dontwarn androidx.room.**
88+
89+
# ── Ktor ───────────────────────────────────────────────────────────────────
90+
# Engine discovery, plugin system, and content negotiation use reflection
91+
-keep class io.ktor.client.engine.** { *; }
92+
-keep class io.ktor.client.plugins.** { *; }
93+
-keep class io.ktor.serialization.** { *; }
94+
-keep class io.ktor.utils.io.** { *; }
95+
-keep class io.ktor.http.** { *; }
2196
-keepnames class io.ktor.** { *; }
2297
-dontwarn io.ktor.**
23-
24-
# Ktor Debug
2598
-dontwarn java.lang.management.**
2699

27-
# === OkHttp - Keep EVERYTHING ===
28-
-keep class okhttp3.** { *; }
29-
-keep interface okhttp3.** { *; }
30-
-keepclassmembers class okhttp3.** { *; }
31-
-keepnames class okhttp3.** { *; }
100+
# ── OkHttp (Ktor engine) ──────────────────────────────────────────────────
101+
-keep class okhttp3.internal.platform.** { *; }
102+
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
32103
-dontwarn okhttp3.**
104+
-dontwarn org.bouncycastle.**
105+
-dontwarn org.openjsse.**
33106

34-
# === Okio - Keep EVERYTHING ===
35-
-keep class okio.** { *; }
36-
-keepclassmembers class okio.** { *; }
37-
-keepnames class okio.** { *; }
107+
# ── Okio ───────────────────────────────────────────────────────────────────
38108
-dontwarn okio.**
39109

40-
# === Network Stack - Keep EVERYTHING ===
41-
-keep class java.net.** { *; }
42-
-keep class javax.net.** { *; }
43-
-keep class sun.security.ssl.** { *; }
44-
-keepclassmembers class java.net.** { *; }
45-
-keepclassmembers class javax.net.** { *; }
46-
47-
# DNS Resolution
48-
-keep class java.net.InetAddress { *; }
49-
-keep class java.net.Inet4Address { *; }
50-
-keep class java.net.Inet6Address { *; }
51-
-keep class java.net.InetSocketAddress { *; }
52-
53-
# SSL/TLS
54-
-keep class javax.net.ssl.** { *; }
110+
# ── SSL/TLS ────────────────────────────────────────────────────────────────
55111
-keep class org.conscrypt.** { *; }
56112
-dontwarn org.conscrypt.**
57113

58-
# === Kotlinx Serialization ===
59-
-keepattributes *Annotation*, InnerClasses
60-
-dontnote kotlinx.serialization.**
61-
-keep,includedescriptorclasses class zed.rainxch.githubstore.**$$serializer { *; }
62-
-keep @kotlinx.serialization.Serializable class zed.rainxch.githubstore.** { *; }
63-
-keepclassmembers @kotlinx.serialization.Serializable class zed.rainxch.githubstore.** {
64-
*** Companion;
65-
}
66-
67-
# Keep your models
68-
-keep class zed.rainxch.githubstore.core.domain.model.** { *; }
114+
# ── Koin DI ────────────────────────────────────────────────────────────────
115+
# Koin uses reflection for constructor injection
116+
-keep class org.koin.** { *; }
117+
-keep interface org.koin.** { *; }
118+
-dontwarn org.koin.**
119+
120+
# Keep ViewModels so Koin can instantiate them
121+
-keep class zed.rainxch.**.presentation.**ViewModel { *; }
122+
-keep class zed.rainxch.**.presentation.**ViewModel$* { *; }
123+
124+
# ── Compose / AndroidX ────────────────────────────────────────────────────
125+
# Compose runtime and navigation (most rules come bundled with the library)
126+
-dontwarn androidx.compose.**
127+
-dontwarn androidx.lifecycle.**
128+
129+
# ── DataStore ──────────────────────────────────────────────────────────────
130+
-keep class androidx.datastore.** { *; }
131+
-keepclassmembers class androidx.datastore.preferences.** { *; }
132+
-dontwarn androidx.datastore.**
133+
134+
# ── Landscapist / Coil3 (Image Loading) ────────────────────────────────────
135+
-keep class com.skydoves.landscapist.** { *; }
136+
-keep interface com.skydoves.landscapist.** { *; }
137+
-keep class coil3.** { *; }
138+
-dontwarn coil3.**
139+
-dontwarn com.skydoves.landscapist.**
140+
141+
# ── Multiplatform Markdown Renderer ────────────────────────────────────────
142+
-keep class com.mikepenz.markdown.** { *; }
143+
-keep class org.intellij.markdown.** { *; }
144+
-dontwarn com.mikepenz.markdown.**
145+
-dontwarn org.intellij.markdown.**
146+
147+
# ── Kermit Logging ─────────────────────────────────────────────────────────
148+
-keep class co.touchlab.kermit.** { *; }
149+
-dontwarn co.touchlab.kermit.**
150+
151+
# ── MOKO Permissions ──────────────────────────────────────────────────────
152+
-keep class dev.icerock.moko.permissions.** { *; }
153+
-dontwarn dev.icerock.moko.**
154+
155+
# ── BuildKonfig (Generated Build Constants) ────────────────────────────────
156+
-keep class zed.rainxch.githubstore.BuildConfig { *; }
157+
-keep class zed.rainxch.**.BuildKonfig { *; }
158+
-keep class **.BuildKonfig { *; }
69159

70-
# === AndroidX Security ===
160+
# ── AndroidX Security / Crypto ─────────────────────────────────────────────
71161
-keep class androidx.security.crypto.** { *; }
72162
-keep class com.google.crypto.tink.** { *; }
73163
-dontwarn com.google.crypto.tink.**
74164
-dontwarn com.google.errorprone.annotations.**
75165

76-
# BuildConfig
77-
-keep class zed.rainxch.githubstore.BuildConfig { *; }
78-
79-
# General
80-
-keepattributes Signature
81-
-keepattributes Exceptions
82-
-keepattributes *Annotation*
83-
-keepattributes SourceFile,LineNumberTable
84-
85-
# === START: Auth Fix ===
86-
-dontoptimize
87-
-keepattributes *Annotation*,Signature,Exception,InnerClasses,EnclosingMethod
166+
# ── Firebase (if integrated) ──────────────────────────────────────────────
167+
-keep class com.google.firebase.** { *; }
168+
-dontwarn com.google.firebase.**
88169

89-
# Keep serialization infrastructure
90-
-keep class kotlinx.serialization.** { *; }
91-
-keep class **$$serializer { *; }
92-
-keepclassmembers @kotlinx.serialization.Serializable class ** {
93-
*** Companion;
94-
*** INSTANCE;
95-
kotlinx.serialization.KSerializer serializer(...);
170+
# ── Enum safety ────────────────────────────────────────────────────────────
171+
# Keep all enum values and valueOf methods (used by serialization/Room)
172+
-keepclassmembers enum * {
173+
public static **[] values();
174+
public static ** valueOf(java.lang.String);
96175
}
97176

98-
# Keep Ktor plugins
99-
-keep class io.ktor.client.plugins.** { *; }
100-
-keep class io.ktor.serialization.** { *; }
101-
102-
# Keep your entire core package (narrow this down later)
103-
-keep class zed.rainxch.githubstore.core.** { *; }
104-
-keepclassmembers class zed.rainxch.githubstore.core.** { *; }
105-
# === END: Auth Fix ===
106-
107-
-keep class zed.rainxch.githubstore.core.data.remote.dto.** { *; }
108-
-keep class zed.rainxch.githubstore.core.domain.model.auth.** { *; }
109-
110-
# If your models are in different packages, list them:
111-
-keep class zed.rainxch.githubstore.**.*DeviceStart* { *; }
112-
-keep class zed.rainxch.githubstore.**.*DeviceToken* { *; }
113-
-keep class zed.rainxch.githubstore.**.*AuthConfig* { *; }
114-
115-
# Keep the companion objects explicitly
116-
-keepclassmembers class zed.rainxch.githubstore.**.DeviceStart {
117-
public static ** Companion;
177+
# ── Parcelable ─────────────────────────────────────────────────────────────
178+
-keepclassmembers class * implements android.os.Parcelable {
179+
public static final ** CREATOR;
118180
}
119-
-keepclassmembers class zed.rainxch.githubstore.**.DeviceTokenSuccess {
120-
public static ** Companion;
181+
182+
# ── Java Serializable Compatibility ───────────────────────────────────────
183+
-keepnames class * implements java.io.Serializable
184+
-keepclassmembers class * implements java.io.Serializable {
185+
static final long serialVersionUID;
186+
private static final java.io.ObjectStreamField[] serialPersistentFields;
187+
!static !transient <fields>;
188+
private void writeObject(java.io.ObjectOutputStream);
189+
private void readObject(java.io.ObjectInputStream);
190+
java.lang.Object writeReplace();
191+
java.lang.Object readResolve();
121192
}
122-
-keepclassmembers class zed.rainxch.githubstore.**.DeviceTokenError {
123-
public static ** Companion;
124-
}
193+
194+
# ── Suppress Warnings for Missing Classes ──────────────────────────────────
195+
-dontwarn java.lang.invoke.StringConcatFactory
196+
-dontwarn javax.annotation.**
197+
-dontwarn org.slf4j.**
198+
-dontwarn org.codehaus.mojo.animal_sniffer.**
-4.25 KB
Binary file not shown.
-4.29 KB
Binary file not shown.

composeApp/src/androidMain/AndroidManifest.xml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:tools="http://schemas.android.com/tools"
3-
xmlns:android="http://schemas.android.com/apk/res/android">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
44

55
<uses-permission android:name="android.permission.INTERNET" />
66

7-
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
7+
<uses-permission
8+
android:name="android.permission.QUERY_ALL_PACKAGES"
89
tools:ignore="PackageVisibilityPolicy,QueryAllPackagesPermission" />
910

10-
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"
11+
<uses-permission
12+
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
1113
tools:ignore="RequestInstallPackagesPolicy" />
1214
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
1315

1416
<application
1517
android:name=".app.GithubStoreApp"
1618
android:allowBackup="true"
19+
android:hasFragileUserData="true"
1720
android:icon="@mipmap/ic_launcher"
1821
android:label="@string/app_name"
1922
android:networkSecurityConfig="@xml/network_security_config"
2023
android:roundIcon="@mipmap/ic_launcher_round"
2124
android:supportsRtl="true"
2225
android:theme="@android:style/Theme.Material.Light.NoActionBar"
23-
android:usesCleartextTraffic="false">
26+
android:usesCleartextTraffic="false"
27+
tools:targetApi="29">
2428

2529
<activity
2630
android:name=".MainActivity"
@@ -54,17 +58,22 @@
5458
android:scheme="githubstore" />
5559
</intent-filter>
5660

61+
<intent-filter>
62+
<action android:name="android.intent.action.SEND" />
63+
<category android:name="android.intent.category.DEFAULT" />
64+
<data android:mimeType="text/plain" />
65+
<data android:mimeType="text/html" />
66+
</intent-filter>
67+
5768
<!-- GitHub repository links: https://github.com/{owner}/{repo} -->
5869
<intent-filter>
5970
<action android:name="android.intent.action.VIEW" />
60-
6171
<category android:name="android.intent.category.DEFAULT" />
6272
<category android:name="android.intent.category.BROWSABLE" />
6373

64-
<data
65-
android:host="github.com"
66-
android:pathPattern="/.*/..*"
67-
android:scheme="https" />
74+
<data android:scheme="https" />
75+
<data android:host="github.com" />
76+
<data android:pathPattern="/.*/.*" />
6877
</intent-filter>
6978

7079
<intent-filter android:autoVerify="true">
@@ -73,10 +82,11 @@
7382
<category android:name="android.intent.category.DEFAULT" />
7483
<category android:name="android.intent.category.BROWSABLE" />
7584

76-
<data
77-
android:host="github-store.org"
78-
android:pathPrefix="/app/"
79-
android:scheme="https" />
85+
<data android:scheme="http" />
86+
<data android:scheme="https" />
87+
<data android:host="github-store.org" />
88+
<data android:pathPrefix="/app/" />
89+
8090
</intent-filter>
8191
</activity>
8292

0 commit comments

Comments
 (0)