-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 프로필 이미지 업로드 UI, UseCase구현 * image upload api 구현(미완) * file provider 추가 * image upload api 수정 * 이미지 저장되지 않는 현상 수정
- Loading branch information
Showing
22 changed files
with
427 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<paths xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<!--Context.getFilesDir()--> | ||
<files-path name="files" path="." /> | ||
|
||
<!--getCacheDir()--> | ||
<cache-path name="cache" path="." /> | ||
|
||
<!--Environment.getExternalStorageDirectory()--> | ||
<external-path name="external" path="." /> | ||
|
||
<!--Context.getExternalFilesDir(null)--> | ||
<external-files-path name="external_files" path="."/> | ||
|
||
<!--Context.getExternalCacheDir()--> | ||
<external-cache-path name="external_cache" path="."/> | ||
|
||
<!--only available on API 21+ devices.--> | ||
<!--Context.getExternalMediaDirs()--> | ||
<external-media-path name="external_media" path="."/> | ||
</paths> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
data/src/main/java/com/dkin/chevit/data/model/request/ProfileImageUploadPayload.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.dkin.chevit.data.model.request | ||
|
||
import com.dkin.chevit.data.DataModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
internal data class ProfileImageUploadPayload( | ||
@SerialName("fileSize") val fileSize: Int, | ||
@SerialName("mimeType") val mimeType: String, | ||
) : DataModel |
12 changes: 12 additions & 0 deletions
12
data/src/main/java/com/dkin/chevit/data/model/response/ProfileImageUploadResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.dkin.chevit.data.model.response | ||
|
||
import com.dkin.chevit.data.DataModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
internal data class ProfileImageUploadResponse( | ||
@SerialName("uploadMethod") val uploadMethod: String = "", | ||
@SerialName("uploadURL") val uploadURL: String = "", | ||
@SerialName("imageURL") val imageURL: String = "", | ||
) : DataModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
data/src/main/java/com/dkin/chevit/data/remote/ImageAPI.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.dkin.chevit.data.remote | ||
|
||
import okhttp3.RequestBody | ||
import retrofit2.http.Body | ||
import retrofit2.http.PUT | ||
import retrofit2.http.Url | ||
|
||
internal interface ImageAPI { | ||
@PUT | ||
suspend fun uploadProfileImage( | ||
@Url url: String, | ||
@Body file: RequestBody | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
domain/src/main/java/com/dkin/chevit/domain/model/ProfileImageData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.dkin.chevit.domain.model | ||
|
||
import com.dkin.chevit.domain.base.DomainModel | ||
|
||
data class ProfileImageData( | ||
val uploadMethod: String, | ||
val uploadURL: String, | ||
val uploadHeaders: String, | ||
val imageURL: String | ||
) : DomainModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
domain/src/main/java/com/dkin/chevit/domain/usecase/auth/GetProfileImageDataUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.dkin.chevit.domain.usecase.auth | ||
|
||
import com.dkin.chevit.domain.base.CoroutineDispatcherProvider | ||
import com.dkin.chevit.domain.base.IOUseCase | ||
import com.dkin.chevit.domain.model.ProfileImageData | ||
import com.dkin.chevit.domain.repository.AuthRepository | ||
|
||
class GetProfileImageDataUseCase( | ||
coroutineDispatcherProvider: CoroutineDispatcherProvider, | ||
private val authRepository: AuthRepository, | ||
) : IOUseCase<GetProfileImageDataUseCase.Param, ProfileImageData>(coroutineDispatcherProvider = coroutineDispatcherProvider) { | ||
override suspend fun execute(params: Param): ProfileImageData { | ||
return authRepository.getProfileUploadURL(params.fileSize) | ||
} | ||
|
||
@JvmInline | ||
value class Param(val fileSize: Int) | ||
} |
29 changes: 29 additions & 0 deletions
29
domain/src/main/java/com/dkin/chevit/domain/usecase/auth/UploadProfileImageUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.dkin.chevit.domain.usecase.auth | ||
|
||
import com.dkin.chevit.domain.base.CoroutineDispatcherProvider | ||
import com.dkin.chevit.domain.base.IOUseCase | ||
import com.dkin.chevit.domain.base.None | ||
import com.dkin.chevit.domain.repository.AuthRepository | ||
import java.io.File | ||
|
||
class UploadProfileImageUseCase( | ||
coroutineDispatcherProvider: CoroutineDispatcherProvider, | ||
private val authRepository: AuthRepository, | ||
) : IOUseCase<UploadProfileImageUseCase.Param, None>(coroutineDispatcherProvider = coroutineDispatcherProvider) { | ||
override suspend fun execute(params: Param): None { | ||
authRepository.uploadProfileImage( | ||
uploadURL = params.uploadURL, | ||
uploadMethod = params.uploadMethod, | ||
uploadHeaders = params.uploadHeaders, | ||
file = params.file | ||
) | ||
return None | ||
} | ||
|
||
data class Param( | ||
val uploadURL: String, | ||
val uploadMethod: String, | ||
val uploadHeaders: String, | ||
val file: File | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.