use of org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo in project Signal-Android by WhisperSystems.
the class ThreadDatabase method setRead.
public List<MarkedMessageInfo> setRead(long threadId, boolean lastSeen) {
ContentValues contentValues = new ContentValues(1);
contentValues.put(READ, 1);
if (lastSeen) {
contentValues.put(LAST_SEEN, System.currentTimeMillis());
}
SQLiteDatabase db = databaseHelper.getWritableDatabase();
db.update(TABLE_NAME, contentValues, ID_WHERE, new String[] { threadId + "" });
final List<MarkedMessageInfo> smsRecords = DatabaseFactory.getSmsDatabase(context).setMessagesRead(threadId);
final List<MarkedMessageInfo> mmsRecords = DatabaseFactory.getMmsDatabase(context).setMessagesRead(threadId);
notifyConversationListListeners();
return new LinkedList<MarkedMessageInfo>() {
{
addAll(smsRecords);
addAll(mmsRecords);
}
};
}
use of org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo in project Signal-Android by WhisperSystems.
the class MarkReadReceiver method process.
public static void process(@NonNull Context context, @NonNull List<MarkedMessageInfo> markedReadMessages) {
if (markedReadMessages.isEmpty())
return;
List<SyncMessageId> syncMessageIds = new LinkedList<>();
for (MarkedMessageInfo messageInfo : markedReadMessages) {
scheduleDeletion(context, messageInfo.getExpirationInfo());
syncMessageIds.add(messageInfo.getSyncMessageId());
}
ApplicationContext.getInstance(context).getJobManager().add(new MultiDeviceReadUpdateJob(context, syncMessageIds));
}
use of org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo in project Signal-Android by WhisperSystems.
the class MessageNotifier method updateNotification.
public static void updateNotification(@NonNull Context context, @Nullable MasterSecret masterSecret, long threadId, boolean signal) {
boolean isVisible = visibleThread == threadId;
ThreadDatabase threads = DatabaseFactory.getThreadDatabase(context);
Recipients recipients = DatabaseFactory.getThreadDatabase(context).getRecipientsForThreadId(threadId);
if (isVisible) {
List<MarkedMessageInfo> messageIds = threads.setRead(threadId, false);
MarkReadReceiver.process(context, messageIds);
}
if (!TextSecurePreferences.isNotificationsEnabled(context) || (recipients != null && recipients.isMuted())) {
return;
}
if (isVisible) {
sendInThreadNotification(context, threads.getRecipientsForThreadId(threadId));
} else {
updateNotification(context, masterSecret, signal, 0);
}
}
Aggregations