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

Commit dbd1c254 authored by Oji Ofong's avatar Oji Ofong
Browse files

Update channels in the background thread

parent a1b3cc8f
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import android.os.Build
import android.support.annotation.RequiresApi
import com.fsck.k9.Account
import com.fsck.k9.Preferences
import java.util.concurrent.Executors

class NotificationChannelUtils(private val context: Context, private val preferences: Preferences) {

@@ -21,12 +22,14 @@ class NotificationChannelUtils(private val context: Context, private val prefere
            return
        }

        Executors.newSingleThreadExecutor().execute {
            val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE)
                    as NotificationManager
            val accounts = preferences.accounts

            removeChannelsForNonExistingOrChangedAccounts(notificationManager, accounts)
            addChannelsForAccounts(notificationManager, accounts)
        }

    }