From a4716c4ae8c71bdf9d57e68b2b9ca457d8828c5d Mon Sep 17 00:00:00 2001 From: EndureBlaze Date: Wed, 21 Sep 2022 11:07:55 +0800 Subject: [PATCH] :bookmark: Releases 0.0.9.1 --- app/build.gradle | 4 ++-- .../main/java/ren/imyan/app_tracker/net/AppTrackerRepo.kt | 1 + app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ee1a2ba..ef0f3af 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "ren.imyan.app_tracker" minSdk 21 targetSdk 31 - versionCode 9 - versionName "0.0.9" + versionCode 10 + versionName "0.0.9.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/ren/imyan/app_tracker/net/AppTrackerRepo.kt b/app/src/main/java/ren/imyan/app_tracker/net/AppTrackerRepo.kt index 8e7ed4f..3b5a6e5 100644 --- a/app/src/main/java/ren/imyan/app_tracker/net/AppTrackerRepo.kt +++ b/app/src/main/java/ren/imyan/app_tracker/net/AppTrackerRepo.kt @@ -1,6 +1,7 @@ package ren.imyan.app_tracker.net import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import okhttp3.MediaType diff --git a/app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt b/app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt index 4eade4c..8f679d7 100644 --- a/app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt +++ b/app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt @@ -13,9 +13,11 @@ import android.net.Uri import android.os.Build import android.os.Environment import android.provider.MediaStore +import android.util.Log import android.widget.Toast import androidx.lifecycle.viewModelScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.* import kotlinx.coroutines.launch import org.threeten.bp.LocalDateTime @@ -183,6 +185,7 @@ class MainViewModel : BaseViewModel() { private fun submitAppInfo(infoList: List) { infoList.asFlow().onEach { + delay(200) repo.submitAppInfo(it).catch { emitEvent { MainEvent.UploadFail @@ -207,6 +210,7 @@ class MainViewModel : BaseViewModel() { val iconFile = it.second.setBackground().toSize(288f, 288f) .toFile("${it.first}.png", format = Bitmap.CompressFormat.PNG) if (iconFile != null) { + delay(200) repo.submitAppIcon(it.first, iconFile).catch { err -> err.printStackTrace() emitEvent { @@ -228,6 +232,7 @@ class MainViewModel : BaseViewModel() { private fun submitAll(infoList: List, iconList: Map) { infoList.asFlow().onEach { + delay(200) repo.submitAppInfo(it).catch { emitEvent { MainEvent.UploadFail @@ -248,6 +253,7 @@ class MainViewModel : BaseViewModel() { val iconFile = icons.second.setBackground().toSize(288f, 288f) .toFile("${icons.first}.png", format = Bitmap.CompressFormat.PNG) if (iconFile != null) { + delay(200) repo.submitAppIcon(icons.first, iconFile).catch { err -> err.printStackTrace() emitEvent {