File tree 4 files changed +11
-9
lines changed
data-remote/src/main/kotlin/com/bff/wespot/data/remote
4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package com.bff.wespot.data.remote.model.common
3
3
import kotlinx.serialization.Serializable
4
4
5
5
@Serializable
6
- data class ImageDto (
6
+ data class ImageUrlDto (
7
7
val url : String ,
8
8
val imageUrl : String
9
9
)
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package com.bff.wespot.data.remote.source
3
3
import com.bff.wespot.data.remote.model.common.BackgroundColorListDto
4
4
import com.bff.wespot.data.remote.model.common.CharacterListDto
5
5
import com.bff.wespot.data.remote.model.common.EditProfileDto
6
- import com.bff.wespot.data.remote.model.common.ImageDto
6
+ import com.bff.wespot.data.remote.model.common.ImageUrlDto
7
7
import com.bff.wespot.data.remote.model.common.KakaoContentDto
8
8
import com.bff.wespot.data.remote.model.common.ProfanityDto
9
9
import com.bff.wespot.data.remote.model.common.ReportDto
@@ -22,7 +22,7 @@ interface CommonDataSource {
22
22
23
23
suspend fun checkRestriction (): Result <RestrictionDto >
24
24
25
- suspend fun getPresignedUrl (mimeType : String ): Result <ImageDto >
25
+ suspend fun getPresignedUrl (mimeType : String ): Result <ImageUrlDto >
26
26
27
27
suspend fun uploadImage (url : String , imagePath : String ): Boolean
28
28
}
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package com.bff.wespot.data.remote.source
3
3
import com.bff.wespot.data.remote.model.common.BackgroundColorListDto
4
4
import com.bff.wespot.data.remote.model.common.CharacterListDto
5
5
import com.bff.wespot.data.remote.model.common.EditProfileDto
6
- import com.bff.wespot.data.remote.model.common.ImageDto
6
+ import com.bff.wespot.data.remote.model.common.ImageUrlDto
7
7
import com.bff.wespot.data.remote.model.common.KakaoContentDto
8
8
import com.bff.wespot.data.remote.model.common.ProfanityDto
9
9
import com.bff.wespot.data.remote.model.common.ReportDto
@@ -82,7 +82,7 @@ class CommonDataSourceImpl @Inject constructor(
82
82
}
83
83
}
84
84
85
- override suspend fun getPresignedUrl (mimeType : String ): Result <ImageDto > =
85
+ override suspend fun getPresignedUrl (mimeType : String ): Result <ImageUrlDto > =
86
86
httpClient.safeRequest {
87
87
url {
88
88
method = HttpMethod .Get
Original file line number Diff line number Diff line change @@ -6,18 +6,20 @@ import android.graphics.BitmapFactory
6
6
import android.net.Uri
7
7
import com.bff.wespot.data.remote.model.ImageUploadFailedException
8
8
import dagger.hilt.android.qualifiers.ApplicationContext
9
+ import kotlinx.coroutines.CoroutineDispatcher
10
+ import kotlinx.coroutines.withContext
9
11
import java.io.File
10
12
import java.io.FileOutputStream
11
13
import javax.inject.Inject
12
14
13
15
14
16
class ImageDecoderDataSourceImpl @Inject constructor(
15
- @ApplicationContext private val context : Context
17
+ @ApplicationContext private val context : Context ,
18
+ private val ioDispatcher : CoroutineDispatcher
16
19
) : ImageDecoderDataSource {
17
- override suspend fun decodeImage (imagePath : String ): String {
20
+ override suspend fun decodeImage (imagePath : String ): String = withContext(ioDispatcher) {
18
21
val uri = Uri .parse(imagePath)
19
-
20
- return resizeAndConvertToWebp(context, uri)
22
+ resizeAndConvertToWebp(context, uri)
21
23
}
22
24
23
25
private fun resizeAndConvertToWebp (
You can’t perform that action at this time.
0 commit comments