Skip to content

Commit

Permalink
✨ Change the format of the uploaded image to PNG
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanren1225 committed Mar 20, 2022
1 parent bd8d50e commit c891049
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AppTrackerRepo {

suspend fun submitAppIcon(packageName: String, icon: File) =
flow {
val iconFile = icon.asRequestBody("image/jpeg".toMediaTypeOrNull());
val iconFile = icon.asRequestBody("image/png".toMediaTypeOrNull());
emit(api.submitAppIcon(packageName, iconFile))
}.flowOn(Dispatchers.IO)
}
4 changes: 2 additions & 2 deletions app/src/main/java/ren/imyan/app_tracker/ui/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class MainViewModel : BaseViewModel<MainData, MainEvent, MainAction>() {
iconList.toList().asFlow().catch { err ->
err.printStackTrace()
}.onEach {
val iconFile = it.second.setBackground().toSize(288f, 288f).toFile("${it.first}.jpg")
val iconFile = it.second.setBackground().toSize(288f, 288f).toFile("${it.first}.png", format = Bitmap.CompressFormat.PNG)
if (iconFile != null) {
repo.submitAppIcon(it.first, iconFile).catch { err ->
err.printStackTrace()
Expand Down Expand Up @@ -240,7 +240,7 @@ class MainViewModel : BaseViewModel<MainData, MainEvent, MainAction>() {
err.printStackTrace()
}.onEach { icons ->
val iconFile = icons.second.setBackground().toSize(288f, 288f)
.toFile("${icons.first}.jpg")
.toFile("${icons.first}.png", format = Bitmap.CompressFormat.PNG)
if (iconFile != null) {
repo.submitAppIcon(icons.first, iconFile).catch { err ->
err.printStackTrace()
Expand Down

0 comments on commit c891049

Please sign in to comment.