Skip to content

Commit

Permalink
fix: added different resources for sign up
Browse files Browse the repository at this point in the history
  • Loading branch information
k1rill committed Feb 12, 2024
1 parent 00eca54 commit 76318e3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
)
}
}
Expand All @@ -126,6 +139,6 @@ internal fun SocialAuthView(
@Composable
private fun SocialAuthViewPreview() {
OpenEdXTheme {
SocialAuthView {}
SocialAuthView() {}
}
}
3 changes: 3 additions & 0 deletions auth/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<string name="auth_google" tools:ignore="ExtraTranslation">Sign in with Google</string>
<string name="auth_facebook" tools:ignore="ExtraTranslation">Sign in with Facebook</string>
<string name="auth_microsoft" tools:ignore="ExtraTranslation">Sign in with Microsoft</string>
<string name="auth_continue_google" tools:ignore="ExtraTranslation">Continue with Google</string>
<string name="auth_continue_facebook" tools:ignore="ExtraTranslation">Continue with Facebook</string>
<string name="auth_continue_microsoft" tools:ignore="ExtraTranslation">Continue with Microsoft</string>
<string name="auth_social_signed_title" translatable="false">You\'ve successfully signed in with %s.</string>
<string name="auth_social_signed_desc" translatable="false">We just need a little more information before you start learning with %s.</string>
</resources>
2 changes: 1 addition & 1 deletion core/src/main/java/org/openedx/core/ui/ComposeCommon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 76318e3

Please sign in to comment.