discard Tray Notifications
Discards a specific tray notification.
This marks the notification as read or dismissed on the backend.
Return
The TrayNotification that was discarded.
Parameters
notification Id
The unique identifier of the notification to discard.
Throws
if the request fails.
Android (Kotlin)
fun onNotificationDismissed(notificationId: String) {
lifecycleScope.launch {
try {
val discardedNotification = AFCore.userInterface().discardTrayNotifications(notificationId)
// Optionally, update UI to remove the notification locally
trayAdapter.remove(discardedNotification)
showMessage("Notification dismissed")
} catch (t: Throwable) {
showError("Failed to dismiss notification: ${t.message}")
}
}
}Content copied to clipboard
iOS (Swift)
func onNotificationDismissed(notificationId: String) {
Task {
do {
let discardedNotification = try await AFCore.shared.userInterface().discardTrayNotifications(notificationId: notificationId)
// Optionally, update UI to remove the notification locally
self.removeNotificationFromTray(discardedNotification)
self.showMessage("Notification dismissed")
} catch {
self.showError("Failed to dismiss notification: \(error.localizedDescription)")
}
}
}Content copied to clipboard