Skip to content

Commit

Permalink
🔖 Releases 0.0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanren1225 committed Sep 21, 2022
1 parent 5d7d43d commit a4716c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -183,6 +185,7 @@ class MainViewModel : BaseViewModel<MainData, MainEvent, MainAction>() {

private fun submitAppInfo(infoList: List<AppInfo>) {
infoList.asFlow().onEach {
delay(200)
repo.submitAppInfo(it).catch {
emitEvent {
MainEvent.UploadFail
Expand All @@ -207,6 +210,7 @@ class MainViewModel : BaseViewModel<MainData, MainEvent, MainAction>() {
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 {
Expand All @@ -228,6 +232,7 @@ class MainViewModel : BaseViewModel<MainData, MainEvent, MainAction>() {

private fun submitAll(infoList: List<AppInfo>, iconList: Map<String, Bitmap>) {
infoList.asFlow().onEach {
delay(200)
repo.submitAppInfo(it).catch {
emitEvent {
MainEvent.UploadFail
Expand All @@ -248,6 +253,7 @@ class MainViewModel : BaseViewModel<MainData, MainEvent, MainAction>() {
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 {
Expand Down

0 comments on commit a4716c4

Please sign in to comment.