mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-10 12:33:40 +00:00
fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic
This commit is contained in:
parent
621e564023
commit
0dff619aa9
@ -12,8 +12,11 @@ import androidx.core.app.NotificationManagerCompat;
|
|||||||
import com.annimon.stream.Collectors;
|
import com.annimon.stream.Collectors;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import org.session.libsession.database.StorageProtocol;
|
||||||
|
import org.session.libsession.messaging.MessagingModuleConfiguration;
|
||||||
import org.session.libsession.messaging.messages.control.ReadReceipt;
|
import org.session.libsession.messaging.messages.control.ReadReceipt;
|
||||||
import org.session.libsession.messaging.sending_receiving.MessageSender;
|
import org.session.libsession.messaging.sending_receiving.MessageSender;
|
||||||
|
import org.session.libsession.snode.SnodeAPI;
|
||||||
import org.session.libsession.utilities.Address;
|
import org.session.libsession.utilities.Address;
|
||||||
import org.session.libsession.utilities.TextSecurePreferences;
|
import org.session.libsession.utilities.TextSecurePreferences;
|
||||||
import org.session.libsession.utilities.recipients.Recipient;
|
import org.session.libsession.utilities.recipients.Recipient;
|
||||||
@ -26,7 +29,6 @@ import org.thoughtcrime.securesms.dependencies.DatabaseComponent;
|
|||||||
import org.thoughtcrime.securesms.service.ExpiringMessageManager;
|
import org.thoughtcrime.securesms.service.ExpiringMessageManager;
|
||||||
import org.thoughtcrime.securesms.util.SessionMetaProtocol;
|
import org.thoughtcrime.securesms.util.SessionMetaProtocol;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -51,18 +53,12 @@ public class MarkReadReceiver extends BroadcastReceiver {
|
|||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
List<MarkedMessageInfo> messageIdsCollection = new LinkedList<>();
|
long currentTime = SnodeAPI.getNowWithOffset();
|
||||||
|
|
||||||
for (long threadId : threadIds) {
|
for (long threadId : threadIds) {
|
||||||
Log.i(TAG, "Marking as read: " + threadId);
|
Log.i(TAG, "Marking as read: " + threadId);
|
||||||
List<MarkedMessageInfo> messageIds = DatabaseComponent.get(context).threadDatabase().setRead(threadId, true);
|
StorageProtocol storage = MessagingModuleConfiguration.getShared().getStorage();
|
||||||
messageIdsCollection.addAll(messageIds);
|
storage.markConversationAsRead(threadId,currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
process(context, messageIdsCollection);
|
|
||||||
|
|
||||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
@ -56,6 +56,7 @@ object SnodeAPI {
|
|||||||
*/
|
*/
|
||||||
internal var clockOffset = 0L
|
internal var clockOffset = 0L
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
val nowWithOffset
|
val nowWithOffset
|
||||||
get() = System.currentTimeMillis() + clockOffset
|
get() = System.currentTimeMillis() + clockOffset
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user