Skip to content

Commit 32b72cc

Browse files
committed
Add debug build differentiation and fix ProGuard rules
- Debug builds use orange theme and "Argosy DBG" name - Debug launcher icon has orange gradient background - Fix ProGuard rules for Moshi/Retrofit in release builds
1 parent 3f1fc99 commit 32b72cc

5 files changed

Lines changed: 38 additions & 3 deletions

File tree

app/proguard-rules.pro

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
@com.squareup.moshi.ToJson <methods>;
55
}
66
-keep class * extends com.squareup.moshi.JsonAdapter
7+
-keep @com.squareup.moshi.JsonClass class *
8+
-keepclassmembers @com.squareup.moshi.JsonClass class * {
9+
<init>(...);
10+
<fields>;
11+
}
12+
-keep class **JsonAdapter {
13+
<init>(...);
14+
}
15+
-keepnames @com.squareup.moshi.JsonClass class *
716

817
# Room
918
-keep class * extends androidx.room.RoomDatabase
@@ -13,10 +22,16 @@
1322
# Retrofit
1423
-keepattributes Signature
1524
-keepattributes Exceptions
25+
-keepattributes *Annotation*
26+
-keepattributes InnerClasses
27+
-keepattributes EnclosingMethod
1628
-keepclassmembers,allowshrinking,allowobfuscation interface * {
1729
@retrofit2.http.* <methods>;
1830
}
1931
-dontwarn retrofit2.**
32+
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
33+
-keep,allowobfuscation,allowshrinking class retrofit2.Response
34+
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
2035

2136
# OkHttp
2237
-dontwarn okhttp3.**
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:shape="rectangle">
4+
<gradient
5+
android:type="linear"
6+
android:startColor="#FFAB91"
7+
android:endColor="#C63F17"
8+
android:angle="135"/>
9+
</shape>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="ic_launcher_background">#FF7043</color>
4+
</resources>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">Argosy DBG</string>
4+
</resources>

app/src/main/kotlin/com/nendo/argosy/ui/theme/Theme.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import androidx.compose.runtime.getValue
1212
import androidx.compose.runtime.staticCompositionLocalOf
1313
import androidx.compose.ui.graphics.Color
1414
import androidx.hilt.navigation.compose.hiltViewModel
15+
import com.nendo.argosy.BuildConfig
1516
import com.nendo.argosy.data.preferences.ThemeMode
1617

1718
private fun colorToHsv(color: Color): FloatArray {
@@ -146,19 +147,21 @@ fun ALauncherTheme(
146147
ThemeMode.SYSTEM -> isSystemInDarkTheme()
147148
}
148149

150+
val defaultPrimary = if (BuildConfig.DEBUG) ALauncherColors.Orange else ALauncherColors.Indigo
151+
val defaultPrimaryDark = if (BuildConfig.DEBUG) ALauncherColors.OrangeDark else ALauncherColors.IndigoDark
149152
val primaryColor = themeState.primaryColor?.let { Color(it) }
150153

151154
val colorScheme = if (isDarkTheme) {
152155
createDarkColorScheme(
153-
primary = primaryColor ?: ALauncherColors.Indigo
156+
primary = primaryColor ?: defaultPrimary
154157
)
155158
} else {
156159
createLightColorScheme(
157-
primary = primaryColor ?: ALauncherColors.IndigoDark
160+
primary = primaryColor ?: defaultPrimaryDark
158161
)
159162
}
160163

161-
val focusGlow = (primaryColor ?: ALauncherColors.Indigo).copy(alpha = 0.4f)
164+
val focusGlow = (primaryColor ?: defaultPrimary).copy(alpha = 0.4f)
162165

163166
val launcherConfig = LauncherThemeConfig(
164167
isDarkTheme = isDarkTheme,

0 commit comments

Comments
 (0)