mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 15:24:54 +00:00
Merge branch 'fix-notification-spam' into dev
This commit is contained in:
@@ -78,7 +78,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
||||
val threadID = archivedConversations.getLong(archivedConversations.getColumnIndex(ThreadDatabase.ID))
|
||||
AsyncTask.execute {
|
||||
threadDatabase.deleteConversation(threadID)
|
||||
MessageNotifier.updateNotification(this)
|
||||
(applicationContext as ApplicationContext).messageNotifier.updateNotification(this)
|
||||
}
|
||||
}
|
||||
deleteThreadAtCurrentPosition()
|
||||
@@ -314,7 +314,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
||||
ApplicationContext.getInstance(activity).lokiPublicChatAPI!!.leave(publicChat.channel, publicChat.server)
|
||||
}
|
||||
threadDatabase.deleteConversation(threadID)
|
||||
MessageNotifier.updateNotification(activity)
|
||||
ApplicationContext.getInstance(activity).messageNotifier.updateNotification(activity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,24 @@ class LokiPublicChatManager(private val context: Context) {
|
||||
private val observers = mutableMapOf<Long, ContentObserver>()
|
||||
private var isPolling = false
|
||||
|
||||
public fun areAllCaughtUp():Boolean {
|
||||
var areAllCaughtUp = true
|
||||
refreshChatsAndPollers()
|
||||
for ((threadID, chat) in chats) {
|
||||
val poller = pollers[threadID] ?: LokiPublicChatPoller(context, chat)
|
||||
areAllCaughtUp = areAllCaughtUp && poller.isCaughtUp
|
||||
}
|
||||
return areAllCaughtUp
|
||||
}
|
||||
|
||||
public fun markAllAsNotCaughtUp() {
|
||||
refreshChatsAndPollers()
|
||||
for ((threadID, chat) in chats) {
|
||||
val poller = pollers[threadID] ?: LokiPublicChatPoller(context, chat)
|
||||
poller.isCaughtUp = false
|
||||
}
|
||||
}
|
||||
|
||||
public fun startPollersIfNeeded() {
|
||||
refreshChatsAndPollers()
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.util.*
|
||||
class LokiPublicChatPoller(private val context: Context, private val group: LokiPublicChat) {
|
||||
private val handler = Handler()
|
||||
private var hasStarted = false
|
||||
public var isCaughtUp = false
|
||||
|
||||
// region Convenience
|
||||
private val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context)
|
||||
@@ -249,6 +250,7 @@ class LokiPublicChatPoller(private val context: Context, private val group: Loki
|
||||
processIncomingMessage(message)
|
||||
}
|
||||
}
|
||||
isCaughtUp = true
|
||||
}.fail {
|
||||
Log.d("Loki", "Failed to get messages for group chat with ID: ${group.channel} on server: ${group.server}.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user