kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix notification schedule bug.
rodzic
93270b90df
commit
b9ba1a3568
|
@ -10,11 +10,9 @@ import android.os.Build
|
||||||
import android.service.notification.StatusBarNotification
|
import android.service.notification.StatusBarNotification
|
||||||
import androidx.appcompat.view.ContextThemeWrapper
|
import androidx.appcompat.view.ContextThemeWrapper
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import io.reactivex.rxjava3.kotlin.subscribeBy
|
|
||||||
import me.leolin.shortcutbadger.ShortcutBadger
|
import me.leolin.shortcutbadger.ShortcutBadger
|
||||||
import org.signal.core.util.logging.Log
|
import org.signal.core.util.logging.Log
|
||||||
import org.thoughtcrime.securesms.R
|
import org.thoughtcrime.securesms.R
|
||||||
import org.thoughtcrime.securesms.components.settings.app.notifications.profiles.NotificationProfilesRepository
|
|
||||||
import org.thoughtcrime.securesms.database.MessageDatabase
|
import org.thoughtcrime.securesms.database.MessageDatabase
|
||||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||||
|
@ -52,24 +50,12 @@ class MessageNotifierV2(context: Application) : MessageNotifier {
|
||||||
@Volatile private var previousLockedStatus: Boolean = KeyCachingService.isLocked(context)
|
@Volatile private var previousLockedStatus: Boolean = KeyCachingService.isLocked(context)
|
||||||
@Volatile private var previousPrivacyPreference: NotificationPrivacyPreference = SignalStore.settings().messageNotificationsPrivacy
|
@Volatile private var previousPrivacyPreference: NotificationPrivacyPreference = SignalStore.settings().messageNotificationsPrivacy
|
||||||
@Volatile private var previousState: NotificationStateV2 = NotificationStateV2.EMPTY
|
@Volatile private var previousState: NotificationStateV2 = NotificationStateV2.EMPTY
|
||||||
@Volatile private var notificationProfile: NotificationProfile? = null
|
|
||||||
@Volatile private var notificationProfileInitialized: Boolean = false
|
|
||||||
|
|
||||||
private val threadReminders: MutableMap<Long, Reminder> = ConcurrentHashMap()
|
private val threadReminders: MutableMap<Long, Reminder> = ConcurrentHashMap()
|
||||||
private val stickyThreads: MutableMap<Long, StickyThread> = mutableMapOf()
|
private val stickyThreads: MutableMap<Long, StickyThread> = mutableMapOf()
|
||||||
|
|
||||||
private val executor = CancelableExecutor()
|
private val executor = CancelableExecutor()
|
||||||
|
|
||||||
init {
|
|
||||||
NotificationProfilesRepository().getProfiles()
|
|
||||||
.subscribeBy(
|
|
||||||
onNext = {
|
|
||||||
notificationProfile = NotificationProfiles.getActiveProfile(it)
|
|
||||||
notificationProfileInitialized = true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setVisibleThread(threadId: Long) {
|
override fun setVisibleThread(threadId: Long) {
|
||||||
visibleThread = threadId
|
visibleThread = threadId
|
||||||
stickyThreads.remove(threadId)
|
stickyThreads.remove(threadId)
|
||||||
|
@ -141,12 +127,9 @@ class MessageNotifierV2(context: Application) : MessageNotifier {
|
||||||
stickyThreads.clear()
|
stickyThreads.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!notificationProfileInitialized) {
|
val notificationProfile: NotificationProfile? = NotificationProfiles.getActiveProfile(SignalDatabase.notificationProfiles.getProfiles())
|
||||||
notificationProfile = NotificationProfiles.getActiveProfile(SignalDatabase.notificationProfiles.getProfiles())
|
|
||||||
notificationProfileInitialized = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.internal().i(TAG, "sticky thread: $stickyThreads")
|
Log.internal().i(TAG, "sticky thread: $stickyThreads active profile: ${notificationProfile?.id ?: "none" }")
|
||||||
var state: NotificationStateV2 = NotificationStateProvider.constructNotificationState(stickyThreads, notificationProfile)
|
var state: NotificationStateV2 = NotificationStateProvider.constructNotificationState(stickyThreads, notificationProfile)
|
||||||
Log.internal().i(TAG, "state: $state")
|
Log.internal().i(TAG, "state: $state")
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue