mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-20 07:31:29 +00:00
fix
This commit is contained in:
parent
3bfef2d0cd
commit
7aa1f30c98
@ -106,7 +106,7 @@ public class ConversationUpdateItem extends LinearLayout
|
|||||||
else if (messageRecord.isJoined()) setJoinedRecord(messageRecord);
|
else if (messageRecord.isJoined()) setJoinedRecord(messageRecord);
|
||||||
else if (messageRecord.isExpirationTimerUpdate()) setTimerRecord(messageRecord);
|
else if (messageRecord.isExpirationTimerUpdate()) setTimerRecord(messageRecord);
|
||||||
else if (messageRecord.isScreenshotExtraction()) setDataExtractionRecord(messageRecord, DataExtractionNotificationInfoMessage.Kind.SCREENSHOT);
|
else if (messageRecord.isScreenshotExtraction()) setDataExtractionRecord(messageRecord, DataExtractionNotificationInfoMessage.Kind.SCREENSHOT);
|
||||||
else if (messageRecord.isMediaSavedExtraction()) setDataExtractionRecord(messageRecord, DataExtractionNotificationInfoMessage.Kind.MEDIASAVED);
|
else if (messageRecord.isMediaSavedExtraction()) setDataExtractionRecord(messageRecord, DataExtractionNotificationInfoMessage.Kind.MEDIA_SAVED);
|
||||||
else if (messageRecord.isEndSession()) setEndSessionRecord(messageRecord);
|
else if (messageRecord.isEndSession()) setEndSessionRecord(messageRecord);
|
||||||
else if (messageRecord.isIdentityUpdate()) setIdentityRecord(messageRecord);
|
else if (messageRecord.isIdentityUpdate()) setIdentityRecord(messageRecord);
|
||||||
else if (messageRecord.isIdentityVerified() ||
|
else if (messageRecord.isIdentityVerified() ||
|
||||||
@ -154,7 +154,7 @@ public class ConversationUpdateItem extends LinearLayout
|
|||||||
@ColorInt int color = GeneralUtilitiesKt.getColorWithID(getResources(), R.color.text, getContext().getTheme());
|
@ColorInt int color = GeneralUtilitiesKt.getColorWithID(getResources(), R.color.text, getContext().getTheme());
|
||||||
if (kind == DataExtractionNotificationInfoMessage.Kind.SCREENSHOT) {
|
if (kind == DataExtractionNotificationInfoMessage.Kind.SCREENSHOT) {
|
||||||
icon.setImageResource(R.drawable.quick_camera_dark);
|
icon.setImageResource(R.drawable.quick_camera_dark);
|
||||||
} else if (kind == DataExtractionNotificationInfoMessage.Kind.MEDIASAVED) {
|
} else if (kind == DataExtractionNotificationInfoMessage.Kind.MEDIA_SAVED) {
|
||||||
icon.setImageResource(R.drawable.ic_file_download_white_36dp);
|
icon.setImageResource(R.drawable.ic_file_download_white_36dp);
|
||||||
}
|
}
|
||||||
icon.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
|
icon.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
|
||||||
|
@ -25,9 +25,9 @@ import android.text.style.StyleSpan;
|
|||||||
|
|
||||||
import network.loki.messenger.R;
|
import network.loki.messenger.R;
|
||||||
|
|
||||||
|
import org.session.libsession.messaging.sending_receiving.dataextraction.DataExtractionNotificationInfoMessage;
|
||||||
import org.session.libsession.messaging.utilities.UpdateMessageBuilder;
|
import org.session.libsession.messaging.utilities.UpdateMessageBuilder;
|
||||||
import org.session.libsession.messaging.utilities.UpdateMessageData;
|
import org.session.libsession.messaging.utilities.UpdateMessageData;
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos;
|
|
||||||
import org.thoughtcrime.securesms.database.MmsSmsColumns;
|
import org.thoughtcrime.securesms.database.MmsSmsColumns;
|
||||||
import org.thoughtcrime.securesms.database.SmsDatabase;
|
import org.thoughtcrime.securesms.database.SmsDatabase;
|
||||||
import org.session.libsession.database.documents.IdentityKeyMismatch;
|
import org.session.libsession.database.documents.IdentityKeyMismatch;
|
||||||
@ -99,8 +99,8 @@ public abstract class MessageRecord extends DisplayRecord {
|
|||||||
int seconds = (int) (getExpiresIn() / 1000);
|
int seconds = (int) (getExpiresIn() / 1000);
|
||||||
return new SpannableString(UpdateMessageBuilder.INSTANCE.buildExpirationTimerMessage(context, seconds, getIndividualRecipient().getAddress().serialize(), isOutgoing()));
|
return new SpannableString(UpdateMessageBuilder.INSTANCE.buildExpirationTimerMessage(context, seconds, getIndividualRecipient().getAddress().serialize(), isOutgoing()));
|
||||||
} else if (isDataExtraction()) {
|
} else if (isDataExtraction()) {
|
||||||
if (isScreenshotExtraction()) return new SpannableString((UpdateMessageBuilder.INSTANCE.buildDataExtractionMessage(context, SignalServiceProtos.DataExtractionNotification.Type.SCREENSHOT, getIndividualRecipient().getAddress().serialize())));
|
if (isScreenshotExtraction()) return new SpannableString((UpdateMessageBuilder.INSTANCE.buildDataExtractionMessage(context, DataExtractionNotificationInfoMessage.Kind.SCREENSHOT, getIndividualRecipient().getAddress().serialize())));
|
||||||
else if (isMediaSavedExtraction()) return new SpannableString((UpdateMessageBuilder.INSTANCE.buildDataExtractionMessage(context, SignalServiceProtos.DataExtractionNotification.Type.MEDIA_SAVED, getIndividualRecipient().getAddress().serialize())));
|
else if (isMediaSavedExtraction()) return new SpannableString((UpdateMessageBuilder.INSTANCE.buildDataExtractionMessage(context, DataExtractionNotificationInfoMessage.Kind.MEDIA_SAVED, getIndividualRecipient().getAddress().serialize())));
|
||||||
}
|
}
|
||||||
// TODO below lines are left here for compatibility with older group update messages, it can be deleted later on
|
// TODO below lines are left here for compatibility with older group update messages, it can be deleted later on
|
||||||
else if (isGroupUpdate() && isOutgoing()) {
|
else if (isGroupUpdate() && isOutgoing()) {
|
||||||
|
@ -131,7 +131,7 @@ public class IncomingMediaMessage {
|
|||||||
public boolean isMediaSavedDataExtraction() {
|
public boolean isMediaSavedDataExtraction() {
|
||||||
if (dataExtractionNotification == null) return false;
|
if (dataExtractionNotification == null) return false;
|
||||||
else {
|
else {
|
||||||
return dataExtractionNotification.getKind() == DataExtractionNotificationInfoMessage.Kind.MEDIASAVED;
|
return dataExtractionNotification.getKind() == DataExtractionNotificationInfoMessage.Kind.MEDIA_SAVED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ private fun MessageReceiver.handleDataExtractionNotification(message: DataExtrac
|
|||||||
val senderPublicKey = message.sender!!
|
val senderPublicKey = message.sender!!
|
||||||
val notification: DataExtractionNotificationInfoMessage = when(message.kind) {
|
val notification: DataExtractionNotificationInfoMessage = when(message.kind) {
|
||||||
is DataExtractionNotification.Kind.Screenshot -> DataExtractionNotificationInfoMessage(DataExtractionNotificationInfoMessage.Kind.SCREENSHOT)
|
is DataExtractionNotification.Kind.Screenshot -> DataExtractionNotificationInfoMessage(DataExtractionNotificationInfoMessage.Kind.SCREENSHOT)
|
||||||
is DataExtractionNotification.Kind.MediaSaved -> DataExtractionNotificationInfoMessage(DataExtractionNotificationInfoMessage.Kind.MEDIASAVED)
|
is DataExtractionNotification.Kind.MediaSaved -> DataExtractionNotificationInfoMessage(DataExtractionNotificationInfoMessage.Kind.MEDIA_SAVED)
|
||||||
else -> return
|
else -> return
|
||||||
}
|
}
|
||||||
storage.insertDataExtractionNotificationMessage(senderPublicKey, notification, message.sentTimestamp!!)
|
storage.insertDataExtractionNotificationMessage(senderPublicKey, notification, message.sentTimestamp!!)
|
||||||
|
@ -4,7 +4,7 @@ class DataExtractionNotificationInfoMessage {
|
|||||||
|
|
||||||
enum class Kind {
|
enum class Kind {
|
||||||
SCREENSHOT,
|
SCREENSHOT,
|
||||||
MEDIASAVED
|
MEDIA_SAVED
|
||||||
}
|
}
|
||||||
|
|
||||||
var kind: Kind? = null
|
var kind: Kind? = null
|
||||||
|
@ -3,9 +3,9 @@ package org.session.libsession.messaging.utilities
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import org.session.libsession.R
|
import org.session.libsession.R
|
||||||
import org.session.libsession.messaging.MessagingConfiguration
|
import org.session.libsession.messaging.MessagingConfiguration
|
||||||
|
import org.session.libsession.messaging.sending_receiving.dataextraction.DataExtractionNotificationInfoMessage
|
||||||
import org.session.libsession.utilities.ExpirationUtil
|
import org.session.libsession.utilities.ExpirationUtil
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
import org.session.libsignal.service.api.messages.SignalServiceGroup
|
||||||
import org.session.libsignal.service.internal.push.SignalServiceProtos
|
|
||||||
|
|
||||||
object UpdateMessageBuilder {
|
object UpdateMessageBuilder {
|
||||||
|
|
||||||
@ -94,12 +94,12 @@ object UpdateMessageBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildDataExtractionMessage(context: Context, kind: SignalServiceProtos.DataExtractionNotification.Type, sender: String? = null): String {
|
fun buildDataExtractionMessage(context: Context, kind: DataExtractionNotificationInfoMessage.Kind, sender: String? = null): String {
|
||||||
val senderName = MessagingConfiguration.shared.storage.getDisplayNameForRecipient(sender!!) ?: sender
|
val senderName = MessagingConfiguration.shared.storage.getDisplayNameForRecipient(sender!!) ?: sender
|
||||||
return when (kind) {
|
return when (kind) {
|
||||||
SignalServiceProtos.DataExtractionNotification.Type.SCREENSHOT ->
|
DataExtractionNotificationInfoMessage.Kind.SCREENSHOT ->
|
||||||
context.getString(R.string.MessageRecord_s_took_a_screenshot, senderName)
|
context.getString(R.string.MessageRecord_s_took_a_screenshot, senderName)
|
||||||
SignalServiceProtos.DataExtractionNotification.Type.MEDIA_SAVED ->
|
DataExtractionNotificationInfoMessage.Kind.MEDIA_SAVED ->
|
||||||
context.getString(R.string.MessageRecord_media_saved_by_s, senderName)
|
context.getString(R.string.MessageRecord_media_saved_by_s, senderName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user