Yokan / rebuild
Course 1 8624561

TestNotifications.kt

composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/services/notifications/TestNotifications.kt

test / fixture18 lines
1package eu.friedcutlet.yokan.services.notifications23internal object NoNotifications : NotificationService {4    override fun supported(): Boolean = false5    override fun notify(payload: NotificationPayload) = Unit6    override fun cancel(channel: NotificationChannel, tag: String?) = Unit7}89internal class RecordingNotifications : NotificationService {10    val posted = mutableListOf<NotificationPayload>()11    val cancelled = mutableListOf<Pair<NotificationChannel, String?>>()12    var permissionRequests = 01314    override fun supported() = true15    override fun requestPermission() { permissionRequests++ }16    override fun notify(payload: NotificationPayload) { posted += payload }17    override fun cancel(channel: NotificationChannel, tag: String?) { cancelled += channel to tag }18}19

Search chapters, reference and source filenames.