kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix notification issues introduced when adding lower API versions.
rodzic
ac71c02dfa
commit
751afadebd
|
@ -30,7 +30,6 @@ import org.thoughtcrime.securesms.util.ServiceUtil
|
|||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.webrtc.CallNotificationBuilder
|
||||
import org.whispersystems.signalservice.internal.util.Util
|
||||
import java.lang.UnsupportedOperationException
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.Executor
|
||||
import java.util.concurrent.Executors
|
||||
|
@ -167,6 +166,7 @@ class MessageNotifierV2(context: Application) : MessageNotifier {
|
|||
targetThreadId = threadId,
|
||||
defaultBubbleState = defaultBubbleState,
|
||||
lastAudibleNotification = lastAudibleNotification,
|
||||
notificationConfigurationChanged = notificationConfigurationChanged,
|
||||
alertOverrides = alertOverrides
|
||||
)
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ object NotificationFactory {
|
|||
targetThreadId: Long,
|
||||
defaultBubbleState: BubbleUtil.BubbleState,
|
||||
lastAudibleNotification: Long,
|
||||
notificationConfigurationChanged: Boolean,
|
||||
alertOverrides: Set<Long>
|
||||
): Set<Long> {
|
||||
if (state.isEmpty) {
|
||||
|
@ -72,6 +73,7 @@ object NotificationFactory {
|
|||
targetThreadId = targetThreadId,
|
||||
defaultBubbleState = defaultBubbleState,
|
||||
lastAudibleNotification = lastAudibleNotification,
|
||||
notificationConfigurationChanged = notificationConfigurationChanged,
|
||||
alertOverrides = alertOverrides,
|
||||
nonVisibleThreadCount = nonVisibleThreadCount
|
||||
)
|
||||
|
@ -127,6 +129,7 @@ object NotificationFactory {
|
|||
targetThreadId: Long,
|
||||
defaultBubbleState: BubbleUtil.BubbleState,
|
||||
lastAudibleNotification: Long,
|
||||
notificationConfigurationChanged: Boolean,
|
||||
alertOverrides: Set<Long>,
|
||||
nonVisibleThreadCount: Int
|
||||
): Set<Long> {
|
||||
|
@ -136,7 +139,7 @@ object NotificationFactory {
|
|||
if (conversation.threadId == visibleThreadId && conversation.hasNewNotifications()) {
|
||||
Log.internal().i(TAG, "Thread is visible, notifying in thread. notificationId: ${conversation.notificationId}")
|
||||
notifyInThread(context, conversation.recipient, lastAudibleNotification)
|
||||
} else {
|
||||
} else if (notificationConfigurationChanged || conversation.hasNewNotifications() || alertOverrides.contains(conversation.threadId)) {
|
||||
if (conversation.hasNewNotifications()) {
|
||||
threadsThatNewlyAlerted += conversation.threadId
|
||||
}
|
||||
|
@ -165,6 +168,10 @@ object NotificationFactory {
|
|||
defaultBubbleState: BubbleUtil.BubbleState,
|
||||
shouldAlert: Boolean
|
||||
) {
|
||||
if (conversation.notificationItems.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
val builder: NotificationBuilder = NotificationBuilder.create(context)
|
||||
|
||||
builder.apply {
|
||||
|
@ -205,6 +212,10 @@ object NotificationFactory {
|
|||
}
|
||||
|
||||
private fun notifySummary(context: Context, state: NotificationStateV2) {
|
||||
if (state.messageCount == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
val builder: NotificationBuilder = NotificationBuilder.create(context)
|
||||
|
||||
builder.apply {
|
||||
|
|
Ładowanie…
Reference in New Issue