Loading app/core/src/main/java/com/fsck/k9/Account.kt +0 −5 Original line number Diff line number Diff line Loading @@ -490,11 +490,6 @@ class Account(override val uuid: String) : BaseAccount { (oldSyncMode != FolderMode.NONE && syncMode == FolderMode.NONE) } @Synchronized fun incrementMessagesNotificationChannelVersion() { messagesNotificationChannelVersion++ } @Synchronized fun isSortAscending(sortType: SortType): Boolean { return sortAscending.getOrPut(sortType) { sortType.isDefaultAscending } Loading app/core/src/main/java/com/fsck/k9/notification/NotificationChannelManager.kt +12 −6 Original line number Diff line number Diff line Loading @@ -144,12 +144,16 @@ class NotificationChannelManager( fun getChannelIdFor(account: Account, channelType: ChannelType): String { return if (channelType == ChannelType.MESSAGES) { "messages_channel_${account.uuid}${account.messagesNotificationChannelSuffix}" getMessagesChannelId(account, account.messagesNotificationChannelSuffix) } else { "miscellaneous_channel_${account.uuid}" } } private fun getMessagesChannelId(account: Account, suffix: String): String { return "messages_channel_${account.uuid}$suffix" } @RequiresApi(Build.VERSION_CODES.O) fun getNotificationConfiguration(account: Account): NotificationConfiguration { val channelId = getChannelIdFor(account, ChannelType.MESSAGES) Loading @@ -175,11 +179,8 @@ class NotificationChannelManager( return } notificationManager.deleteNotificationChannel(oldChannelId) account.incrementMessagesNotificationChannelVersion() val newChannelId = getChannelIdFor(account, ChannelType.MESSAGES) val newChannelVersion = account.messagesNotificationChannelVersion + 1 val newChannelId = getMessagesChannelId(account, "_$newChannelVersion") val channelName = resourceProvider.messagesChannelName val importance = oldNotificationChannel.importance Loading @@ -195,6 +196,11 @@ class NotificationChannelManager( Timber.v("Old NotificationChannel: %s", oldNotificationChannel) Timber.v("New NotificationChannel: %s", newNotificationChannel) notificationManager.createNotificationChannel(newNotificationChannel) // To avoid a race condition we first create the new NotificationChannel, point the Account to it, // then delete the old one. account.messagesNotificationChannelVersion = newChannelVersion notificationManager.deleteNotificationChannel(oldChannelId) } @RequiresApi(Build.VERSION_CODES.O) Loading Loading
app/core/src/main/java/com/fsck/k9/Account.kt +0 −5 Original line number Diff line number Diff line Loading @@ -490,11 +490,6 @@ class Account(override val uuid: String) : BaseAccount { (oldSyncMode != FolderMode.NONE && syncMode == FolderMode.NONE) } @Synchronized fun incrementMessagesNotificationChannelVersion() { messagesNotificationChannelVersion++ } @Synchronized fun isSortAscending(sortType: SortType): Boolean { return sortAscending.getOrPut(sortType) { sortType.isDefaultAscending } Loading
app/core/src/main/java/com/fsck/k9/notification/NotificationChannelManager.kt +12 −6 Original line number Diff line number Diff line Loading @@ -144,12 +144,16 @@ class NotificationChannelManager( fun getChannelIdFor(account: Account, channelType: ChannelType): String { return if (channelType == ChannelType.MESSAGES) { "messages_channel_${account.uuid}${account.messagesNotificationChannelSuffix}" getMessagesChannelId(account, account.messagesNotificationChannelSuffix) } else { "miscellaneous_channel_${account.uuid}" } } private fun getMessagesChannelId(account: Account, suffix: String): String { return "messages_channel_${account.uuid}$suffix" } @RequiresApi(Build.VERSION_CODES.O) fun getNotificationConfiguration(account: Account): NotificationConfiguration { val channelId = getChannelIdFor(account, ChannelType.MESSAGES) Loading @@ -175,11 +179,8 @@ class NotificationChannelManager( return } notificationManager.deleteNotificationChannel(oldChannelId) account.incrementMessagesNotificationChannelVersion() val newChannelId = getChannelIdFor(account, ChannelType.MESSAGES) val newChannelVersion = account.messagesNotificationChannelVersion + 1 val newChannelId = getMessagesChannelId(account, "_$newChannelVersion") val channelName = resourceProvider.messagesChannelName val importance = oldNotificationChannel.importance Loading @@ -195,6 +196,11 @@ class NotificationChannelManager( Timber.v("Old NotificationChannel: %s", oldNotificationChannel) Timber.v("New NotificationChannel: %s", newNotificationChannel) notificationManager.createNotificationChannel(newNotificationChannel) // To avoid a race condition we first create the new NotificationChannel, point the Account to it, // then delete the old one. account.messagesNotificationChannelVersion = newChannelVersion notificationManager.deleteNotificationChannel(oldChannelId) } @RequiresApi(Build.VERSION_CODES.O) Loading