Addressed many aspects of PR feedback + misc. strings issues

This commit is contained in:
alansley 2024-08-27 14:42:57 +10:00
parent 9cdbc4b80b
commit b52048a080
10 changed files with 91 additions and 109 deletions

View File

@ -2101,8 +2101,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
override fun banUser(messages: Set<MessageRecord>) {
showSessionDialog {
title(R.string.banUser)
// ACL TODO - We need a string for the below `text` element - have asked Lucy about this 2024/08/26 -AL
text("This will ban the selected user from this room. It won't ban them from other rooms.")
text(R.string.communityBanDescription)
button(R.string.banUser) { viewModel.banUser(messages.first().individualRecipient); endActionMode() }
cancelButton(::endActionMode)
}
@ -2111,8 +2110,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
override fun banAndDeleteAll(messages: Set<MessageRecord>) {
showSessionDialog {
title(R.string.banUser)
// ACL TODO - We need a string for the below `text` element - have asked Lucy about this 2024/08/26 -AL
text("This will ban the selected user from this room and delete all messages sent by them. It won't ban them from other rooms or delete the messages they sent there.")
text(R.string.communityBanDeleteDescription)
button(R.string.banUser) { viewModel.banAndDeleteAll(messages.first()); endActionMode() }
cancelButton(::endActionMode)
}

View File

@ -45,44 +45,6 @@ class SearchBottomBar : LinearLayout {
setViewEnabled(searchDown, position > 0)
}
/*
fun setData(position: Int, count: Int, query: String?) = with(binding) {
searchProgressWheel.visibility = GONE
searchUp.setOnClickListener { v: View? ->
if (eventListener != null) {
eventListener!!.onSearchMoveUpPressed()
}
}
searchDown.setOnClickListener { v: View? ->
if (eventListener != null) {
eventListener!!.onSearchMoveDownPressed()
}
}
// If we found search results list how many we found
if (count > 0) {
searchPosition.text = Phrase.from(context, R.string.searchMatches)
.put(COUNT_KEY, position + 1)
.put(TOTAL_COUNT_KEY, count)
.format()
} else {
// If there are no results we don't display anything if the query is
// empty, but we'll substitute "No results found for <query>" otherwise.
var txt = ""
if (query != null) {
if (query.isNotEmpty()) {
txt = Phrase.from(context, R.string.searchMatchesNoneSpecific)
.put(QUERY_KEY, query)
.format().toString()
}
}
searchPosition.text = txt
}
setViewEnabled(searchUp, position < count - 1)
setViewEnabled(searchDown, position > 0)
}
*/
fun showLoading() {
binding.searchProgressWheel.visibility = VISIBLE
}

View File

@ -45,10 +45,6 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu
.put(CONVERSATION_COUNT_KEY, threadCount)
.format().toString();
setSubText(txt);
// Note: `setContentInfo` details are only visible in Android API 24 and below - as our minimum is now API 26 this can be skipped.
//setContentInfo(String.valueOf(messageCount));
setNumber(messageCount);
}

View File

@ -131,21 +131,17 @@ internal fun LandingScreen(
MESSAGES.take(count),
key = { it.stringId }
) { item ->
// Perform string substitution in the bubbles that require it
if (item.stringId == R.string.onboardingBubbleWelcomeToSession ||
item.stringId == R.string.onboardingBubbleSessionIsEngineered) {
AnimateMessageText(
Phrase.from(stringResource(item.stringId))
.put(APP_NAME_KEY, stringResource(R.string.app_name))
.format().toString(),
item.isOutgoing
)
} else { // Non-substituted text bubbles
AnimateMessageText(
stringResource(item.stringId),
item.isOutgoing
)
// Perform string substitution only in the bubbles that require it
val bubbleTxt = if (item.stringId == R.string.onboardingBubbleWelcomeToSession ||
item.stringId == R.string.onboardingBubbleSessionIsEngineered) {
Phrase.from(stringResource(item.stringId)).put(APP_NAME_KEY, stringResource(R.string.app_name)).format().toString()
} else {
stringResource(item.stringId)
}
AnimateMessageText(
bubbleTxt,
item.isOutgoing
)
}
}

View File

@ -80,12 +80,13 @@ internal fun MessageNotificationsScreen(
// spacing between buttons is provided by ripple/downstate of NotificationRadioButton
val txt = Phrase.from(stringResource(R.string.onboardingMessageNotificationExplanation))
val explanationTxt = Phrase.from(stringResource(R.string.notificationsSlowModeDescription))
.put(APP_NAME_KEY, stringResource(R.string.app_name))
.format().toString()
NotificationRadioButton(
R.string.notificationsSlowMode,
R.string.notificationsSlowModeDescription,
stringResource(R.string.notificationsSlowMode),
explanationTxt,
modifier = Modifier.contentDescription(R.string.AccessibilityId_notificationsSlowMode),
checked = state.pushDisabled,
onClick = { setEnabled(false) }
@ -99,8 +100,8 @@ internal fun MessageNotificationsScreen(
@Composable
private fun NotificationRadioButton(
@StringRes title: Int,
@StringRes explanation: Int,
@StringRes titleId: Int,
@StringRes explanationId: Int,
modifier: Modifier = Modifier,
@StringRes tag: Int? = null,
checked: Boolean = false,
@ -124,28 +125,65 @@ private fun NotificationRadioButton(
Column(
modifier = Modifier.padding(horizontal = LocalDimensions.current.smallSpacing, vertical = LocalDimensions.current.xsSpacing)) {
Text(
stringResource(title),
stringResource(titleId),
style = LocalType.current.h8
)
// If this radio button is the one for slow mode notifications then substitute the app name..
if (explanation == R.string.notificationsSlowModeDescription) {
val txt = Phrase.from(stringResource(explanation))
.put(APP_NAME_KEY, stringResource(R.string.app_name))
.format().toString()
Text(
stringResource(explanationId),
style = LocalType.current.small,
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing)
)
tag?.let {
Text(
txt,
style = LocalType.current.small,
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing)
)
} else {
// ..otherwise just pass through the text as it is.
Text(
stringResource(explanation),
style = LocalType.current.small,
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing)
stringResource(it),
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing),
color = LocalColors.current.primary,
style = LocalType.current.h9
)
}
}
}
}
}
@Composable
private fun NotificationRadioButton(
titleTxt: String,
explanationTxt: String,
modifier: Modifier = Modifier,
@StringRes tag: Int? = null,
checked: Boolean = false,
onClick: () -> Unit = {}
) {
RadioButton(
onClick = onClick,
modifier = modifier,
selected = checked,
contentPadding = PaddingValues(horizontal = LocalDimensions.current.mediumSpacing, vertical = 7.dp)
) {
Box(
modifier = Modifier
.weight(1f)
.border(
LocalDimensions.current.borderStroke,
LocalColors.current.borders,
RoundedCornerShape(8.dp)
),
) {
Column(
modifier = Modifier.padding(horizontal = LocalDimensions.current.smallSpacing, vertical = LocalDimensions.current.xsSpacing)) {
Text(
titleTxt,
style = LocalType.current.h8
)
Text(
explanationTxt,
style = LocalType.current.small,
modifier = Modifier.padding(top = LocalDimensions.current.xxsSpacing)
)
tag?.let {
Text(

View File

@ -46,13 +46,13 @@ class HelpSettingsFragment: CorrectedPreferenceFragment() {
addPreferencesFromResource(R.xml.preferences_help)
// String sub the summary text of the `export_logs` element in preferences_help.xml
var exportPref = preferenceScreen.findPreference<Preference>(EXPORT_LOGS)
val exportPref = preferenceScreen.findPreference<Preference>(EXPORT_LOGS)
exportPref?.summary = Phrase.from(context, R.string.helpReportABugExportLogsDescription)
.put(APP_NAME_KEY, getString(R.string.app_name))
.format()
// String sub the summary text of the `translate_session` element in preferences_help.xml
var translatePref = preferenceScreen.findPreference<Preference>(TRANSLATE)
val translatePref = preferenceScreen.findPreference<Preference>(TRANSLATE)
translatePref?.title = Phrase.from(context, R.string.helpHelpUsTranslateSession)
.put(APP_NAME_KEY, getString(R.string.app_name))
.format()

View File

@ -3,14 +3,13 @@ package org.thoughtcrime.securesms.preferences
import android.app.KeyguardManager
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import androidx.preference.Preference
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceDataStore
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import network.loki.messenger.BuildConfig
import network.loki.messenger.R
import org.session.libsession.utilities.TextSecurePreferences
@ -24,7 +23,6 @@ import org.thoughtcrime.securesms.service.KeyCachingService
import org.thoughtcrime.securesms.showSessionDialog
import org.thoughtcrime.securesms.util.CallNotificationBuilder.Companion.areNotificationsEnabled
import org.thoughtcrime.securesms.util.IntentUtils
import javax.inject.Inject
@AndroidEntryPoint
class PrivacySettingsPreferenceFragment : ListSummaryPreferenceFragment() {

View File

@ -39,6 +39,7 @@
android:key="pref_typing_indicators"
android:title="@string/typingIndicators"
android:summary="@string/typingIndicatorsDescription" />
<ImagePreference />
</PreferenceCategory>

View File

@ -35,7 +35,6 @@ object UpdateMessageBuilder {
?.displayName(Contact.ContactContext.REGULAR)
?: truncateIdForDisplay(senderId)
//@RequiresApi(Build.VERSION_CODES.P)
fun buildGroupUpdateMessage(context: Context, updateMessageData: UpdateMessageData, senderId: String? = null, isOutgoing: Boolean = false): CharSequence {
val updateData = updateMessageData.kind
if (updateData == null || !isOutgoing && senderId == null) return ""
@ -71,7 +70,7 @@ object UpdateMessageBuilder {
val newMemberCount = updateData.updatedMembers.size
// We previously differentiated between members added by us Vs. members added by someone
// Note: We previously differentiated between members added by us Vs. members added by someone
// else via checking against `isOutgoing` - but now we use the same strings regardless.
when (newMemberCount) {
0 -> {
@ -126,7 +125,7 @@ object UpdateMessageBuilder {
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(OTHER_NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(1)))
.format()
else -> Phrase.from(context, R.string.groupRemovedMore)
else -> Phrase.from(context, R.string.groupRemovedMultiple)
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(COUNT_KEY, updateData.updatedMembers.size - 1)
.format()
@ -150,7 +149,7 @@ object UpdateMessageBuilder {
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(OTHER_NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(1)))
.format()
else -> Phrase.from(context, R.string.groupRemovedMore)
else -> Phrase.from(context, R.string.groupRemovedMultiple)
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(COUNT_KEY, updateData.updatedMembers.size - 1)
.format()
@ -175,7 +174,7 @@ object UpdateMessageBuilder {
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(OTHER_NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(1)))
.format()
else -> Phrase.from(context, R.string.groupMemberLeftMore)
else -> Phrase.from(context, R.string.groupMemberLeftMultiple)
.put(NAME_KEY, getSenderName(updateData.updatedMembers.elementAt(0)))
.put(COUNT_KEY, updateData.updatedMembers.size - 1)
.format()

View File

@ -32,8 +32,8 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="adminPromotedToAdmin"><b>{name}</b> was promoted to Admin.</string>
<string name="adminPromotionFailed">Admin promotion failed</string>
<string name="adminPromotionFailedDescription">Failed to promote {name} in {group_name}</string>
<string name="adminPromotionFailedDescriptionMany">Failed to promote {name} and {count} others in {group_name}</string>
<string name="adminPromotionFailedDescriptionMore">Failed to promote {name} and {other_name} in {group_name}</string>
<string name="adminPromotionFailedDescriptionMultiple">Failed to promote {name} and {count} others in {group_name}</string>
<string name="adminPromotionFailedDescriptionTwo">Failed to promote {name} and {other_name} in {group_name}</string>
<string name="adminPromotionSent">Admin promotion sent</string>
<string name="adminRemove">Remove Admins</string>
<string name="adminRemoveAsAdmin">Remove as Admin</string>
@ -198,6 +198,8 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="clearMessagesNoteToSelfDescription">Are you sure you want to clear all Note to Self messages from your device?</string>
<string name="close">Close</string>
<string name="closeWindow">Close Window</string>
<string name="communityBanDescription">This will ban the selected user from this Community. Are you sure you want to continue?</string>
<string name="communityBanDeleteDescription">This will ban the selected user from this Community and delete all their messages. Are you sure you want to continue?</string>
<string name="communityEnterUrl">Enter Community URL</string>
<string name="communityEnterUrlErrorInvalid">Invalid URL</string>
<string name="communityEnterUrlErrorInvalidDescription">Please check the Community URL and try again.</string>
@ -363,14 +365,6 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<item quantity="one">And %1$d other has reacted %2$s to this message.</item>
<item quantity="other">And %1$d others have reacted %2$s to this message.</item>
</plurals>
<string name="emojiReactsHoverNameDesktop">{name} reacted with <emoji/></string>
<string name="emojiReactsHoverTwoNameDesktop">{name} and {other_name} reacted with <emoji/></string>
<string name="emojiReactsHoverTwoNameMultipleDesktop">{name}, {other_name} and <span>{count} others</span> reacted with <emoji/></string>
<string name="emojiReactsHoverTwoNameOneDesktop">{name}, {other_name} and <span>1 other</span> reacted with <emoji/></string>
<string name="emojiReactsHoverYouDesktop">You reacted with <emoji/></string>
<string name="emojiReactsHoverYouNameDesktop">You and {name} reacted with <emoji/></string>
<string name="emojiReactsHoverYouNameMultipleDesktop">You, {name} and <span>{count} others</span> reacted with <emoji/></string>
<string name="emojiReactsHoverYouNameOneDesktop">You, {name} and <span>1 other</span> reacted with <emoji/></string>
<string name="emojiReactsNotification">Reacted to your message {emoji}</string>
<string name="enable">Enable</string>
<string name="errorConnection">Please check your internet connection and try again.</string>
@ -416,14 +410,14 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="groupLeaveErrorFailed">Failed to leave {group_name}</string>
<string name="groupLegacyBanner">Groups have been upgraded, create a new group to upgrade. Old group functionality will be degraded from {date}.</string>
<string name="groupMemberLeft"><b>{name}</b> left the group.</string>
<string name="groupMemberLeftMore"><b>{name}</b> and <b>{count} others</b> left the group.</string>
<string name="groupMemberLeftMultiple"><b>{name}</b> and <b>{count} others</b> left the group.</string>
<string name="groupMemberLeftTwo"><b>{name}</b> and <b>{other_name}</b> left the group.</string>
<string name="groupMemberMoreNew"><b>{name}</b> and <b>{count} others</b> joined the group.</string>
<string name="groupMemberNew"><b>{name}</b> was invited to join the group.</string>
<string name="groupMemberNew"><b>{name}</b> joined the group.</string>
<string name="groupMemberNewHistory"><b>{name}</b> was invited to join the group. Chat history was shared.</string>
<string name="groupMemberNewHistoryMultiple"><b>{name}</b> and <b>{count} others</b> were invited to join the group. Chat history was shared.</string>
<string name="groupMemberNewHistoryTwo"><b>{name}</b> and <b>{other_name}</b> were invited to join the group. Chat history was shared.</string>
<string name="groupMemberNewMultiple"><b>{name}</b> and <b>{count} others</b> were invited to join the group.</string>
<string name="groupMemberNewMultiple"><b>{name}</b> and <b>{count} others</b> joined the group.</string>
<string name="groupMemberNewTwo"><b>{name}</b> and <b>{other_name}</b> were invited to join the group.</string>
<string name="groupMemberNewYouHistory"><b>{name}</b> was invited to join the group. Chat history was shared.</string>
<string name="groupMemberNewYouHistoryMultiple"><b>You</b> and <b>{count} others</b> were invited to join the group. Chat history was shared.</string>
@ -449,14 +443,15 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="groupPromotedYouMultiple"><b>You</b> and <b>{count} others</b> were promoted to Admin.</string>
<string name="groupPromotedYouTwo"><b>You</b> and <b>{name}</b> were promoted to Admin.</string>
<string name="groupRemoveDescription">Would you like to remove <b>{name}</b> from <b>{group_name}</b>?</string>
<string name="groupRemoveDescriptionTwo">Would you like to remove <b>{name}</b> and <b>{other_name}</b> from <b>{group_name}</b>?</string>
<string name="groupRemoveMessages">Remove user and their messages</string>
<string name="groupRemoveMoreDescription">Would you like to remove <b>{name}</b> and <b>{count} others</b> from <b>{group_name}</b>?</string>
<string name="groupRemoveDescriptionMultiple">Would you like to remove <b>{name}</b> and <b>{count} others</b> from <b>{group_name}</b>?</string>
<string name="groupRemoveTwoDescription">Would you like to remove <b>{name}</b> and <b>{other_name}</b> from <b>{group_name}</b>?</string>
<string name="groupRemoveUserOnly">Remove user </string>
<string name="groupRemoveUsersMessages">Remove users and their messages</string>
<string name="groupRemoveUsersOnly">Remove users</string>
<string name="groupRemoved"><b>{name}</b> was removed from the group.</string>
<string name="groupRemovedMore"><b>{name}</b> and <b>{count} others</b> were removed from the group.</string>
<string name="groupRemovedMultiple"><b>{name}</b> and <b>{count} others</b> were removed from the group.</string>
<string name="groupRemovedTwo"><b>{name}</b> and <b>{other_name}</b> were removed from the group.</string>
<string name="groupRemovedYou">You were removed from <b>{group_name}</b>.</string>
<string name="groupRemovedYouMultiple"><b>You</b> and <b>{count} others</b> were removed from the group.</string>
@ -501,7 +496,6 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="loading">Loading...</string>
<string name="lockApp">Lock App</string>
<string name="lockAppDescription">Require fingerprint, PIN, pattern or password to unlock {app_name}.</string>
<string name="lockAppDescriptionIos">Require Touch ID, Face ID or your passcode to unlock {app_name}.</string>
<string name="lockAppEnablePasscode">You must enable a passcode in your iOS Settings in order to use Screen Lock.</string>
<string name="lockAppLocked">{app_name} is locked</string>
<string name="lockAppQuickResponse">Quick response unavailable when {app_name} is locked!</string>
@ -526,7 +520,7 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="membersInviteShareMessageHistory">Share message history</string>
<string name="membersInviteShareMoreDescription">Would you like to share group message history with <b>{name}</b> and <b>{count} others</b>?</string>
<string name="membersInviteShareNewMessagesOnly">Share new messages only</string>
<string name="membersInviteShareTwoDescription">Would you like to share group message history with <b>{name}</b> and <b>{other_name}</b>?</string>
<string name="membersInviteShareDescriptionTwo">Would you like to share group message history with <b>{name}</b> and <b>{other_name}</b>?</string>
<string name="membersInviteTitle">Invite</string>
<string name="message">Message</string>
<string name="messageEmpty">This message is empty.</string>
@ -592,7 +586,6 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="notificationsContentShowNoNameOrContent">No Name or Content</string>
<string name="notificationsFastMode">Fast Mode</string>
<string name="notificationsFastModeDescription">You\'ll be notified of new messages reliably and immediately using Google\'s notification Servers.</string>
<string name="notificationsFastModeDescriptionIos">You\'ll be notified of new messages reliably and immediately using Apple\'s notification Servers.</string>
<string name="notificationsGoToDevice">Go to device notification settings</string>
<string name="notificationsIosGroup">{name} to {conversation_name}</string>
<string name="notificationsIosRestart">You may have received messages while your {device} was restarting.</string>
@ -759,6 +752,7 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="sessionHelp">Help</string>
<string name="sessionInviteAFriend">Invite a Friend</string>
<string name="sessionMessageRequests">Message Requests</string>
<string name="sessionNetworkSent">{token_name_long} ({<span>{token_name_short}</span>)</string>
<string name="sessionNotifications">Notifications</string>
<string name="sessionPermissions">Permissions</string>
<string name="sessionPrivacy">Privacy</string>