Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.androidx.lifecycle.runtime.ktx)

// Kakao login SDK
// Kakao SDK
implementation(libs.kakao.login)
implementation(libs.kakao.talk)

// Hilt for Dependency Injection
implementation(libs.hilt.android)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ import com.eatssu.android.presentation.mypage.myreview.MyReviewListComposeActivi
import com.eatssu.android.presentation.mypage.terms.WebViewActivity
import com.eatssu.android.presentation.mypage.userinfo.UserInfoActivity
import com.eatssu.android.presentation.util.showToast
import com.eatssu.common.EventLogger
import com.eatssu.common.UiEvent
import com.eatssu.common.UiState
import com.eatssu.common.enums.ScreenId
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import com.kakao.sdk.common.util.KakaoCustomTabsClient
import com.kakao.sdk.talk.TalkApiClient
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -138,11 +141,15 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>(ScreenId.MYPAGE_MAIN)
}

binding.llInquire.setOnClickListener {
startWebView(
getString(R.string.kakao_talk_channel_url),
getString(R.string.contact),
ScreenId.EXTERNAL_INQUIRE
)
val context = requireContext()
val channelPublicId = "_ZlVAn"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

채널 ID가 하드코딩되어 있습니다. 코드의 가독성과 유지보수성을 높이기 위해 companion object에 상수로 정의하는 것을 권장합니다. 예를 들어, MyPageFragment 클래스 내에 companion object { private const val KAKAO_TALK_CHANNEL_PUBLIC_ID = "_ZlVAn" }를 추가하고, 이 상수를 사용해주세요.

Suggested change
val channelPublicId = "_ZlVAn"
val channelPublicId = KAKAO_TALK_CHANNEL_PUBLIC_ID

Copy link
Member

Choose a reason for hiding this comment

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

상수화하면 조을것 같아용


TalkApiClient.instance.chatChannel(context, channelPublicId) {
val url = TalkApiClient.instance.chatChannelUrl(channelPublicId)
KakaoCustomTabsClient.openWithDefault(context, url)
}
Comment on lines +147 to +150
Copy link
Contributor

Choose a reason for hiding this comment

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

high

TalkApiClient.instance.chatChannel의 콜백 사용법이 올바르지 않습니다. 이 콜백은 카카오톡 앱 실행 시도 후 항상 호출되며, 실패 시 error 객체를 전달받습니다. 현재 코드는 실패 여부와 관계없이 항상 웹 브라우저를 열게 되어, 카카오톡 앱이 정상적으로 열린 후에도 불필요하게 웹페이지가 열리는 문제가 발생할 수 있습니다. errornull이 아닐 때만 fallback 로직(웹 브라우저로 열기)이 실행되도록 수정해야 합니다. 또한, 에러 로깅을 추가하여 디버깅을 용이하게 하는 것이 좋습니다.

            TalkApiClient.instance.chatChannel(context, channelPublicId) { error ->
                if (error != null) {
                    Timber.d(error, "카카오톡 채널 채팅 열기 실패")
                    val url = TalkApiClient.instance.chatChannelUrl(channelPublicId)
                    KakaoCustomTabsClient.openWithDefault(context, url)
                }
            }


EventLogger.screenView(ScreenId.EXTERNAL_INQUIRE)
}

binding.llMyReview.setOnClickListener {
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ glide = "4.15.1"
glide-compiler = "4.12.0"
compressor = "3.0.1"
coroutines = "1.7.3"
kakao-login = "2.8.6"
kakao-login = "2.23.0"
kakao-talk = "2.23.0"
hilt = "2.50"
androidxHilt = "1.2.0"
play-services-base = "18.0.1"
Expand Down Expand Up @@ -148,6 +149,7 @@ transport-runtime = { group = "com.google.android.datatransport", name = "transp
junit = { group = "junit", name = "junit", version.ref = "junit" }
compressor = { group = "id.zelory", name = "compressor", version.ref = "compressor" }
kakao-login = { group = "com.kakao.sdk", name = "v2-user", version.ref = "kakao-login" }
kakao-talk = { group = "com.kakao.sdk", name = "v2-talk", version.ref = "kakao-talk" }
timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "timber" }
oss-licenses = { group = "com.google.android.gms", name = "play-services-oss-licenses", version.ref = "ossLicenses" }
oss-licenses-plugin = { group = "com.google.android.gms", name = "oss-licenses-plugin", version.ref = "ossLicensesPlugin" }
Expand Down