mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-12 13:27:45 +00:00
fix nickname usage & clean
This commit is contained in:
@@ -35,9 +35,6 @@ interface StorageProtocol {
|
||||
fun getUserProfilePictureURL(): String?
|
||||
fun setUserProfilePictureUrl(newProfilePicture: String)
|
||||
|
||||
fun getProfileKeyForRecipient(recipientPublicKey: String): ByteArray?
|
||||
fun getDisplayNameForRecipient(recipientPublicKey: String): String?
|
||||
|
||||
// Signal Protocol
|
||||
|
||||
fun getOrGenerateRegistrationID(): Int
|
||||
|
@@ -13,7 +13,7 @@ object UpdateMessageBuilder {
|
||||
val updateData = updateMessageData.kind ?: return message
|
||||
if (!isOutgoing && sender == null) return message
|
||||
val senderName: String = if (!isOutgoing) {
|
||||
MessagingModuleConfiguration.shared.storage.getDisplayNameForRecipient(sender!!) ?: sender
|
||||
MessagingModuleConfiguration.shared.storage.getDisplayName(sender!!) ?: sender
|
||||
} else { context.getString(R.string.MessageRecord_you) }
|
||||
|
||||
when (updateData) {
|
||||
@@ -33,7 +33,7 @@ object UpdateMessageBuilder {
|
||||
}
|
||||
is UpdateMessageData.Kind.GroupMemberAdded -> {
|
||||
val members = updateData.updatedMembers.joinToString(", ") {
|
||||
MessagingModuleConfiguration.shared.storage.getDisplayNameForRecipient(it) ?: it
|
||||
MessagingModuleConfiguration.shared.storage.getDisplayName(it) ?: it
|
||||
}
|
||||
message = if (isOutgoing) {
|
||||
context.getString(R.string.MessageRecord_you_added_s_to_the_group, members)
|
||||
@@ -54,7 +54,7 @@ object UpdateMessageBuilder {
|
||||
} else {
|
||||
// 2nd case: you are not part of the removed members
|
||||
val members = updateData.updatedMembers.joinToString(", ") {
|
||||
storage.getDisplayNameForRecipient(it) ?: it
|
||||
storage.getDisplayName(it) ?: it
|
||||
}
|
||||
if (isOutgoing) {
|
||||
context.getString(R.string.MessageRecord_you_removed_s_from_the_group, members)
|
||||
@@ -77,7 +77,7 @@ object UpdateMessageBuilder {
|
||||
fun buildExpirationTimerMessage(context: Context, duration: Long, sender: String? = null, isOutgoing: Boolean = false): String {
|
||||
if (!isOutgoing && sender == null) return ""
|
||||
val senderName: String? = if (!isOutgoing) {
|
||||
MessagingModuleConfiguration.shared.storage.getDisplayNameForRecipient(sender!!) ?: sender
|
||||
MessagingModuleConfiguration.shared.storage.getDisplayName(sender!!) ?: sender
|
||||
} else { context.getString(R.string.MessageRecord_you) }
|
||||
return if (duration <= 0) {
|
||||
if (isOutgoing) context.getString(R.string.MessageRecord_you_disabled_disappearing_messages)
|
||||
@@ -90,7 +90,7 @@ object UpdateMessageBuilder {
|
||||
}
|
||||
|
||||
fun buildDataExtractionMessage(context: Context, kind: DataExtractionNotificationInfoMessage.Kind, sender: String? = null): String {
|
||||
val senderName = MessagingModuleConfiguration.shared.storage.getDisplayNameForRecipient(sender!!) ?: sender
|
||||
val senderName = MessagingModuleConfiguration.shared.storage.getDisplayName(sender!!) ?: sender
|
||||
return when (kind) {
|
||||
DataExtractionNotificationInfoMessage.Kind.SCREENSHOT ->
|
||||
context.getString(R.string.MessageRecord_s_took_a_screenshot, senderName)
|
||||
|
Reference in New Issue
Block a user