-
Notifications
You must be signed in to change notification settings - Fork 1
인증샷 업로드 기능 구현 #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chanho0908
wants to merge
21
commits into
feat/#52-detail-interaction
Choose a base branch
from
feat/#52-task-certification-save
base: feat/#52-detail-interaction
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
인증샷 업로드 기능 구현 #79
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
81957de
♻️ Refactor: TaskCertificationViewModel의 when 문 정리
chanho0908 f3c1f0e
♻️ Refactor: goalId를 ViewModel에서 SavedStateHandle로 주입받도록 수정
chanho0908 599accf
♻️ Refactor: 인증샷 화면 문구 수정
chanho0908 885adc9
♻️ Refactor: `CommentUiModel`에서 사용되지 않는 `isEmpty` 속성을 제거
chanho0908 c0eefba
✨ Feat: Uri를 ByteArray로 변환하는 확장 함수 추가
chanho0908 6f5225c
✨ Feat: goalId 부재 시 예외 처리 추가
chanho0908 91a6a9a
✨ Feat: 인증샷 업로드 API 연동
chanho0908 e9d433b
♻️ Refactor: 불필요한 id 전달 제거
chanho0908 2b79c6c
✨ Feat: TaskCertificationRefreshBus 추가
chanho0908 dfb8dc8
✨ Feat: UI 인증샷 업로드 기능 구현
chanho0908 a99943a
♻️ Refactor: GoalRefreshBus를 주입받아 인증글 변동 시 목표 리프레쉬 이벤트 발행하도록 수정
chanho0908 6c3f622
♻️ Refactor: ktlintformat 적용
chanho0908 aeba355
♻️ Refactor: SideEffect가 생성만 되고 실제로 emit되지 않는 문제 수정
chanho0908 37a3a40
♻️ Refactor: uriToByteArray 리소스 관리 및 예외 처리 개선
chanho0908 b75bec0
✨ Feat: 이미지 변환 실패 시 예외 처리 추가
chanho0908 dff1a2e
✨ Feat: 인증 상세 화면에서 코멘트가 없을 경우 표시하지 않도록 수정
chanho0908 204b7ce
♻️ Refactor: safeContentPadding을 windowInsetsPadding으로 변경
chanho0908 44c6f52
♻️ Refactor: 인증 상세 화면의 수정 기능 임시 비활성화
chanho0908 f291771
✨ Feat: 빈 리스트 응답 임시 예외 처리 구현
chanho0908 fa08f3d
♻️ Refactor: 주석 처리 누락 수정
chanho0908 2fd68a5
✨ Feat: 챌린지 상세 화면의 리액션 버튼 임시 제거
chanho0908 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
12 changes: 12 additions & 0 deletions
12
core/network/src/main/java/com/twix/network/model/request/photolog/mapper/PhotologMapper.kt
This file contains hidden or 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.twix.network.model.request.photolog.mapper | ||
|
|
||
| import com.twix.domain.model.photo.PhotologParam | ||
| import com.twix.network.model.request.photolog.model.PhotologRequest | ||
|
|
||
| fun PhotologParam.toRequest(): PhotologRequest = | ||
| PhotologRequest( | ||
| goalId = goalId, | ||
| fileName = fileName, | ||
| comment = comment, | ||
| verificationDate = verificationDate.toString(), | ||
| ) |
12 changes: 12 additions & 0 deletions
12
core/network/src/main/java/com/twix/network/model/request/photolog/model/PhotologRequest.kt
This file contains hidden or 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.twix.network.model.request.photolog.model | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class PhotologRequest( | ||
| @SerialName("goalId") val goalId: Long, | ||
| @SerialName("fileName") val fileName: String, | ||
| @SerialName("comment") val comment: String, | ||
| @SerialName("verificationDate") val verificationDate: String, | ||
| ) |
This file contains hidden or 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 hidden or 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,40 @@ | ||
| package com.twix.ui.extension | ||
|
|
||
| import android.content.Context | ||
| import android.graphics.Bitmap | ||
| import android.graphics.BitmapFactory | ||
| import android.net.Uri | ||
| import java.io.ByteArrayOutputStream | ||
|
|
||
| /** | ||
| * 주어진 [Uri]로부터 이미지를 읽어 JPEG 형식의 [ByteArray]로 변환한다. | ||
| * | ||
| * 내부 동작 과정: | ||
| * 1. [ContentResolver.openInputStream]으로 InputStream을 연다. | ||
| * 2. [BitmapFactory.decodeStream]으로 Bitmap 디코딩 | ||
| * 3. JPEG(품질 90) 압축 후 ByteArray 반환 | ||
| * | ||
| * 실패 케이스: | ||
| * - InputStream 열기 실패 | ||
| * - 디코딩 실패 (손상 이미지 등) | ||
| * - 압축 실패 | ||
| * | ||
| * @param imageUri 변환할 이미지 Uri (content:// 또는 file://) | ||
| * @return 변환 성공 시 JPEG 바이트 배열, 실패 시 null | ||
| */ | ||
| fun Context.uriToByteArray(imageUri: Uri): ByteArray? { | ||
| return try { | ||
| contentResolver.openInputStream(imageUri)?.use { inputStream -> | ||
| val bitmap = BitmapFactory.decodeStream(inputStream) ?: return null | ||
|
|
||
| ByteArrayOutputStream().use { outputStream -> | ||
| bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream) | ||
| bitmap.recycle() | ||
| outputStream.toByteArray() | ||
| } | ||
| } | ||
| } catch (e: Exception) { | ||
| e.printStackTrace() | ||
| null | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
core/util/src/main/java/com/twix/util/bus/TaskCertificationRefreshBus.kt
This file contains hidden or 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,17 @@ | ||
| package com.twix.util.bus | ||
|
|
||
| import kotlinx.coroutines.flow.MutableSharedFlow | ||
| import kotlinx.coroutines.flow.SharedFlow | ||
| import kotlinx.coroutines.flow.asSharedFlow | ||
|
|
||
| class TaskCertificationRefreshBus { | ||
| private val _events = | ||
| MutableSharedFlow<Unit>( | ||
| replay = 0, | ||
| extraBufferCapacity = 1, | ||
| ) | ||
|
|
||
| val events: SharedFlow<Unit> = _events.asSharedFlow() | ||
|
|
||
| fun notifyChanged() = _events.tryEmit(Unit) | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| package com.twix.util.di | ||
|
|
||
| import com.twix.util.bus.GoalRefreshBus | ||
| import com.twix.util.bus.TaskCertificationRefreshBus | ||
| import org.koin.dsl.module | ||
|
|
||
| val utilModule = | ||
| module { | ||
| single { GoalRefreshBus() } | ||
| single { TaskCertificationRefreshBus() } | ||
| } |
This file contains hidden or 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/twix/domain/model/photo/PhotologParam.kt
This file contains hidden or 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.twix.domain.model.photo | ||
|
|
||
| import java.time.LocalDate | ||
|
|
||
| data class PhotologParam( | ||
| val goalId: Long, | ||
| val fileName: String, | ||
| val comment: String, | ||
| val verificationDate: LocalDate, | ||
| ) |
3 changes: 3 additions & 0 deletions
3
domain/src/main/java/com/twix/domain/repository/PhotoLogRepository.kt
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.