From 76318e39e4fff0d207c092bc5c504418df4b7e5e Mon Sep 17 00:00:00 2001 From: k1rill Date: Mon, 12 Feb 2024 10:09:26 +0300 Subject: [PATCH] fix: added different resources for sign up --- .../auth/presentation/ui/SocialAuthView.kt | 25 ++++++++++++++----- auth/src/main/res/values/strings.xml | 3 +++ .../java/org/openedx/core/ui/ComposeCommon.kt | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/auth/src/main/java/org/openedx/auth/presentation/ui/SocialAuthView.kt b/auth/src/main/java/org/openedx/auth/presentation/ui/SocialAuthView.kt index b821e5709..c9d73662b 100644 --- a/auth/src/main/java/org/openedx/auth/presentation/ui/SocialAuthView.kt +++ b/auth/src/main/java/org/openedx/auth/presentation/ui/SocialAuthView.kt @@ -35,6 +35,11 @@ internal fun SocialAuthView( ) { Column(modifier = modifier) { if (isGoogleAuthEnabled) { + val stringRes = if (isSignIn) { + R.string.auth_google + } else { + R.string.auth_continue_google + } OpenEdXOutlinedButton( modifier = Modifier .testTag("btn_google_auth") @@ -57,18 +62,22 @@ internal fun SocialAuthView( modifier = Modifier .testTag("txt_google_auth") .padding(start = 10.dp), - text = stringResource(id = R.string.auth_google) + text = stringResource(id = stringRes) ) } } } if (isFacebookAuthEnabled) { + val stringRes = if (isSignIn) { + R.string.auth_facebook + } else { + R.string.auth_continue_facebook + } OpenEdXButton( width = Modifier .testTag("btn_facebook_auth") .padding(top = 12.dp) .fillMaxWidth(), - text = stringResource(id = R.string.auth_facebook), backgroundColor = MaterialTheme.appColors.authFacebookButtonBackground, onClick = { onEvent(AuthType.FACEBOOK) @@ -85,18 +94,22 @@ internal fun SocialAuthView( .testTag("txt_facebook_auth") .padding(start = 10.dp), color = MaterialTheme.appColors.buttonText, - text = stringResource(id = R.string.auth_facebook) + text = stringResource(id = stringRes) ) } } } if (isMicrosoftAuthEnabled) { + val stringRes = if (isSignIn) { + R.string.auth_microsoft + } else { + R.string.auth_continue_microsoft + } OpenEdXButton( width = Modifier .testTag("btn_microsoft_auth") .padding(top = 12.dp) .fillMaxWidth(), - text = stringResource(id = R.string.auth_microsoft), backgroundColor = MaterialTheme.appColors.authMicrosoftButtonBackground, onClick = { onEvent(AuthType.MICROSOFT) @@ -113,7 +126,7 @@ internal fun SocialAuthView( .testTag("txt_microsoft_auth") .padding(start = 10.dp), color = MaterialTheme.appColors.buttonText, - text = stringResource(id = R.string.auth_microsoft) + text = stringResource(id = stringRes) ) } } @@ -126,6 +139,6 @@ internal fun SocialAuthView( @Composable private fun SocialAuthViewPreview() { OpenEdXTheme { - SocialAuthView {} + SocialAuthView() {} } } diff --git a/auth/src/main/res/values/strings.xml b/auth/src/main/res/values/strings.xml index 67f6f6a2b..85eb3a47f 100644 --- a/auth/src/main/res/values/strings.xml +++ b/auth/src/main/res/values/strings.xml @@ -28,6 +28,9 @@ Sign in with Google Sign in with Facebook Sign in with Microsoft + Continue with Google + Continue with Facebook + Continue with Microsoft You\'ve successfully signed in with %s. We just need a little more information before you start learning with %s. diff --git a/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt b/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt index 73a38d61d..80f61d75d 100644 --- a/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt +++ b/core/src/main/java/org/openedx/core/ui/ComposeCommon.kt @@ -1036,7 +1036,7 @@ fun OfflineModeDialog( @Composable fun OpenEdXButton( width: Modifier = Modifier.fillMaxWidth(), - text: String, + text: String = "", onClick: () -> Unit, enabled: Boolean = true, backgroundColor: Color = MaterialTheme.appColors.buttonBackground,