Merge pull request #6633 from element-hq/feature/bma/deactivateStrings
Update wording of deactivate account screen
This commit is contained in:
commit
f3dd7b86d8
30 changed files with 144 additions and 48 deletions
|
|
@ -135,7 +135,7 @@ private fun ColumnScope.Buttons(
|
|||
) {
|
||||
val logoutAction = state.accountDeactivationAction
|
||||
Button(
|
||||
text = stringResource(CommonStrings.action_deactivate),
|
||||
text = stringResource(CommonStrings.action_delete),
|
||||
showProgress = logoutAction is AsyncAction.Loading,
|
||||
destructive = true,
|
||||
enabled = state.submitEnabled,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ fun AccountDeactivationConfirmationDialog(
|
|||
ConfirmationDialog(
|
||||
title = stringResource(id = R.string.screen_deactivate_account_title),
|
||||
content = stringResource(R.string.screen_deactivate_account_confirmation_dialog_content),
|
||||
submitText = stringResource(id = CommonStrings.action_deactivate),
|
||||
submitText = stringResource(id = CommonStrings.action_delete),
|
||||
onSubmitClick = onSubmitClick,
|
||||
onDismiss = onDismiss,
|
||||
destructiveSubmit = true,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="screen_deactivate_account_confirmation_dialog_content">"Please confirm that you want to deactivate your account. This action cannot be undone."</string>
|
||||
<string name="screen_deactivate_account_confirmation_dialog_content">"Please confirm that you want to delete your account. This action cannot be undone."</string>
|
||||
<string name="screen_deactivate_account_delete_all_messages">"Delete all my messages"</string>
|
||||
<string name="screen_deactivate_account_delete_all_messages_notice">"Warning: Future users may see incomplete conversations."</string>
|
||||
<string name="screen_deactivate_account_description">"Deactivating your account is %1$s, it will:"</string>
|
||||
<string name="screen_deactivate_account_description">"Deleting your account is %1$s, it will:"</string>
|
||||
<string name="screen_deactivate_account_description_bold_part">"irreversible"</string>
|
||||
<string name="screen_deactivate_account_list_item_1">"%1$s your account (you can\'t log back in, and your ID can\'t be reused)."</string>
|
||||
<string name="screen_deactivate_account_list_item_1_bold_part">"Permanently disable"</string>
|
||||
<string name="screen_deactivate_account_list_item_2">"Remove you from all chat rooms."</string>
|
||||
<string name="screen_deactivate_account_list_item_3">"Delete your account information from our identity server."</string>
|
||||
<string name="screen_deactivate_account_list_item_4">"Your messages will still be visible to registered users but won’t be available to new or unregistered users if you choose to delete them."</string>
|
||||
<string name="screen_deactivate_account_title">"Deactivate account"</string>
|
||||
<string name="screen_deactivate_account_title">"Delete account"</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class AccountDeactivationViewTest {
|
|||
eventSink = eventsRecorder,
|
||||
),
|
||||
)
|
||||
rule.clickOn(CommonStrings.action_deactivate)
|
||||
rule.clickOn(CommonStrings.action_delete)
|
||||
eventsRecorder.assertSingle(AccountDeactivationEvents.DeactivateAccount(false))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ dependencies {
|
|||
implementation(projects.libraries.matrixui)
|
||||
implementation(projects.libraries.designsystem)
|
||||
implementation(projects.libraries.uiStrings)
|
||||
implementation(projects.libraries.uiUtils)
|
||||
implementation(projects.libraries.androidutils)
|
||||
implementation(projects.libraries.usersearch.api)
|
||||
implementation(libs.coil.compose)
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ import io.element.android.libraries.matrix.ui.components.SelectedUsersRowList
|
|||
import io.element.android.libraries.matrix.ui.model.getAvatarData
|
||||
import io.element.android.libraries.matrix.ui.model.getBestName
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import io.element.android.libraries.ui.utils.strings.simplePluralStringResource
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
@Composable
|
||||
|
|
@ -263,16 +264,16 @@ private fun InvitePeopleConfirmModal(
|
|||
dragHandle = null,
|
||||
) {
|
||||
IconTitleSubtitleMolecule(
|
||||
title = if (users.size > 1) {
|
||||
stringResource(R.string.screen_invite_users_confirm_dialog_title_mutiple_users)
|
||||
} else {
|
||||
stringResource(R.string.screen_invite_users_confirm_dialog_title_one_user)
|
||||
},
|
||||
subTitle = if (users.size > 1) {
|
||||
stringResource(R.string.screen_invite_users_confirm_dialog_subtitle_multiple_users)
|
||||
} else {
|
||||
stringResource(R.string.screen_invite_users_confirm_dialog_subtitle_one_user)
|
||||
},
|
||||
title = simplePluralStringResource(
|
||||
resIdForOne = R.string.screen_invite_users_confirm_dialog_title_one_user,
|
||||
resIdForOthers = R.string.screen_invite_users_confirm_dialog_title_mutiple_users,
|
||||
count = users.size,
|
||||
),
|
||||
subTitle = simplePluralStringResource(
|
||||
resIdForOne = R.string.screen_invite_users_confirm_dialog_subtitle_one_user,
|
||||
resIdForOthers = R.string.screen_invite_users_confirm_dialog_subtitle_multiple_users,
|
||||
count = users.size,
|
||||
),
|
||||
iconStyle = BigIcon.Style.Default(CompoundIcons.UserAddSolid()),
|
||||
modifier = Modifier.padding(
|
||||
top = 32.dp,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
<string name="screen_change_server_subtitle">"What is the address of your server?"</string>
|
||||
<string name="screen_change_server_title">"Select your server"</string>
|
||||
<string name="screen_create_account_title">"Create account"</string>
|
||||
<string name="screen_login_error_deactivated_account">"This account has been deactivated."</string>
|
||||
<string name="screen_login_error_deactivated_account">"This account has been deleted."</string>
|
||||
<string name="screen_login_error_invalid_credentials">"Incorrect username and/or password"</string>
|
||||
<string name="screen_login_error_invalid_user_id">"This is not a valid user identifier. Expected format: ‘@user:homeserver.org’"</string>
|
||||
<string name="screen_login_error_refresh_tokens">"This server is configured to use refresh tokens. These aren\'t supported when using password based login."</string>
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ private fun ColumnScope.GeneralSection(
|
|||
)
|
||||
if (state.canDeactivateAccount) {
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.action_deactivate_account)) },
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.action_delete_account)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Delete())),
|
||||
style = ListItemStyle.Destructive,
|
||||
onClick = onDeactivateClick,
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ class PreferencesRootViewTest {
|
|||
),
|
||||
onDeactivateClick = callback,
|
||||
)
|
||||
rule.clickOn(CommonStrings.action_deactivate_account)
|
||||
rule.clickOn(CommonStrings.action_delete_account)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -420,7 +420,7 @@ class PreferencesRootViewTest {
|
|||
eventSink = eventsRecorder,
|
||||
),
|
||||
)
|
||||
rule.onNodeWithText(rule.activity.getString(CommonStrings.action_deactivate_account)).assertDoesNotExist()
|
||||
rule.onNodeWithText(rule.activity.getString(CommonStrings.action_delete_account)).assertDoesNotExist()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -27,4 +27,9 @@ class PreviewStringProvider(
|
|||
override fun getQuantityString(@PluralsRes resId: Int, quantity: Int, vararg formatArgs: Any?): String {
|
||||
return resources.getQuantityString(resId, quantity, *formatArgs)
|
||||
}
|
||||
|
||||
override fun getSimpleQuantityString(resIdForOne: Int, resIdForOthers: Int, quantity: Int, vararg formatArgs: Any?): String {
|
||||
val resId = if (quantity == 1) resIdForOne else resIdForOthers
|
||||
return resources.getString(resId, *formatArgs)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@
|
|||
<string name="action_deactivate_account">"Deactivate account"</string>
|
||||
<string name="action_decline">"Decline"</string>
|
||||
<string name="action_decline_and_block">"Decline and block"</string>
|
||||
<string name="action_delete">"Delete"</string>
|
||||
<string name="action_delete_account">"Delete account"</string>
|
||||
<string name="action_delete_poll">"Delete Poll"</string>
|
||||
<string name="action_deselect_all">"Deselect all"</string>
|
||||
<string name="action_disable">"Disable"</string>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.ui.utils.strings
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
|
||||
/**
|
||||
* Similar to [androidx.compose.ui.res.pluralStringResource] but with separate resource ids for singular and plural values.
|
||||
* Useful when we want to use different strings for singular and plural forms but not mentioning the actual quantity in the string.
|
||||
* In this case, we cannot use getQuantityString, because some locales have more than two plural forms, and require the quantity to
|
||||
* be part of the resulting strings.
|
||||
* @param resIdForOne Resource id for the case when [count] is 1.
|
||||
* @param resIdForOthers Resource id for the other cases ([count] is not 1).
|
||||
* @param count The quantity to determine whether to use singular or plural form. Must be greater than or equal to 1.
|
||||
* @param formatArgs The format arguments that will be used for substitution in the resulting string. Will be applied to either
|
||||
* the singular or plural string depending on the quantity.
|
||||
* @return The localized string corresponding to the given quantity.
|
||||
*/
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun simplePluralStringResource(
|
||||
@StringRes resIdForOne: Int,
|
||||
@StringRes resIdForOthers: Int,
|
||||
count: Int,
|
||||
vararg formatArgs: Any,
|
||||
): String {
|
||||
val resId = if (count == 1) resIdForOne else resIdForOthers
|
||||
return stringResource(resId, *formatArgs)
|
||||
}
|
||||
|
|
@ -34,5 +34,30 @@ interface StringProvider {
|
|||
* stripped of styled text information.
|
||||
*/
|
||||
fun getString(@StringRes resId: Int, vararg formatArgs: Any?): String
|
||||
|
||||
/**
|
||||
* Returns a localized formatted string from the application's package's
|
||||
* default string table, substituting the format arguments as defined in
|
||||
* [java.util.Formatter] and [java.lang.String.format], based on the given quantity.
|
||||
*/
|
||||
fun getQuantityString(@PluralsRes resId: Int, quantity: Int, vararg formatArgs: Any?): String
|
||||
|
||||
/**
|
||||
* Similar to [getQuantityString] but with separate resource ids for singular and plural values.
|
||||
* Useful when we want to use different strings for singular and plural forms but not mentioning the actual quantity in the string.
|
||||
* In this case, we cannot use getQuantityString, because some locales have more than two plural forms, and require the quantity to
|
||||
* be part of the resulting strings.
|
||||
* @param resIdForOne Resource id for the case when [quantity] is 1.
|
||||
* @param resIdForOthers Resource id for the other cases ([quantity] is not 1).
|
||||
* @param quantity The quantity to determine whether to use singular or plural form. Must be greater than or equal to 1.
|
||||
* @param formatArgs The format arguments that will be used for substitution in the resulting string. Will be applied to either
|
||||
* the singular or plural string depending on the quantity.
|
||||
* @return The localized string corresponding to the given quantity.
|
||||
*/
|
||||
fun getSimpleQuantityString(
|
||||
@StringRes resIdForOne: Int,
|
||||
@StringRes resIdForOthers: Int,
|
||||
quantity: Int,
|
||||
vararg formatArgs: Any?,
|
||||
): String
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,4 +28,14 @@ class AndroidStringProvider(private val resources: Resources) : StringProvider {
|
|||
override fun getQuantityString(@PluralsRes resId: Int, quantity: Int, vararg formatArgs: Any?): String {
|
||||
return resources.getQuantityString(resId, quantity, *formatArgs)
|
||||
}
|
||||
|
||||
override fun getSimpleQuantityString(
|
||||
resIdForOne: Int,
|
||||
resIdForOthers: Int,
|
||||
quantity: Int,
|
||||
vararg formatArgs: Any?,
|
||||
): String {
|
||||
val resId = if (quantity == 1) resIdForOne else resIdForOthers
|
||||
return resources.getString(resId, *formatArgs)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,4 +28,14 @@ class FakeStringProvider(
|
|||
lastResIdParam = resId
|
||||
return defaultResult + " ($quantity) " + formatArgs.joinToString()
|
||||
}
|
||||
|
||||
override fun getSimpleQuantityString(
|
||||
resIdForOne: Int,
|
||||
resIdForOthers: Int,
|
||||
quantity: Int,
|
||||
vararg formatArgs: Any?,
|
||||
): String {
|
||||
lastResIdParam = if (quantity == 1) resIdForOne else resIdForOthers
|
||||
return defaultResult + " ($quantity) " + formatArgs.joinToString()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,9 @@ class InstrumentationStringProvider : StringProvider {
|
|||
override fun getQuantityString(resId: Int, quantity: Int, vararg formatArgs: Any?): String {
|
||||
return resource.getQuantityString(resId, quantity, *formatArgs)
|
||||
}
|
||||
|
||||
override fun getSimpleQuantityString(resIdForOne: Int, resIdForOthers: Int, quantity: Int, vararg formatArgs: Any?): String {
|
||||
val resId = if (quantity == 1) resIdForOne else resIdForOthers
|
||||
return resource.getString(resId, *formatArgs)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e186c2798642148ef8e1f02a23600a594378ca094f6e11adc46c74ef421e8a8b
|
||||
size 77187
|
||||
oid sha256:891555a0886151040ebc4b9e3e4d25c3b2dbcd5af000a10236e292dd2f43c09c
|
||||
size 75570
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4ca225207ee507d079b91b41a2335ad021eba3dc5d84744fd6c131cfd4b0951c
|
||||
size 75708
|
||||
oid sha256:7ef0f01ee15b681536a4f6f29cf6a7d1c5907f9e072cf3aa9bba122848a7507a
|
||||
size 74085
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4b70a67dc7317be9e3c14d05d5c83efb09bbef086e8e77ef9d8e243f8cf3e359
|
||||
size 61058
|
||||
oid sha256:3d6dfb5695cfd24ae8207d66d5fee7695c1b12e1e9310a2ce92f07447f567225
|
||||
size 57192
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4fd997ceab36234f4c66871bdf8809caaef106b2108b24718441e8af61a70e8c
|
||||
size 55414
|
||||
oid sha256:2b551591af19b7ff970159df80ac752961d63fbd468217cf935ec39e6dc4f5bb
|
||||
size 54146
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a0a2a4ab19d5f32e5945d55d7eae9d8db198e7f5951051d35ee703e60f63b679
|
||||
size 52432
|
||||
oid sha256:cd5b298306dc0d435067bb5f9b4e49a8f9d467e108d8715250540b80aea17c08
|
||||
size 51156
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a4ce88cb56905fcdcdb511fe54edd4f0f8bb579e6de9a7bfcce5629937b192d0
|
||||
size 75027
|
||||
oid sha256:546b6f6a18dd79a8baac9907bc8c3a19727b6bbf28db3f379873a56f7c960d8a
|
||||
size 73549
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:45b95831771832d69d8e5b8dbb1224fa66f3790f6d8beb546f57087db0600906
|
||||
size 73382
|
||||
oid sha256:19b2715dfeeee653d97a98f7b12741ae289fd7864e4ccb1fe17e9c02dc3fc826
|
||||
size 71941
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:87154a19bb45a01d125c6bf4a1e6a9f0a35842989cdaca07387956fa372b9357
|
||||
size 57952
|
||||
oid sha256:ccaa46d8df1a2ab720a50a081cdfe159e9bb28a37c66ffd48340ac45f241a3af
|
||||
size 54033
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f1c45208ce974f2c8bf8fdb45653b2a1e604d646d1d5f4ae302b3e8739dbfa59
|
||||
size 52893
|
||||
oid sha256:8e72138fef757a0b4877b8caf199163dc091fb2539a7aab9dadc9e1cd9e762d0
|
||||
size 51684
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:83822e71afc34ccfe3c9c2aec30f480cfc01eb51e92db21216d457be00de24c0
|
||||
size 49460
|
||||
oid sha256:9fc8e670655f4981a9a01d8ea60391eb5362c130717cf1c88044d8833e6ad06c
|
||||
size 48249
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:da32161bd9a1fa8173d3f9713cab610500e5de95a369b3b57e0267db243b4705
|
||||
size 25418
|
||||
oid sha256:be4cbe72c73d76252f902e122bd62ba51ff89cf2cb20ddd61ed6615e983c65cf
|
||||
size 25153
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:821a13ed4effd98ad459e3697a33d9d42500d7f1f46115a97c9b7444303a3bb2
|
||||
size 27645
|
||||
oid sha256:76caf93913c979f3327dec4331d3a5bea5027df45c5cacf55a786b8f677e3162
|
||||
size 27340
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2dd256cb0782cc6ebbc3e432646b2d3abe92a72886311b4010b38d389703b939
|
||||
size 26329
|
||||
oid sha256:8d3a7ae9522da2911bf256273a4972020fc1677f026fbb9f17d27f549ab03ea3
|
||||
size 25978
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e6c20d715bfa287ca0fa78bab1166ff0370b5124455c87f1956e7dc3cb9b3d36
|
||||
size 28253
|
||||
oid sha256:a4f8571893bf9292a7d298c7419ea2e3f0363e1c2eca8c5f6aaea7d39143039c
|
||||
size 27855
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue