Adjust strings for media and calls.

This commit is contained in:
Michelle Tang
2025-01-28 16:41:30 -05:00
committed by Greyson Parrelli
parent c431ba3f7a
commit fd1e47888a
8 changed files with 51 additions and 26 deletions

View File

@@ -2381,7 +2381,7 @@ class ConversationFragment :
val attachments = SaveAttachmentUtil.getAttachmentsForRecord(record)
SaveAttachmentUtil.showWarningDialogIfNecessary(requireContext()) {
SaveAttachmentUtil.showWarningDialogIfNecessary(requireContext(), attachments.size) {
if (StorageUtil.canWriteToMediaStore()) {
performAttachmentSave(attachments)
} else {
@@ -2482,13 +2482,14 @@ class ConversationFragment :
override fun isSwipeAvailable(conversationMessage: ConversationMessage): Boolean {
val recipient = viewModel.recipientSnapshot ?: return false
return actionMode == null && MenuState.canReplyToMessage(
recipient,
MenuState.isActionMessage(conversationMessage.messageRecord),
conversationMessage.messageRecord,
viewModel.hasMessageRequestState,
conversationGroupViewModel.isNonAdminInAnnouncementGroup()
)
return actionMode == null &&
MenuState.canReplyToMessage(
recipient,
MenuState.isActionMessage(conversationMessage.messageRecord),
conversationMessage.messageRecord,
viewModel.hasMessageRequestState,
conversationGroupViewModel.isNonAdminInAnnouncementGroup()
)
}
}
@@ -3934,7 +3935,10 @@ class ConversationFragment :
//region Compose + Send Callbacks
private inner class SendButtonListener : View.OnClickListener, OnEditorActionListener, SendButton.ScheduledSendListener {
private inner class SendButtonListener :
View.OnClickListener,
OnEditorActionListener,
SendButton.ScheduledSendListener {
override fun onClick(v: View) {
sendMessage()
}
@@ -4262,7 +4266,10 @@ class ConversationFragment :
override fun create(): Fragment = KeyboardPagerFragment()
}
private inner class KeyboardEvents : OnBackPressedCallback(false), InputAwareConstraintLayout.Listener, InsetAwareConstraintLayout.KeyboardStateListener {
private inner class KeyboardEvents :
OnBackPressedCallback(false),
InputAwareConstraintLayout.Listener,
InsetAwareConstraintLayout.KeyboardStateListener {
override fun handleOnBackPressed() {
container.hideInput()
}

View File

@@ -93,13 +93,22 @@ public class GroupCallUpdateMessageFactory implements UpdateDescription.Spannabl
: context.getString(R.string.MessageRecord_s_is_in_the_call, describe(joinedMembers.get(0)));
}
case 2:
return withTime ? context.getString(R.string.MessageRecord_s_and_s_are_in_the_call_s1,
describe(joinedMembers.get(0)),
describe(joinedMembers.get(1)),
time)
: context.getString(R.string.MessageRecord_s_and_s_are_in_the_call,
describe(joinedMembers.get(0)),
describe(joinedMembers.get(1)));
boolean includesSelf = joinedMembers.contains(selfAci);
if (includesSelf) {
return withTime ? context.getString(R.string.MessageRecord_s_and_you_are_in_the_call_s1,
describe(joinedMembers.get(0)),
time)
: context.getString(R.string.MessageRecord_s_and_you_are_in_the_call,
describe(joinedMembers.get(0)));
} else {
return withTime ? context.getString(R.string.MessageRecord_s_and_s_are_in_the_call_s1,
describe(joinedMembers.get(0)),
describe(joinedMembers.get(1)),
time)
: context.getString(R.string.MessageRecord_s_and_s_are_in_the_call,
describe(joinedMembers.get(0)),
describe(joinedMembers.get(1)));
}
default:
int others = joinedMembers.size() - 2;
return withTime ? context.getResources().getQuantityString(R.plurals.MessageRecord_s_s_and_d_others_are_in_the_call_s,

View File

@@ -44,7 +44,7 @@ final class MediaActions {
return;
}
SaveAttachmentTask.showWarningDialogIfNecessary(context, () -> Permissions.with(fragment)
SaveAttachmentTask.showWarningDialogIfNecessary(context, mediaRecords.size(), () -> Permissions.with(fragment)
.request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.ifNecessary()
.withPermanentDenialDialog(fragment.getString(R.string.MediaPreviewActivity_signal_needs_the_storage_permission_in_order_to_write_to_external_storage_but_it_has_been_permanently_denied))

View File

@@ -78,7 +78,9 @@ import java.util.Locale
import java.util.concurrent.TimeUnit
import kotlin.math.roundToInt
class MediaPreviewV2Fragment : LoggingFragment(R.layout.fragment_media_preview_v2), MediaPreviewFragment.Events {
class MediaPreviewV2Fragment :
LoggingFragment(R.layout.fragment_media_preview_v2),
MediaPreviewFragment.Events {
private val lifecycleDisposable = LifecycleDisposable()
private val binding by ViewBinderDelegate(FragmentMediaPreviewV2Binding::bind)
@@ -557,7 +559,7 @@ class MediaPreviewV2Fragment : LoggingFragment(R.layout.fragment_media_preview_v
}
private fun saveToDisk(mediaItem: MediaTable.MediaRecord) {
SaveAttachmentTask.showWarningDialogIfNecessary(requireContext()) {
SaveAttachmentTask.showWarningDialogIfNecessary(requireContext(), 1) {
if (StorageUtil.canWriteToMediaStore()) {
performSaveToDisk(mediaItem)
return@showWarningDialogIfNecessary

View File

@@ -653,7 +653,7 @@ public final class ImageEditorFragment extends Fragment implements ImageEditorHu
@Override
public void onSave() {
SaveAttachmentTask.showWarningDialogIfNecessary(requireContext(), () -> {
SaveAttachmentTask.showWarningDialogIfNecessary(requireContext(), 1, () -> {
if (StorageUtil.canWriteToMediaStore()) {
performSaveToDisk();
return;

View File

@@ -435,7 +435,7 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
}
}
public static void showWarningDialogIfNecessary(Context context, Runnable onSave) {
public static void showWarningDialogIfNecessary(Context context, int count, Runnable onSave) {
if (SignalStore.uiHints().hasDismissedSaveStorageWarning()) {
onSave.run();
} else {
@@ -443,7 +443,7 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
.setView(R.layout.dialog_save_attachment)
.setTitle(R.string.ConversationFragment__save_to_phone)
.setCancelable(true)
.setMessage(R.string.ConversationFragment__this_media_will_be_saved)
.setMessage(context.getResources().getQuantityString(R.plurals.ConversationFragment__this_media_will_be_saved, count, count))
.setPositiveButton(R.string.save, ((dialog, i) -> {
CheckBox checkbox = ((AlertDialog) dialog).findViewById(R.id.checkbox);
if (checkbox.isChecked()) {

View File

@@ -54,7 +54,7 @@ object SaveAttachmentUtil {
private val TAG = Log.tag(SaveAttachmentUtil::class.java)
fun showWarningDialogIfNecessary(context: Context, onSave: () -> Unit) {
fun showWarningDialogIfNecessary(context: Context, count: Int, onSave: () -> Unit) {
if (SignalStore.uiHints.hasDismissedSaveStorageWarning()) {
onSave()
} else {
@@ -62,7 +62,7 @@ object SaveAttachmentUtil {
.setView(R.layout.dialog_save_attachment)
.setTitle(R.string.ConversationFragment__save_to_phone)
.setCancelable(true)
.setMessage(R.string.ConversationFragment__this_media_will_be_saved)
.setMessage(context.resources.getQuantityString(R.plurals.ConversationFragment__this_media_will_be_saved, count, count))
.setPositiveButton(R.string.save) { dialog, _ ->
val checkbox = (dialog as AlertDialog).findViewById<CheckBox>(R.id.checkbox)!!
if (checkbox.isChecked) {