Skip to content

Commit dc86067

Browse files
authored
Merge pull request #8620 from cketti/google-sign-in-additional-error-text
Display link to support page when signing in with Google
2 parents 345ec36 + d469c87 commit dc86067

File tree

4 files changed

+59
-5
lines changed

4 files changed

+59
-5
lines changed

feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContent.kt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import app.k9mail.core.ui.compose.theme2.MainTheme
1414
import app.k9mail.feature.account.oauth.R
1515
import app.k9mail.feature.account.oauth.ui.AccountOAuthContract.Event
1616
import app.k9mail.feature.account.oauth.ui.AccountOAuthContract.State
17+
import app.k9mail.feature.account.oauth.ui.view.GoogleSignInSupportText
1718
import app.k9mail.feature.account.oauth.ui.view.SignInView
1819

1920
@Composable
@@ -36,11 +37,17 @@ internal fun AccountOAuthContent(
3637
message = stringResource(id = R.string.account_oauth_loading_message),
3738
)
3839
} else if (state.error != null) {
39-
ErrorView(
40-
title = stringResource(id = R.string.account_oauth_loading_error),
41-
message = state.error.toResourceString(resources),
42-
onRetry = { onEvent(Event.OnRetryClicked) },
43-
)
40+
Column {
41+
ErrorView(
42+
title = stringResource(id = R.string.account_oauth_loading_error),
43+
message = state.error.toResourceString(resources),
44+
onRetry = { onEvent(Event.OnRetryClicked) },
45+
)
46+
47+
if (state.isGoogleSignIn) {
48+
GoogleSignInSupportText()
49+
}
50+
}
4451
} else {
4552
SignInView(
4653
onSignInClick = { onEvent(Event.SignInClicked) },
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package app.k9mail.feature.account.oauth.ui.view
2+
3+
import androidx.compose.runtime.Composable
4+
import androidx.compose.ui.res.stringResource
5+
import androidx.compose.ui.text.LinkAnnotation
6+
import androidx.compose.ui.text.SpanStyle
7+
import androidx.compose.ui.text.buildAnnotatedString
8+
import androidx.compose.ui.text.style.TextAlign
9+
import androidx.compose.ui.text.style.TextDecoration
10+
import androidx.compose.ui.text.withLink
11+
import androidx.compose.ui.text.withStyle
12+
import app.k9mail.core.ui.compose.common.resources.annotatedStringResource
13+
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodySmall
14+
import app.k9mail.core.ui.compose.theme2.MainTheme
15+
import app.k9mail.feature.account.oauth.R
16+
17+
private const val GOOGLE_OAUTH_SUPPORT_PAGE = "https://support.thunderbird.net/kb/gmail-thunderbird-android"
18+
19+
@Composable
20+
internal fun GoogleSignInSupportText() {
21+
val extraText = annotatedStringResource(
22+
id = R.string.account_oauth_google_sign_in_support_text,
23+
argument = buildAnnotatedString {
24+
withStyle(
25+
style = SpanStyle(
26+
color = MainTheme.colors.primary,
27+
textDecoration = TextDecoration.Underline,
28+
),
29+
) {
30+
withLink(LinkAnnotation.Url(GOOGLE_OAUTH_SUPPORT_PAGE)) {
31+
append(stringResource(R.string.account_oauth_google_sign_in_support_text_link_text))
32+
}
33+
}
34+
},
35+
)
36+
37+
TextBodySmall(
38+
text = extraText,
39+
textAlign = TextAlign.Center,
40+
)
41+
}

feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/SignInView.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ internal fun SignInView(
3434
onClick = onSignInClick,
3535
enabled = isEnabled,
3636
)
37+
38+
GoogleSignInSupportText()
3739
} else {
3840
ButtonFilled(
3941
text = stringResource(id = R.string.account_oauth_sign_in_button),

feature/account/oauth/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@
1111
<string name="account_oauth_error_not_supported">OAuth 2.0 is currently not supported with this provider.</string>
1212
<string name="account_oauth_error_browser_not_available">The app couldn\'t find a browser to use for granting access to your account.</string>
1313

14+
<!-- This is displayed below the "Sign in with Google" button. {placeHolder} will be replaced with the text from account_oauth_google_sign_in_support_text_link_text. -->
15+
<string name="account_oauth_google_sign_in_support_text">"If you're experiencing problems when signing in with Google, please consult our {placeHolder}."</string>
16+
<!-- The {placeHolder} in account_oauth_google_sign_in_support_text will be replaced by this text (that, in the user interface, will be a link to the support article). -->
17+
<string name="account_oauth_google_sign_in_support_text_link_text">support article</string>
1418
</resources>

0 commit comments

Comments
 (0)