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

Unverified Commit 64e46e27 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #5936 from k9mail/notification_channel

Use account settings when creating the NotificationChannel for messages
parents 547a8738 f66f7e50
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -116,16 +116,15 @@ class NotificationChannelManager(
    @RequiresApi(api = Build.VERSION_CODES.O)
    private fun getChannelMessages(account: Account): NotificationChannel {
        val channelName = resourceProvider.messagesChannelName
        val channelDescription = resourceProvider.messagesChannelDescription
        val channelId = getChannelIdFor(account, ChannelType.MESSAGES)
        val importance = NotificationManager.IMPORTANCE_DEFAULT
        val channelGroupId = account.uuid

        val messagesChannel = NotificationChannel(channelId, channelName, importance)
        messagesChannel.description = channelDescription
        messagesChannel.group = channelGroupId
        return NotificationChannel(channelId, channelName, importance).apply {
            description = resourceProvider.messagesChannelDescription
            group = account.uuid

        return messagesChannel
            setPropertiesFrom(account)
        }
    }

    @RequiresApi(api = Build.VERSION_CODES.O)
@@ -189,7 +188,7 @@ class NotificationChannelManager(
            group = account.uuid

            copyPropertiesFrom(oldNotificationChannel)
            copyPropertiesFrom(account)
            setPropertiesFrom(account)
        }

        Timber.v("Recreating NotificationChannel(%s => %s)", oldChannelId, newChannelId)
@@ -226,7 +225,7 @@ class NotificationChannelManager(
    }

    @RequiresApi(Build.VERSION_CODES.O)
    private fun NotificationChannel.copyPropertiesFrom(account: Account) {
    private fun NotificationChannel.setPropertiesFrom(account: Account) {
        val notificationSettings = account.notificationSettings

        if (notificationSettings.isRingEnabled) {