mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-21 22:11:38 +00:00
Merge branch 'dev' into onion-requests-2
This commit is contained in:
commit
4c81f4f197
@ -50,13 +50,16 @@ class BackgroundPollJob private constructor(parameters: Parameters) : BaseJob(pa
|
|||||||
Log.d("Loki", "Performing background poll.")
|
Log.d("Loki", "Performing background poll.")
|
||||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context)
|
val userPublicKey = TextSecurePreferences.getLocalNumber(context)
|
||||||
val promises = mutableListOf<Promise<Unit, Exception>>()
|
val promises = mutableListOf<Promise<Unit, Exception>>()
|
||||||
val promise = SnodeAPI.shared.getMessages(userPublicKey).map { envelopes ->
|
if (!TextSecurePreferences.isUsingFCM(context)) {
|
||||||
envelopes.forEach {
|
Log.d("Loki", "Not using FCM; polling for contacts and closed groups.")
|
||||||
PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it), false)
|
val promise = SnodeAPI.shared.getMessages(userPublicKey).map { envelopes ->
|
||||||
|
envelopes.forEach {
|
||||||
|
PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it), false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
promises.add(promise)
|
||||||
|
promises.addAll(ClosedGroupPoller.shared.pollOnce())
|
||||||
}
|
}
|
||||||
promises.add(promise)
|
|
||||||
promises.addAll(ClosedGroupPoller.shared.pollOnce())
|
|
||||||
val openGroups = DatabaseFactory.getLokiThreadDatabase(context).getAllPublicChats().map { it.value }
|
val openGroups = DatabaseFactory.getLokiThreadDatabase(context).getAllPublicChats().map { it.value }
|
||||||
for (openGroup in openGroups) {
|
for (openGroup in openGroups) {
|
||||||
val poller = PublicChatPoller(context, openGroup)
|
val poller = PublicChatPoller(context, openGroup)
|
||||||
|
@ -24,8 +24,8 @@ class PublicChatManager(private val context: Context) {
|
|||||||
var areAllCaughtUp = true
|
var areAllCaughtUp = true
|
||||||
refreshChatsAndPollers()
|
refreshChatsAndPollers()
|
||||||
for ((threadID, chat) in chats) {
|
for ((threadID, chat) in chats) {
|
||||||
val poller = pollers[threadID] ?: PublicChatPoller(context, chat)
|
val poller = pollers[threadID]
|
||||||
areAllCaughtUp = areAllCaughtUp && poller.isCaughtUp
|
areAllCaughtUp = if (poller != null) areAllCaughtUp && poller.isCaughtUp else true
|
||||||
}
|
}
|
||||||
return areAllCaughtUp
|
return areAllCaughtUp
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user