diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContent.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContent.kt index aa1553f03d2..80b2f426062 100644 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContent.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContent.kt @@ -14,6 +14,7 @@ import app.k9mail.core.ui.compose.theme2.MainTheme import app.k9mail.feature.account.oauth.R import app.k9mail.feature.account.oauth.ui.AccountOAuthContract.Event import app.k9mail.feature.account.oauth.ui.AccountOAuthContract.State +import app.k9mail.feature.account.oauth.ui.view.GoogleSignInSupportText import app.k9mail.feature.account.oauth.ui.view.SignInView @Composable @@ -36,11 +37,17 @@ internal fun AccountOAuthContent( message = stringResource(id = R.string.account_oauth_loading_message), ) } else if (state.error != null) { - ErrorView( - title = stringResource(id = R.string.account_oauth_loading_error), - message = state.error.toResourceString(resources), - onRetry = { onEvent(Event.OnRetryClicked) }, - ) + Column { + ErrorView( + title = stringResource(id = R.string.account_oauth_loading_error), + message = state.error.toResourceString(resources), + onRetry = { onEvent(Event.OnRetryClicked) }, + ) + + if (state.isGoogleSignIn) { + GoogleSignInSupportText() + } + } } else { SignInView( onSignInClick = { onEvent(Event.SignInClicked) }, diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/GoogleSignInSupportText.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/GoogleSignInSupportText.kt new file mode 100644 index 00000000000..5311e8fd8dc --- /dev/null +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/GoogleSignInSupportText.kt @@ -0,0 +1,41 @@ +package app.k9mail.feature.account.oauth.ui.view + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.LinkAnnotation +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.text.withLink +import androidx.compose.ui.text.withStyle +import app.k9mail.core.ui.compose.common.resources.annotatedStringResource +import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodySmall +import app.k9mail.core.ui.compose.theme2.MainTheme +import app.k9mail.feature.account.oauth.R + +private const val GOOGLE_OAUTH_SUPPORT_PAGE = "https://support.thunderbird.net/kb/gmail-thunderbird-android" + +@Composable +internal fun GoogleSignInSupportText() { + val extraText = annotatedStringResource( + id = R.string.account_oauth_google_sign_in_support_text, + argument = buildAnnotatedString { + withStyle( + style = SpanStyle( + color = MainTheme.colors.primary, + textDecoration = TextDecoration.Underline, + ), + ) { + withLink(LinkAnnotation.Url(GOOGLE_OAUTH_SUPPORT_PAGE)) { + append(stringResource(R.string.account_oauth_google_sign_in_support_text_link_text)) + } + } + }, + ) + + TextBodySmall( + text = extraText, + textAlign = TextAlign.Center, + ) +} diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/SignInView.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/SignInView.kt index f039a5da96c..fb271c92d0c 100644 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/SignInView.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/SignInView.kt @@ -34,6 +34,8 @@ internal fun SignInView( onClick = onSignInClick, enabled = isEnabled, ) + + GoogleSignInSupportText() } else { ButtonFilled( text = stringResource(id = R.string.account_oauth_sign_in_button), diff --git a/feature/account/oauth/src/main/res/values/strings.xml b/feature/account/oauth/src/main/res/values/strings.xml index 533223b5b81..b097b0c111a 100644 --- a/feature/account/oauth/src/main/res/values/strings.xml +++ b/feature/account/oauth/src/main/res/values/strings.xml @@ -11,4 +11,8 @@ OAuth 2.0 is currently not supported with this provider. The app couldn\'t find a browser to use for granting access to your account. + + "If you're experiencing problems when signing in with Google, please consult our {placeHolder}." + + support article