Release cleanup: remove unused state, harden service, add proguard rules
- Remove unused serviceRunning state variable - Guard unregisterReceiver against double-call - Add proguard rules for OkHttp, Coroutines, Play Services, WorkManager - Remove empty drawable directory Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f4c41b1851
commit
38f9bb2c2a
3 changed files with 15 additions and 22 deletions
29
app/proguard-rules.pro
vendored
29
app/proguard-rules.pro
vendored
|
|
@ -1,21 +1,14 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
# OkHttp
|
||||
-dontwarn okhttp3.**
|
||||
-dontwarn okio.**
|
||||
-keep class okhttp3.** { *; }
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
# Coroutines
|
||||
-dontwarn kotlinx.coroutines.**
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
# Play Services
|
||||
-keep class com.google.android.gms.** { *; }
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
# WorkManager
|
||||
-keep class * extends androidx.work.Worker
|
||||
-keep class * extends androidx.work.CoroutineWorker
|
||||
|
|
|
|||
|
|
@ -39,8 +39,10 @@ class ListenerService : Service() {
|
|||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
try {
|
||||
unregisterReceiver(receiver)
|
||||
Log.d(TAG, "Listener service stopped, receiver unregistered")
|
||||
} catch (_: IllegalArgumentException) { }
|
||||
Log.d(TAG, "Listener service stopped")
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ class MainActivity : ComponentActivity() {
|
|||
|
||||
private val foregroundGranted = mutableStateOf(false)
|
||||
private val backgroundGranted = mutableStateOf(false)
|
||||
private val serviceRunning = mutableStateOf(false)
|
||||
|
||||
private val foregroundPermissionLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.RequestMultiplePermissions()
|
||||
|
|
@ -154,7 +153,6 @@ class MainActivity : ComponentActivity() {
|
|||
}
|
||||
}
|
||||
ListenerService.start(this)
|
||||
serviceRunning.value = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue