Skip to content

[FEAT/#364] 공고 상세 뷰 / 카카오톡 공유하기#373

Merged
arinming merged 17 commits into
developfrom
feat/#364-share-kakao
Apr 23, 2025
Merged

[FEAT/#364] 공고 상세 뷰 / 카카오톡 공유하기#373
arinming merged 17 commits into
developfrom
feat/#364-share-kakao

Conversation

@arinming
Copy link
Copy Markdown
Contributor

@arinming arinming commented Apr 1, 2025

⛳️ Work Description

  • 공유하기 버튼 추가
  • 카카오 공유하기 커스텀 피드로 구현
  • 카카오 공유하기 ViewModel 추가

📸 Screenshot

364.webm

📢 To Reviewers

  • 카카오 공유하기 기능은 구현했고, 딥링크는 추후 구현할 예정입니다,..,✨

@arinming arinming added UI 💐 UI 작업 아린💛 아린 labels Apr 1, 2025
@arinming arinming added this to the 4차 스프린트 작업 milestone Apr 1, 2025
@arinming arinming self-assigned this Apr 1, 2025
@arinming arinming linked an issue Apr 1, 2025 that may be closed by this pull request
2 tasks
Copy link
Copy Markdown
Member

@boiledeggg boiledeggg left a comment

Choose a reason for hiding this comment

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

너무 고생하셨어요👍 카카오 로직 관련해서 제 생각을 조금 달아봤는데 보시고 의견 남겨주세용~

painter = painterResource(id = R.drawable.ic_back),
contentDescription = stringResource(id = R.string.ic_back),
modifier = Modifier
modifier = modifier
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

파라미터로 받는 modifier는 CenterAlignedTopAppBar의 수정자로 사용하는게 적합하다고 생각해요!
이렇게 내부 컴포넌트의 수정자로 사용하게 되면 외부에서 이 탑바를 호출하여 사용할 때 수정자로 인한 혼란이 생길 것 같네요,,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

아공 맨날 요부분 실수하네여 ㅠ 섬세킹!!! 따봉석준!!!

Comment on lines +325 to +359
private fun shareToKakaoTalk(context: Context, internInfo: InternInfo) {
val templateId = 118600L

val templateArgs = mapOf(
"COMPANY_IMG" to internInfo.companyImage,
"TITLE" to internInfo.title,
"DEADLINE" to internInfo.deadline,
"START_DATE" to internInfo.startYearMonth,
"PERIOD" to internInfo.workingPeriod,
"REGI_WEB_DOMAIN" to internInfo.url,
"A_E" to internInfo.url,
"I_E" to internInfo.url
)

if (ShareClient.instance.isKakaoTalkSharingAvailable(context)) {
ShareClient.instance.shareCustom(
context,
templateId,
templateArgs
) { sharingResult, error ->
if (error != null) {
Timber.e("카카오톡 공유 실패: ${error.message}")
} else if (sharingResult != null) {
context.startActivity(sharingResult.intent)
}
}
} else {
val sharerUrl = WebSharerClient.instance.makeCustomUrl(templateId, templateArgs)
try {
KakaoCustomTabsClient.openWithDefault(context, sharerUrl)
} catch (e: Exception) {
Timber.e("웹 공유 실패: ${e.message}")
}
}
}
Copy link
Copy Markdown
Member

@boiledeggg boiledeggg Apr 1, 2025

Choose a reason for hiding this comment

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

개인적으로 카카오 관련 로직은 따로 designsystem/util에 클래스로 만들거나, 카카오 모듈 또는 써드파티 라이브러리를 위한 모듈을 만들어서 관리하면 좋을 것 같아요!

InternViewModel에서 templateArgs을 만들어서 카카오 공유하기 Util 클래스의 함수를 호출하는 식으로 풀면 될 것 같고, Context는 ApplicationContext를 힐트로 주입받는 식으로 해결할 수 있을 것 같네요!

이렇게 하면 이 로직을 뷰모델에서 관리할 수 있지 않을까 추측해봅니다😄

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

좋은 의견인 것 같아요!🚀
카카오 관련 클래스를 하나 만들면 제가 카카오 로그인에 사용했던 부분들도 그 쪽으로 옮길 수 있을 것 같네용

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

헉 ㅠ 동의합니다
이렇게 리팩토링하니 로직 분리가 되어서 훨씬 깔끔하고 유지보수하기 좋아졌네요
아직 이 코드에 딥링크 적용하기엔 너무 복잡한 것 같아서 임시방편으로 공유 되는 것까지 확인했습니다! 감사해용오 ㅜㅜ!!!!

data class Toast(@StringRes val message: Int) :
InternSideEffect()

data class ShareKakaoTalk(val internInfo: InternInfo) : InternSideEffect()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

위처럼 바꾸면 ShareKakaoTalk SideEffect도 불필요해지겠네요!

Comment on lines +69 to +75
fun shareWithKakaoTalk(
internInfo: InternInfo
) {
viewModelScope.launch {
_sideEffect.emit(InternSideEffect.ShareKakaoTalk(internInfo))
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

여기에서 바로 카카오 공유하기를 실행시키는 그런 그림?

Copy link
Copy Markdown
Member

@Hyobeen-Park Hyobeen-Park left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!! 최고에욥😊

navController.popBackStack()
},
actions = listOf(
{},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

요기 빈 람다 없어도 되는거면 지우는게 좋을 것 같아요!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

생각해보니 탑바 액션 리스트에서 이제 drop 1을 할 필요가 없는데 나이스캐치네요 ㅠㅠ 싹다 리팩토링ㅎ ㅐ주었습니다

Comment on lines +185 to +187
.noRippleClickable {
onClickShareButton()
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

onClick 함수가 2번 적용되는 것 같아요! Icon 내부에서 클릭 이벤트를 지정해준다면 IconButton을 사용하지 않아도 괜찮지 않을까 싶네요😊

Suggested change
.noRippleClickable {
onClickShareButton()
}
.noRippleClickable(onClick = onClickShareButton)

그리고 람다를 새로 생성하면 객체가 하나 추가되는거라 미세하게나마 성능에 영향을 줄 수 있을 것 같아요! onClickShareButton만 실행하는 것이라면 함수 그대로 바로 넘겨주는 것은 어떨까요?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

가독성이 훨씬 좋아졌읍니다 최고 ㅠㅠ!

Copy link
Copy Markdown
Member

@leeeyubin leeeyubin left a comment

Choose a reason for hiding this comment

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

수고하셨어요!! 딥링크도 아자아자..🔥

Comment on lines +325 to +359
private fun shareToKakaoTalk(context: Context, internInfo: InternInfo) {
val templateId = 118600L

val templateArgs = mapOf(
"COMPANY_IMG" to internInfo.companyImage,
"TITLE" to internInfo.title,
"DEADLINE" to internInfo.deadline,
"START_DATE" to internInfo.startYearMonth,
"PERIOD" to internInfo.workingPeriod,
"REGI_WEB_DOMAIN" to internInfo.url,
"A_E" to internInfo.url,
"I_E" to internInfo.url
)

if (ShareClient.instance.isKakaoTalkSharingAvailable(context)) {
ShareClient.instance.shareCustom(
context,
templateId,
templateArgs
) { sharingResult, error ->
if (error != null) {
Timber.e("카카오톡 공유 실패: ${error.message}")
} else if (sharingResult != null) {
context.startActivity(sharingResult.intent)
}
}
} else {
val sharerUrl = WebSharerClient.instance.makeCustomUrl(templateId, templateArgs)
try {
KakaoCustomTabsClient.openWithDefault(context, sharerUrl)
} catch (e: Exception) {
Timber.e("웹 공유 실패: ${e.message}")
}
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

좋은 의견인 것 같아요!🚀
카카오 관련 클래스를 하나 만들면 제가 카카오 로그인에 사용했던 부분들도 그 쪽으로 옮길 수 있을 것 같네용

@arinming arinming requested a review from Hyobeen-Park April 21, 2025 13:38
Copy link
Copy Markdown
Member

@boiledeggg boiledeggg left a comment

Choose a reason for hiding this comment

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

너무 고생많으셨습니다!! 마지막 딥링크까지 화이팅💪

Comment thread feature/intern/build.gradle.kts Outdated
dependencies {
// domain
implementation(projects.domain.intern)
implementation(libs.kakao.share)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

카카오 util 클래스를 만들었으니 이 의존성은 없어도 되지 않나요??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

나이스 캐치 감사합니당!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

멋있따!

class KakaoUtil @Inject constructor(
@ApplicationContext private val context: Context
) {
private val templateId = 118600L
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

이 templateId는 무슨 기준으로 넣는건가요?? 단순 궁금증ㅎ

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

카카오 공유하기 메시지를 커스텀으로 만들때 식별하는 ID인데 일단 임의로 넣어둔 값이고 지금은 의미가 없어서 ㅜㅜ 다음 feature에서 유동적으로 수정하려고 합니당!

Copy link
Copy Markdown
Member

@leeeyubin leeeyubin left a comment

Choose a reason for hiding this comment

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

확인했습니다! 만약에 저도 로그인 로직 구현을 위해 이 KakaoUtil 클래스를 사용한다면 따로 인터페이스를 만들어서 역할을 분리할 수 있게 만들어야겠네요!

@arinming arinming merged commit eb82547 into develop Apr 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UI 💐 UI 작업 아린💛 아린

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEAT] 공고 상세 뷰 / 카카오톡 공유하기 기능 추가

4 participants