File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
app/src/main/java/com/paw/key/presentation/ui/login Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import androidx.compose.ui.Alignment
2727import androidx.compose.ui.Modifier
2828import androidx.compose.ui.graphics.Color
2929import androidx.compose.ui.graphics.vector.ImageVector
30+ import androidx.compose.ui.layout.ContentScale
3031import androidx.compose.ui.platform.LocalContext
3132import androidx.compose.ui.res.painterResource
3233import androidx.compose.ui.res.stringResource
@@ -143,12 +144,18 @@ fun LoginScreen(
143144 Image (
144145 painter = painterResource(R .drawable.img_login_sub),
145146 contentDescription = stringResource(R .string.ic_login_sub_image),
147+ contentScale = ContentScale .Crop ,
146148 )
147149
148150 LoginSocialButton (
149151 logo = R .drawable.ic_login_kakao,
150152 loginText = stringResource(R .string.ic_login_kakao),
151- onClick = {},
153+ onClick = {
154+ viewModel.onKakaoSignIn(
155+ context = context,
156+ onSuccess = navigateHome
157+ )
158+ },
152159 modifier = Modifier
153160 .background(
154161 shape = RoundedCornerShape (12 .dp),
Original file line number Diff line number Diff line change @@ -50,6 +50,28 @@ class LoginViewModel @Inject constructor(
5050 }
5151 }
5252
53+ fun onKakaoSignIn (
54+ context : Context ,
55+ onSuccess : () -> Unit ,
56+ ) {
57+ viewModelScope.launch {
58+ authRepository.signInWithKakao(context)
59+ .onSuccess { accessToken ->
60+ val deviceId = getDeviceId(context)
61+ authRepository.loginKakao(accessToken, deviceId)
62+ .onSuccess { response ->
63+ onSuccess()
64+ }
65+ .onFailure { e ->
66+ Timber .e(e, " Full stack trace:" )
67+ }
68+ }
69+ .onFailure { e ->
70+ Timber .e(" [KAKAO_VM] Step 2: SDK login FAILED" )
71+ }
72+ }
73+ }
74+
5375 private fun getDeviceId (context : Context ): String {
5476 return android.provider.Settings .Secure .getString(
5577 context.contentResolver,
You can’t perform that action at this time.
0 commit comments