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.
|
# OkHttp
|
||||||
# You can control the set of applied configuration files using the
|
-dontwarn okhttp3.**
|
||||||
# proguardFiles setting in build.gradle.
|
-dontwarn okio.**
|
||||||
#
|
-keep class okhttp3.** { *; }
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
# Coroutines
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
-dontwarn kotlinx.coroutines.**
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
# Play Services
|
||||||
# debugging stack traces.
|
-keep class com.google.android.gms.** { *; }
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
# WorkManager
|
||||||
# hide the original source file name.
|
-keep class * extends androidx.work.Worker
|
||||||
#-renamesourcefileattribute SourceFile
|
-keep class * extends androidx.work.CoroutineWorker
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,10 @@ class ListenerService : Service() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
unregisterReceiver(receiver)
|
try {
|
||||||
Log.d(TAG, "Listener service stopped, receiver unregistered")
|
unregisterReceiver(receiver)
|
||||||
|
} catch (_: IllegalArgumentException) { }
|
||||||
|
Log.d(TAG, "Listener service stopped")
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
private val foregroundGranted = mutableStateOf(false)
|
private val foregroundGranted = mutableStateOf(false)
|
||||||
private val backgroundGranted = mutableStateOf(false)
|
private val backgroundGranted = mutableStateOf(false)
|
||||||
private val serviceRunning = mutableStateOf(false)
|
|
||||||
|
|
||||||
private val foregroundPermissionLauncher = registerForActivityResult(
|
private val foregroundPermissionLauncher = registerForActivityResult(
|
||||||
ActivityResultContracts.RequestMultiplePermissions()
|
ActivityResultContracts.RequestMultiplePermissions()
|
||||||
|
|
@ -154,7 +153,6 @@ class MainActivity : ComponentActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListenerService.start(this)
|
ListenerService.start(this)
|
||||||
serviceRunning.value = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue