Using the updated strings

pull/1518/head
ThomasSession 7 months ago
parent 07071e5289
commit 58826d914e

@ -7,21 +7,12 @@ import org.thoughtcrime.securesms.showSessionDialog
class DeleteMediaDialog {
companion object {
@JvmStatic
fun show(context: Context, recordCount: Int, doDelete: Runnable) =
context.showSessionDialog {
iconAttribute(R.attr.dialog_alert_icon)
title(context.resources.getQuantityString(
R.plurals.MediaOverviewActivity_Media_delete_confirm_title,
recordCount,
recordCount
))
text(context.resources.getQuantityString(
R.plurals.MediaOverviewActivity_Media_delete_confirm_message,
recordCount,
recordCount
))
button(R.string.delete) { doDelete.run() }
cancelButton()
}
fun show(context: Context, recordCount: Int, doDelete: Runnable) = context.showSessionDialog {
iconAttribute(R.attr.dialog_alert_icon)
title(context.resources.getQuantityString(R.plurals.deleteMessage, recordCount, recordCount))
text(context.resources.getString(R.string.deleteMessageDescriptionEveryone))
dangerButton(R.string.delete) { doDelete.run() }
cancelButton()
}
}
}

@ -2132,7 +2132,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
val deleteDeviceOnly = {
viewModel.markAsDeletedLocally(
messages = messages,
displayedMessage = "[UPDATE THIS!] This message was deleted on this device" //todo DELETION update once we have strings
displayedMessage = resources.getString(R.string.deleteMessageDeletedLocally)
)
endActionMode()
//todo DELETION show confirmation toast

@ -27,14 +27,12 @@ class DeleteMessageDeviceOnlyDialog(
theme.resolveAttribute(R.attr.danger, typedValue, true)
@ColorInt val deleteColor = typedValue.data
title("[UPDATE THIS!] Delete message") //todo DELETION update once we have strings
text("[UPDATE THIS!] This will delete this message device only") //todo DELETION update once we have strings
title(resources.getQuantityString(R.plurals.deleteMessage, messageCount, messageCount))
text(resources.getString(R.string.deleteMessageDescriptionDevice)) //todo DELETION we need the plural version of this here, which currently is not set up in strings
button(
text = R.string.delete,
textColor = deleteColor,
listener = {
onDeleteDeviceOnly()
}
listener = onDeleteDeviceOnly
)
cancelButton(onCancel)
}

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.conversation.v2.dialogs
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.util.TypedValue
import androidx.annotation.ColorInt
@ -34,8 +35,8 @@ class DeleteMessageDialog(
theme.resolveAttribute(R.attr.danger, typedValue, true)
@ColorInt val deleteColor = typedValue.data
title("[UPDATE THIS!] Delete message") //todo DELETION update once we have strings
text("[UPDATE THIS!] This will delete this message") //todo DELETION update once we have strings
title(resources.getQuantityString(R.plurals.deleteMessage, messageCount, messageCount))
text(resources.getString(R.string.deleteMessageConfirm)) //todo DELETION we need the plural version of this here, which currently is not set up in strings
singleChoiceItems(
options = deleteOptions.map { it.label },
currentSelected = if (defaultToEveryone) 1 else 0, // some cases require the second option, "delete for everyone", to be the default selected
@ -58,18 +59,20 @@ class DeleteMessageDialog(
}
private val deleteOptions: List<DeleteOption> = listOf(
DeleteOption.DeleteDeviceOnly(), DeleteOption.DeleteForEveryone()
DeleteOption.DeleteDeviceOnly(requireContext()), DeleteOption.DeleteForEveryone(requireContext())
)
private sealed class DeleteOption(
open val label: String
){
data class DeleteDeviceOnly(
override val label: String = "[UPDATE THIS!] Delete device only", //todo DELETION update once we have strings
val context: Context,
override val label: String = context.getString(R.string.deleteMessageDeviceOnly),
): DeleteOption(label)
data class DeleteForEveryone(
override val label: String = "[UPDATE THIS!] Delete for everyone", //todo DELETION update once we have strings
val context: Context,
override val label: String = context.getString(R.string.deleteMessageEveryone),
): DeleteOption(label)
}
}

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.conversation.v2.dialogs
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.util.TypedValue
import androidx.annotation.ColorInt
@ -32,8 +33,8 @@ class DeleteNoteToSelfDialog(
theme.resolveAttribute(R.attr.danger, typedValue, true)
@ColorInt val deleteColor = typedValue.data
title("[UPDATE THIS!] Delete note to self") //todo DELETION update once we have strings
text("[UPDATE THIS!] This will delete this note") //todo DELETION update once we have strings
title(resources.getQuantityString(R.plurals.deleteMessage, messageCount, messageCount))
text(resources.getString(R.string.deleteMessageConfirm)) //todo DELETION we need the plural version of this here, which currently is not set up in strings
singleChoiceItems(
options = deleteOptions.map { it.label },
currentSelected = 0,
@ -56,18 +57,20 @@ class DeleteNoteToSelfDialog(
}
private val deleteOptions: List<DeleteOption> = listOf(
DeleteOption.DeleteDeviceOnly(), DeleteOption.DeleteOnAllMyDevices()
DeleteOption.DeleteDeviceOnly(requireContext()), DeleteOption.DeleteOnAllMyDevices(requireContext())
)
private sealed class DeleteOption(
open val label: String
){
data class DeleteDeviceOnly(
override val label: String = "[UPDATE THIS!] Delete device only", //todo DELETION update once we have strings
val context: Context,
override val label: String = context.getString(R.string.deleteMessageDeviceOnly),
): DeleteOption(label)
data class DeleteOnAllMyDevices(
override val label: String = "[UPDATE THIS!] Delete all devices", //todo DELETION update once we have strings
val context: Context,
override val label: String = context.getString(R.string.deleteMessageDevicesAll),
): DeleteOption(label)
}
}

@ -2,6 +2,7 @@ package org.session.libsession.messaging.sending_receiving
import android.text.TextUtils
import network.loki.messenger.libsession_util.util.ExpiryMode
import org.session.libsession.R
import org.session.libsession.avatars.AvatarHelper
import org.session.libsession.messaging.MessagingModuleConfiguration
import org.session.libsession.messaging.jobs.BackgroundGroupAddJob
@ -260,7 +261,7 @@ fun MessageReceiver.handleUnsendRequest(message: UnsendRequest): Long? {
val deletedMessageId = messageDataProvider.markMessageAsDeleted(
timestamp = timestamp,
author = author,
displayedMessage = "[UPDATE THIS!] This message was deleted on this device" //todo DELETION update once we have strings
displayedMessage = context.getString(R.string.deleteMessageDeletedLocally)
)
if (!messageDataProvider.isOutgoingMessage(timestamp)) {
SSKEnvironment.shared.notificationManager.updateNotification(context)

Loading…
Cancel
Save