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
+5 -8
View File
@@ -92,8 +92,8 @@ android {
applicationId = "com.example.research"
minSdk = project.property("minSdk").toString().toInt()
targetSdk = project.property("targetSdk").toString().toInt()
versionCode = 4
versionName = "1.2.0"
versionCode = 5
versionName = "1.2.1"
vectorDrawables {
useSupportLibrary = true
@@ -114,12 +114,9 @@ android {
abiFilters += "arm64-v8a"
}
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
optimization {
enable = true
}
}
}
@@ -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)
}