This commit is contained in:
Niels Andriesse 2019-08-19 16:33:56 +10:00
parent ae54c641a9
commit feb6cfdecb

View File

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.loki
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import nl.komponents.kovenant.functional.map
import org.thoughtcrime.securesms.database.DatabaseFactory import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.jobs.PushContentReceiveJob import org.thoughtcrime.securesms.jobs.PushContentReceiveJob
import org.thoughtcrime.securesms.service.PersistentAlarmManagerListener import org.thoughtcrime.securesms.service.PersistentAlarmManagerListener
@ -30,8 +31,10 @@ class BackgroundPollWorker : PersistentAlarmManagerListener() {
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context) val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context)
val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context) val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context)
try { try {
LokiAPI(userHexEncodedPublicKey, lokiAPIDatabase).getMessages().get().forEach { LokiAPI(userHexEncodedPublicKey, lokiAPIDatabase).getMessages().map { messages ->
PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it)) messages.forEach {
PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it))
}
} }
} catch (exception: Throwable) { } catch (exception: Throwable) {
// Do nothing // Do nothing