Repository navigation
[FIX] 2차 QA 수정사항 반영 (온보딩/프로필) #223
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
Merged
The head ref may contain hidden characters: "FLT-32-2\uCC28-qa-\uC784\uCC28\uBBFC"
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5013a97
fix: 프로필 qa 반영
ckals413 dba6ed7
fix: OTT 정보 노출 처리 qa 반영
ckals413 f5f8ce4
feat: 내 프로필 북마크 취소 시 목록에서 즉시 제거되도록 수정
ckals413 426aa87
fix: 폴더 qa 반영
ckals413 063ab60
fix: 프로필 이미지 업로드 로직 순서 변경
ckals413 837315b
fix: 온보딩 프로필 설정 화면의 키보드 대응 및 레이아웃 개선
ckals413 af340f3
feat: 코드래빗 반영
ckals413 e913857
feat: 코드리뷰 반영
ckals413 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
55 changes: 55 additions & 0 deletions
55
app/src/main/java/com/flint/android/domain/repository/ProfileImageUploader.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,55 @@ | ||
| package com.flint.android.domain.repository | ||
|
|
||
| import android.content.Context | ||
| import android.net.Uri | ||
| import com.flint.android.core.common.util.suspendRunCatching | ||
| import com.flint.android.domain.type.FileExtension | ||
| import com.flint.android.domain.type.StoragePathType | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import kotlinx.coroutines.Dispatchers | ||
| import kotlinx.coroutines.withContext | ||
| import javax.inject.Inject | ||
|
|
||
| // 온보딩(회원가입)과 프로필 수정 화면에서 공통으로 쓰는 | ||
| // "이미지 읽기 -> presigned URL 발급 -> S3 업로드 -> 서버에 반영" 흐름을 한 곳에 모아둔다. | ||
| class ProfileImageUploader @Inject constructor( | ||
| @ApplicationContext private val context: Context, | ||
| private val storageRepository: StorageRepository, | ||
| private val userRepository: UserRepository, | ||
| ) { | ||
| suspend fun upload(uri: Uri): Result<Unit> { | ||
| val (mimeType, imageBytes) = suspendRunCatching { | ||
| withContext(Dispatchers.IO) { | ||
| val resolvedMimeType = context.contentResolver.getType(uri) ?: "image/jpeg" | ||
| val bytes = context.contentResolver.openInputStream(uri)?.use { it.readBytes() } | ||
| resolvedMimeType to bytes | ||
| } | ||
| }.getOrElse { error -> return Result.failure(error) } | ||
|
|
||
| if (imageBytes == null) { | ||
| return Result.failure(IllegalStateException("Failed to open image stream")) | ||
| } | ||
|
|
||
| val extension = mimeTypeToFileExtension(mimeType) | ||
|
|
||
| val presignedUrl = storageRepository.getPresignedUrl( | ||
| pathType = StoragePathType.USER_PROFILE, | ||
| extension = extension, | ||
| ).getOrElse { error -> return Result.failure(error) } | ||
|
|
||
| storageRepository.uploadToS3( | ||
| uploadUrl = presignedUrl.uploadUrl, | ||
| imageBytes = imageBytes, | ||
| mimeType = mimeType, | ||
| ).getOrElse { error -> return Result.failure(error) } | ||
|
|
||
| return userRepository.updateProfileImage(presignedUrl.key) | ||
| } | ||
|
|
||
| private fun mimeTypeToFileExtension(mimeType: String): FileExtension = when (mimeType) { | ||
| "image/png" -> FileExtension.PNG | ||
| "image/gif" -> FileExtension.GIF | ||
| "image/webp" -> FileExtension.WEBP | ||
| else -> FileExtension.JPEG | ||
| } | ||
| } |
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
2 changes: 2 additions & 0 deletions
2
.../main/java/com/flint/android/presentation/collectionlist/uistate/CollectionListUiState.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 |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| package com.flint.android.presentation.collectionlist.uistate | ||
|
|
||
| import com.flint.android.core.common.util.UiState | ||
| import com.flint.android.core.navigation.model.CollectionListRouteType | ||
| import com.flint.android.domain.model.collection.CollectionListModel | ||
|
|
||
| data class CollectionListUiState( | ||
| val appbarTitle: String = "", | ||
| val routeType: CollectionListRouteType = CollectionListRouteType.CREATED, | ||
| val collectionList: UiState<CollectionListModel> = UiState.Loading | ||
| ) |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: imflint/Flint-Android
Length of output: 50378
🏁 Script executed:
Repository: imflint/Flint-Android
Length of output: 21934
🏁 Script executed:
Repository: imflint/Flint-Android
Length of output: 50378
🏁 Script executed:
Repository: imflint/Flint-Android
Length of output: 23749
타 사용자 저장 목록의 개수에서
isBookmarked를 사용하지 마세요.ProfileRoute는 타 사용자 프로필의uiState.userId를SAVED라우트로 전달합니다.CollectionListViewModel은 해당userId로 저장 목록을 조회하지만,ProfileViewModel은 타 사용자 목록에서 현재 사용자의isBookmarked상태만 변경합니다. 따라서 현재 사용자가 저장하지 않은 항목이 개수에서 제외됩니다. 타 사용자 저장 목록은collections.size로 계산하세요.🤖 Prompt for AI Agents