Release 1.2.1

- Fixed the dictionary update card taking too long to reappear after
  cancelling a download (DownloadManager).
- Bump agp 9.3.0 -> 9.3.1; migrate the release build type from
  isMinifyEnabled/isShrinkResources/proguardFiles to
  optimization { enable = true } with keep rules moved to
  app/src/release/keepRules/proguard-rules.keep.
This commit is contained in:
2026-07-31 10:47:29 +03:00
parent c8adf537d4
commit 69bbb97b2a
6 changed files with 17 additions and 13 deletions
@@ -24,6 +24,7 @@ class DownloadManager(
mutableDownloadProgressState.asStateFlow()
private val mutex = Mutex()
private var downloadJob: Job? = null
private var cancelCleanupJob: Job? = null
companion object {
private const val TAG = "DownloadManager"
@@ -44,6 +45,7 @@ class DownloadManager(
fun startDownload() {
if (downloadState.value is DownloadState.Loading) return
if (!downloadScope.isActive) return
cancelCleanupJob = null
downloadJob = downloadScope.launch {
mutex.withLock {
try {
@@ -94,7 +96,7 @@ class DownloadManager(
} catch (e: Exception) {
if (e is CancellationException) {
updateDownloadProgressState(DownloadState.Cancelled, 0f)
downloadScope.launch {
cancelCleanupJob = downloadScope.launch {
try {
dictionaryRepository.deleteUnprocessedFiles()
} catch (cleanupException: Exception) {
@@ -124,6 +126,7 @@ class DownloadManager(
fun startDownloadForSources(sourceUrls: List<String>) {
if (downloadState.value is DownloadState.Loading) return
if (!downloadScope.isActive) return
cancelCleanupJob = null
downloadJob = downloadScope.launch {
mutex.withLock {
try {
@@ -168,7 +171,7 @@ class DownloadManager(
} catch (e: Exception) {
if (e is CancellationException) {
updateDownloadProgressState(DownloadState.Cancelled, 0f)
downloadScope.launch {
cancelCleanupJob = downloadScope.launch {
try {
dictionaryRepository.deleteUnprocessedFiles()
} catch (cleanupException: Exception) {
@@ -195,10 +198,12 @@ class DownloadManager(
}
}
fun cancelDownload() {
downloadJob?.cancel()
val jobToCancel = downloadJob
jobToCancel?.cancel()
updateDownloadProgressState(DownloadState.Cancelled, 0f)
downloadScope.launch {
delay(TERMINAL_STATE_DURATION)
jobToCancel?.join()
cancelCleanupJob?.join()
if (downloadState.value == DownloadState.Cancelled) {
updateDownloadProgressState(DownloadState.Idle, 0f)
}
@@ -0,0 +1,11 @@
# Remove logging in release builds
# Keep Log.w() and Log.e() for crash reporting, remove only verbose/debug/info
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** i(...);
}
-keepattributes *Annotation*
-keepattributes SourceFile, LineNumberTable