mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
Don't send read receipts in groups
This commit is contained in:
parent
c88d0f0520
commit
12a6bc724d
@ -1168,9 +1168,16 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
builder.setMessage(getString(R.string.ConversationActivity_are_you_sure_you_want_to_leave_this_group));
|
||||
builder.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||
Recipient groupRecipient = getRecipient();
|
||||
String groupPublicKey;
|
||||
boolean isSSKBasedClosedGroup;
|
||||
try {
|
||||
groupPublicKey = HexEncodingKt.toHexString(GroupUtil.getDecodedId(GroupUtil.getDecodedStringId(groupRecipient.getAddress().toString())));
|
||||
isSSKBasedClosedGroup = DatabaseFactory.getSSKDatabase(this).isSSKBasedClosedGroup(groupPublicKey);
|
||||
} catch (IOException e) {
|
||||
groupPublicKey = null;
|
||||
isSSKBasedClosedGroup = false;
|
||||
}
|
||||
try {
|
||||
String groupPublicKey = HexEncodingKt.toHexString(GroupUtil.getDecodedId(GroupUtil.getDecodedStringId(groupRecipient.getAddress().toString())));
|
||||
boolean isSSKBasedClosedGroup = DatabaseFactory.getSSKDatabase(this).isSSKBasedClosedGroup(groupPublicKey);
|
||||
if (isSSKBasedClosedGroup) {
|
||||
ClosedGroupsProtocol.leave(this, groupPublicKey);
|
||||
initializeEnabledCheck();
|
||||
@ -2238,13 +2245,20 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
|
||||
private void markThreadAsRead() {
|
||||
Recipient recipient = this.recipient;
|
||||
new AsyncTask<Long, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Long... params) {
|
||||
Context context = ConversationActivity.this;
|
||||
List<MarkedMessageInfo> messageIds = DatabaseFactory.getThreadDatabase(context).setRead(params[0], false);
|
||||
|
||||
if (!org.thoughtcrime.securesms.loki.protocol.SessionMetaProtocol.shouldSendReadReceipt(recipient.getAddress())) {
|
||||
for (MarkedMessageInfo messageInfo : messageIds) {
|
||||
MarkReadReceiver.scheduleDeletion(context, messageInfo.getExpirationInfo());
|
||||
}
|
||||
} else {
|
||||
MarkReadReceiver.process(context, messageIds);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||
Recipient recipients = DatabaseFactory.getThreadDatabase(context)
|
||||
.getRecipientForThreadId(threadId);
|
||||
|
||||
if (isVisible) {
|
||||
if (isVisible && recipients != null && SessionMetaProtocol.shouldSendReadReceipt(recipients.getAddress())) {
|
||||
List<MarkedMessageInfo> messageIds = threads.setRead(threadId, false);
|
||||
MarkReadReceiver.process(context, messageIds);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class MarkReadReceiver extends BroadcastReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
private static void scheduleDeletion(Context context, ExpirationInfo expirationInfo) {
|
||||
public static void scheduleDeletion(Context context, ExpirationInfo expirationInfo) {
|
||||
if (expirationInfo.getExpiresIn() > 0 && expirationInfo.getExpireStarted() <= 0) {
|
||||
ExpiringMessageManager expirationManager = ApplicationContext.getInstance(context).getExpiringMessageManager();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user