diff --git a/app/src/main/java/com/wafflestudio/snutt2/ui/state/SocialLoginType.kt b/app/src/main/java/com/wafflestudio/snutt2/ui/state/SocialLoginType.kt
index bfd2cbde1..d2d5df88f 100644
--- a/app/src/main/java/com/wafflestudio/snutt2/ui/state/SocialLoginType.kt
+++ b/app/src/main/java/com/wafflestudio/snutt2/ui/state/SocialLoginType.kt
@@ -5,3 +5,11 @@ enum class SocialLoginType {
KAKAO,
GOOGLE,
}
+
+fun SocialLoginType.getString(): String {
+ return when (this) {
+ SocialLoginType.FACEBOOK -> "페이스북"
+ SocialLoginType.GOOGLE -> "구글"
+ SocialLoginType.KAKAO -> "카카오"
+ }
+}
diff --git a/app/src/main/java/com/wafflestudio/snutt2/views/logged_in/home/settings/SocialLinkPage.kt b/app/src/main/java/com/wafflestudio/snutt2/views/logged_in/home/settings/SocialLinkPage.kt
index e6094c131..00ee6c513 100644
--- a/app/src/main/java/com/wafflestudio/snutt2/views/logged_in/home/settings/SocialLinkPage.kt
+++ b/app/src/main/java/com/wafflestudio/snutt2/views/logged_in/home/settings/SocialLinkPage.kt
@@ -80,11 +80,11 @@ fun SocialLinkPage() {
is SocialLoginState.Initial -> {}
is SocialLoginState.InProgress -> {}
is SocialLoginState.Cancelled -> {
- context.toast(context.getString(R.string.sign_in_facebook_failed_cancelled))
+ //context.toast(context.getString(R.string.sign_in_facebook_failed_cancelled))
socialLinkViewModel.updateFacebookLoginState(SocialLoginState.Initial)
}
is SocialLoginState.Failed -> {
- context.toast(context.getString(R.string.sign_in_facebook_failed_unknown))
+ //context.toast(context.getString(R.string.sign_in_facebook_failed_unknown))
socialLinkViewModel.updateFacebookLoginState(SocialLoginState.Initial)
}
is SocialLoginState.Success -> {
diff --git a/app/src/main/java/com/wafflestudio/snutt2/views/logged_out/TutorialPage.kt b/app/src/main/java/com/wafflestudio/snutt2/views/logged_out/TutorialPage.kt
index 5f0d5314d..9519d1d8b 100644
--- a/app/src/main/java/com/wafflestudio/snutt2/views/logged_out/TutorialPage.kt
+++ b/app/src/main/java/com/wafflestudio/snutt2/views/logged_out/TutorialPage.kt
@@ -34,6 +34,7 @@ import com.wafflestudio.snutt2.ui.SNUTTColors
import com.wafflestudio.snutt2.ui.SNUTTTypography
import com.wafflestudio.snutt2.ui.state.SocialLoginState
import com.wafflestudio.snutt2.ui.state.SocialLoginType
+import com.wafflestudio.snutt2.ui.state.getString
import com.wafflestudio.snutt2.views.*
import com.wafflestudio.snutt2.views.logged_in.home.HomeViewModel
import com.wafflestudio.snutt2.views.logged_in.home.settings.SocialLinkViewModel
@@ -97,67 +98,34 @@ fun TutorialPage() {
}
}
- LaunchedEffect(kakaoLoginState) {
- when (kakaoLoginState) {
+ val socialLoginStateEffect: (SocialLoginType, SocialLoginState) -> Unit = { type, state ->
+ when (state) {
is SocialLoginState.Initial -> {}
is SocialLoginState.InProgress -> {}
is SocialLoginState.Cancelled -> {
- context.toast(context.getString(R.string.sign_in_kakao_failed_cancelled))
- socialLinkViewModel.updateKakaoLoginState(SocialLoginState.Initial)
+ context.toast(context.getString(R.string.social_signin_failed_cancelled, type.getString()))
+ socialLinkViewModel.updateSocialLoginState(type, SocialLoginState.Initial)
}
is SocialLoginState.Failed -> {
- context.toast(context.getString(R.string.sign_in_kakao_failed_unknown))
- socialLinkViewModel.updateKakaoLoginState(SocialLoginState.Initial)
+ context.toast(context.getString(R.string.social_signin_kakao_failed_unknown, type.getString()))
+ socialLinkViewModel.updateSocialLoginState(type, SocialLoginState.Initial)
}
is SocialLoginState.Success -> {
- loginWithSocialAccessToken(
- SocialLoginType.KAKAO,
- (kakaoLoginState as SocialLoginState.Success).token
- )
+ loginWithSocialAccessToken(type, state.token)
}
}
}
- LaunchedEffect(googleLoginState) {
- when (googleLoginState) {
- is SocialLoginState.Initial -> {}
- is SocialLoginState.InProgress -> {}
- is SocialLoginState.Cancelled -> {
- context.toast(context.getString(R.string.sign_in_sign_in_google_cancelled))
- socialLinkViewModel.updateGoogleLoginState(SocialLoginState.Initial)
- }
- is SocialLoginState.Failed -> {
- context.toast(context.getString(R.string.sign_in_sign_in_google_failed_unknown))
- socialLinkViewModel.updateGoogleLoginState(SocialLoginState.Initial)
- }
- is SocialLoginState.Success -> {
- loginWithSocialAccessToken(
- SocialLoginType.GOOGLE,
- (googleLoginState as SocialLoginState.Success).token
- )
- }
- }
+ LaunchedEffect(facebookLoginState) {
+ socialLoginStateEffect(SocialLoginType.FACEBOOK, facebookLoginState)
}
- LaunchedEffect(facebookLoginState) {
- when (facebookLoginState) {
- is SocialLoginState.Initial -> {}
- is SocialLoginState.InProgress -> {}
- is SocialLoginState.Cancelled -> {
- context.toast(context.getString(R.string.sign_in_facebook_failed_cancelled))
- socialLinkViewModel.updateFacebookLoginState(SocialLoginState.Initial)
- }
- is SocialLoginState.Failed -> {
- context.toast(context.getString(R.string.sign_in_facebook_failed_unknown))
- socialLinkViewModel.updateFacebookLoginState(SocialLoginState.Initial)
- }
- is SocialLoginState.Success -> {
- loginWithSocialAccessToken(
- SocialLoginType.FACEBOOK,
- (facebookLoginState as SocialLoginState.Success).token
- )
- }
- }
+ LaunchedEffect(kakaoLoginState) {
+ socialLoginStateEffect(SocialLoginType.KAKAO, kakaoLoginState)
+ }
+
+ LaunchedEffect(googleLoginState) {
+ socialLoginStateEffect(SocialLoginType.GOOGLE, googleLoginState)
}
Column(
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e57f4ea65..282479c30 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -87,8 +87,6 @@
SNS 계정으로 계속하기
페이스북으로 시작하기
구글 계정으로 시작하기
- 구글 로그인이 취소되었습니다.
- 구글 로그인에 실패했습니다. 잠시 후 다시 시도해 주세요.
SNS 계정 연동 및 해제
이미 사용 중인 이메일입니다.\n%s 계정으로 시도해 보세요.
카카오 계정 연동
@@ -97,10 +95,8 @@
카카오 계정 연동 해제
구글 계정 연동 해제
페이스북 계정 연동 해제
- 카카오 로그인이 취소되었습니다.
- 카카오 로그인에 실패했습니다. 잠시 후 다시 시도해 주세요.
- 페이스북 로그인이 취소되었습니다.
- 페이스북 로그인에 실패했습니다. 잠시 후 다시 시도해 주세요.
+ %s 로그인이 취소되었습니다.
+ %s 로그인에 실패했습니다. 잠시 후 다시 시도해 주세요.
오픈소스 라이선스