MoreDialogFragment: Better null-safety and localization for account header

In case AuthData has expired and user is inside Aurora Store, MoreDialogFragment
will keep crashing while trying to load account name and email.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-12-31 18:04:30 +07:00
parent e36e3341f7
commit 9693a597c8
2 changed files with 7 additions and 4 deletions

View File

@@ -261,9 +261,10 @@ class MoreDialogFragment : DialogFragment() {
) {
Text(
text = if (authProvider.isAnonymous) {
"Anonymous"
stringResource(R.string.account_anonymous)
} else {
authProvider.authData!!.userProfile!!.name
authProvider.authData?.userProfile?.name
?: stringResource(R.string.status_unavailable)
},
fontWeight = FontWeight.Normal,
color = onBackgroundColor,
@@ -273,9 +274,10 @@ class MoreDialogFragment : DialogFragment() {
)
Text(
text = if (authProvider.isAnonymous) {
"anonymous@gmail.com"
stringResource(R.string.account_anonymous_email)
} else {
authProvider.authData!!.userProfile!!.email
authProvider.authData?.userProfile?.email
?: stringResource(R.string.status_unavailable)
},
fontWeight = FontWeight.Light,
color = onBackgroundColor,

View File

@@ -413,6 +413,7 @@
<!-- MoreDialogFragment -->
<string name="title_more">More</string>
<string name="manage_account">Manage your account</string>
<string name="account_anonymous_email" translatable="false">anonymous@gmail.com</string>
<!-- InstallationPreference -->
<string name="pref_clear_device_owner_title">Clear device owner</string>