Skip to content

Commit eb7d490

Browse files
committed
[feat]#196: 코드 수정해요
1 parent 53bdb5d commit eb7d490

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

data-remote/src/main/kotlin/com/bff/wespot/data/remote/model/common/ImageDto.kt data-remote/src/main/kotlin/com/bff/wespot/data/remote/model/common/ImageUrlDto.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.bff.wespot.data.remote.model.common
33
import kotlinx.serialization.Serializable
44

55
@Serializable
6-
data class ImageDto(
6+
data class ImageUrlDto(
77
val url: String,
88
val imageUrl: String
99
)

data-remote/src/main/kotlin/com/bff/wespot/data/remote/source/CommonDataSource.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.bff.wespot.data.remote.source
33
import com.bff.wespot.data.remote.model.common.BackgroundColorListDto
44
import com.bff.wespot.data.remote.model.common.CharacterListDto
55
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
77
import com.bff.wespot.data.remote.model.common.KakaoContentDto
88
import com.bff.wespot.data.remote.model.common.ProfanityDto
99
import com.bff.wespot.data.remote.model.common.ReportDto
@@ -22,7 +22,7 @@ interface CommonDataSource {
2222

2323
suspend fun checkRestriction(): Result<RestrictionDto>
2424

25-
suspend fun getPresignedUrl(mimeType: String): Result<ImageDto>
25+
suspend fun getPresignedUrl(mimeType: String): Result<ImageUrlDto>
2626

2727
suspend fun uploadImage(url: String, imagePath: String): Boolean
2828
}

data-remote/src/main/kotlin/com/bff/wespot/data/remote/source/CommonDataSourceImpl.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.bff.wespot.data.remote.source
33
import com.bff.wespot.data.remote.model.common.BackgroundColorListDto
44
import com.bff.wespot.data.remote.model.common.CharacterListDto
55
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
77
import com.bff.wespot.data.remote.model.common.KakaoContentDto
88
import com.bff.wespot.data.remote.model.common.ProfanityDto
99
import com.bff.wespot.data.remote.model.common.ReportDto
@@ -82,7 +82,7 @@ class CommonDataSourceImpl @Inject constructor(
8282
}
8383
}
8484

85-
override suspend fun getPresignedUrl(mimeType: String): Result<ImageDto> =
85+
override suspend fun getPresignedUrl(mimeType: String): Result<ImageUrlDto> =
8686
httpClient.safeRequest {
8787
url {
8888
method = HttpMethod.Get

data-remote/src/main/kotlin/com/bff/wespot/data/remote/source/ImageDecoderDataSourceImpl.kt

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ import android.graphics.BitmapFactory
66
import android.net.Uri
77
import com.bff.wespot.data.remote.model.ImageUploadFailedException
88
import dagger.hilt.android.qualifiers.ApplicationContext
9+
import kotlinx.coroutines.CoroutineDispatcher
10+
import kotlinx.coroutines.withContext
911
import java.io.File
1012
import java.io.FileOutputStream
1113
import javax.inject.Inject
1214

1315

1416
class ImageDecoderDataSourceImpl @Inject constructor(
15-
@ApplicationContext private val context: Context
17+
@ApplicationContext private val context: Context,
18+
private val ioDispatcher: CoroutineDispatcher
1619
) : ImageDecoderDataSource {
17-
override suspend fun decodeImage(imagePath: String): String {
20+
override suspend fun decodeImage(imagePath: String): String = withContext(ioDispatcher) {
1821
val uri = Uri.parse(imagePath)
19-
20-
return resizeAndConvertToWebp(context, uri)
22+
resizeAndConvertToWebp(context, uri)
2123
}
2224

2325
private fun resizeAndConvertToWebp(

0 commit comments

Comments
 (0)