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.Intent
import nl.komponents.kovenant.functional.map
import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.jobs.PushContentReceiveJob
import org.thoughtcrime.securesms.service.PersistentAlarmManagerListener
@ -30,9 +31,11 @@ class BackgroundPollWorker : PersistentAlarmManagerListener() {
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context)
val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context)
try {
LokiAPI(userHexEncodedPublicKey, lokiAPIDatabase).getMessages().get().forEach {
LokiAPI(userHexEncodedPublicKey, lokiAPIDatabase).getMessages().map { messages ->
messages.forEach {
PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it))
}
}
} catch (exception: Throwable) {
// Do nothing
}