Search in sources :

Example 6 with ExpiringMessageManager

use of org.thoughtcrime.securesms.service.ExpiringMessageManager in project Signal-Android by WhisperSystems.

the class MessageSender method sendTextSelf.

private static void sendTextSelf(Context context, long messageId, long expiresIn) {
    EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
    database.markAsSent(messageId, true);
    Pair<Long, Long> messageAndThreadId = database.copyMessageInbox(messageId);
    database.markAsPush(messageAndThreadId.first);
    if (expiresIn > 0) {
        ExpiringMessageManager expiringMessageManager = ApplicationContext.getInstance(context).getExpiringMessageManager();
        database.markExpireStarted(messageId);
        expiringMessageManager.scheduleDeletion(messageId, false, expiresIn);
    }
}
Also used : EncryptingSmsDatabase(org.thoughtcrime.securesms.database.EncryptingSmsDatabase) ExpiringMessageManager(org.thoughtcrime.securesms.service.ExpiringMessageManager)

Aggregations

ExpiringMessageManager (org.thoughtcrime.securesms.service.ExpiringMessageManager)6 EncryptingSmsDatabase (org.thoughtcrime.securesms.database.EncryptingSmsDatabase)2 MmsDatabase (org.thoughtcrime.securesms.database.MmsDatabase)2 Recipients (org.thoughtcrime.securesms.recipients.Recipients)2 InsecureFallbackApprovalException (org.thoughtcrime.securesms.transport.InsecureFallbackApprovalException)2 UntrustedIdentityException (org.whispersystems.signalservice.api.crypto.UntrustedIdentityException)2 AsyncTask (android.os.AsyncTask)1 SmsMessageRecord (org.thoughtcrime.securesms.database.model.SmsMessageRecord)1 OutgoingMediaMessage (org.thoughtcrime.securesms.mms.OutgoingMediaMessage)1