Skip to content
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

[업로드] 파일 선택 #105

Merged
merged 7 commits into from
Nov 16, 2023
Merged

[업로드] 파일 선택 #105

merged 7 commits into from
Nov 16, 2023

Conversation

HamBP
Copy link
Member

@HamBP HamBP commented Nov 16, 2023

Issue

Overview

  • 이미지를 선택할 수 있다.
  • 오디오 파일을 선택할 수 있다.

To Reviewers

#103 이 PR이 먼저 merge된 이후 충돌 해결하고 머지할게

@HamBP HamBP added ✨ feat 기능 개발 🤖 android android labels Nov 16, 2023
@HamBP HamBP added this to the 🆙 upload milestone Nov 16, 2023
@HamBP HamBP self-assigned this Nov 16, 2023
@HamBP HamBP linked an issue Nov 16, 2023 that may be closed by this pull request
@@ -27,5 +27,5 @@ android {
}

dependencies {

implementation(libs.appcompat)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요건 언제 쓰신 건가여?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registerForActivityResult의 파라미터 넣어줄 때 사용하는 PickVisualMedia랑 ActivityResultContracts가 액티비티를 필요로 해요

Copy link

github-actions bot commented Nov 16, 2023

Test Results

0 tests   0 ✔️  0s ⏱️
0 suites  0 💤
0 files    0

Results for commit dbe7cd9.

♻️ This comment has been updated with latest results.

Comment on lines 38 to 42
private fun setupSelectThumbnailImage() {
binding.cvUploadThumbnail.setOnClickListener {
filePickerLauncher.launch("audio/*")
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setUpSelectThumbnailImage 인데 filePickerLauncher가 아니라 pickMedia 를 써야할 것 같네용!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트하다가 잘못 올라갔넹 ㅠㅠ
수정할게

Comment on lines 18 to 30
private val pickMedia = registerForActivityResult(PickVisualMedia()) { uri ->
if (uri == null) return@registerForActivityResult

viewModel.uploadImage(uri.toFile())
}

private val filePickerLauncher =
registerForActivityResult(ActivityResultContracts.GetContent()) { uri ->
if (uri == null) return@registerForActivityResult

viewModel.uploadAudio(uri.toFile())
}

Copy link
Member

@youlalala youlalala Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2개 변수명 비슷한 형식으로 다시 짓는거 어떨까용??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반영해서 올릴게~

android:background="@drawable/ic_camera"
android:backgroundTint="@color/surface" />
android:src="@drawable/ic_camera"
android:importantForAccessibility="no"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

importantForAccessibility 이거 처음봐서 어떤건지 궁금하네요1!!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no를 지정하면 스크린 리더가 해당 View를 읽지 않는다는데, 이 아이콘은 장식용 아이콘이라 읽지 않아도 된다고 판단했어.
대신 상위 CardView에 contentDescription을 추가해서 어떤 동작을 수행할 수 있는지 명시해주고 있어

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tb_upload_appbar">
app:layout_constraintTop_toBottomOf="@id/tb_upload_appbar"
android:contentDescription="@string/select_thumbnail">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOOD@!~!

@2taezeat
Copy link
Collaborator

고생하셨습니다~


) : ViewModel() {

private var uploadedImage: String? = null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아직 개발이 덜 되어서, 놔두신것 같은데, nullable 한 string으로 하신 이유가 궁금합니다!
lateinit var 을 쓸 수 도 있을거 같아요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네이밍은 uploadedImageUrl이 더 적절할 수도 있겠네...
이 프로퍼티는 서버로 썸네일 이미지가 올라갔을 때 채워질 프로퍼티야. 아직 썸네일이 없을 수도 있으니 nullable로 뒀어

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

썸네일이 없는 경우는 Blank("") 로 하는 건 어떠신가요???

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

변수명은 말씀하신것 처럼 'uploadedImageUrl' 이 더 적절해 보입니다~

@HamBP HamBP merged commit 43decfc into develop Nov 16, 2023
2 checks passed
@youlalala youlalala deleted the android/feature/upload-100 branch November 20, 2023 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android android ✨ feat 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

업로드 - 파일 선택, 썸네일 선택
3 participants