Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b5df5ad authored by cketti's avatar cketti
Browse files

Make sure operations in `NewMailNotificationController` are executed atomically

parent 627bcf85
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ internal class NewMailNotificationController(
    private val summaryNotificationCreator: SummaryNotificationCreator,
    private val singleMessageNotificationCreator: SingleMessageNotificationCreator
) {
    @Synchronized
    fun restoreNewMailNotifications(accounts: List<Account>) {
        for (account in accounts) {
            val notificationData = newMailNotificationManager.restoreNewMailNotifications(account)
@@ -24,6 +25,7 @@ internal class NewMailNotificationController(
        }
    }

    @Synchronized
    fun addNewMailNotification(account: Account, message: LocalMessage, silent: Boolean) {
        val notificationData = newMailNotificationManager.addNewMailNotification(account, message, silent)

@@ -32,6 +34,7 @@ internal class NewMailNotificationController(
        }
    }

    @Synchronized
    fun removeNewMailNotifications(
        account: Account,
        clearNewMessageState: Boolean,
@@ -48,6 +51,7 @@ internal class NewMailNotificationController(
        }
    }

    @Synchronized
    fun clearNewMailNotifications(account: Account, clearNewMessageState: Boolean) {
        val cancelNotificationIds = newMailNotificationManager.clearNewMailNotifications(account, clearNewMessageState)