mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +00:00
Merge pull request #6633 from element-hq/feature/bma/deactivateStrings
Update wording of deactivate account screen
This commit is contained in:
+1
-1
@@ -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,
|
||||
|
||||
+1
-1
@@ -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>
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
+11
-10
@@ -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>
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+5
@@ -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>
|
||||
|
||||
+37
@@ -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)
|
||||
}
|
||||
+25
@@ -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
|
||||
}
|
||||
|
||||
+10
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:da32161bd9a1fa8173d3f9713cab610500e5de95a369b3b57e0267db243b4705
|
||||
size 25418
|
||||
oid sha256:be4cbe72c73d76252f902e122bd62ba51ff89cf2cb20ddd61ed6615e983c65cf
|
||||
size 25153
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:821a13ed4effd98ad459e3697a33d9d42500d7f1f46115a97c9b7444303a3bb2
|
||||
size 27645
|
||||
oid sha256:76caf93913c979f3327dec4331d3a5bea5027df45c5cacf55a786b8f677e3162
|
||||
size 27340
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2dd256cb0782cc6ebbc3e432646b2d3abe92a72886311b4010b38d389703b939
|
||||
size 26329
|
||||
oid sha256:8d3a7ae9522da2911bf256273a4972020fc1677f026fbb9f17d27f549ab03ea3
|
||||
size 25978
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e6c20d715bfa287ca0fa78bab1166ff0370b5124455c87f1956e7dc3cb9b3d36
|
||||
size 28253
|
||||
oid sha256:a4f8571893bf9292a7d298c7419ea2e3f0363e1c2eca8c5f6aaea7d39143039c
|
||||
size 27855
|
||||
|
||||
Reference in New Issue
Block a user