Yokan / rebuild
Course 1 8624561

NotificationService.desktop.kt

composeApp/src/desktopMain/kotlin/eu/friedcutlet/yokan/services/notifications/NotificationService.desktop.kt

implementation21 lines
1package eu.friedcutlet.yokan.services.notifications23import eu.friedcutlet.yokan.domain.ProfileId45actual fun createPlatformNotificationService(profileId: ProfileId): NotificationService = DesktopNotificationService(profileId)67/**8 * Desktop notifications render as in-app snackbars rather than OS system-tray9 * balloons. The AWT `TrayIcon.displayMessage` path produced stale/duplicate10 * popups on Linux, so everything now flows through [InAppNotifications] and is11 * shown by the root composable's SnackbarHost.12 */13private class DesktopNotificationService(private val profileId: ProfileId) : NotificationService {14    override fun supported(): Boolean = true1516    override fun notify(payload: NotificationPayload) {17        InAppNotifications.post(payload.copy(profileId = profileId))18    }1920    override fun cancel(channel: NotificationChannel, tag: String?) = Unit21}22

Search chapters, reference and source filenames.