markPushNotificationDelivered static method
Future<void>
markPushNotificationDelivered(
- PushNotification pushNotification, {
- required dynamic onSuccess(
- void result
- required dynamic onError(
- CometChatException excep
Marks a push notification as delivered.
Android Reference: CometChat.markPushNotificationDelivered(PushNotification)
This operation is idempotent — calling multiple times has no side effects. The PushNotification object is provided by the CometChat Push Notification SDK (not constructed by the Chat SDK).
@param pushNotification The PushNotification to mark as delivered. @param onSuccess Callback invoked on successful delivery marking. @param onError Callback invoked if an error occurs.
Implementation
static Future<void> markPushNotificationDelivered(
PushNotification pushNotification,
{required Function(void result)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
final sdk = SdkRegistry.getInstance();
await sdk.notificationFeed.markPushDelivered(pushNotification.id);
if (onSuccess != null) onSuccess(null);
} on SdkException catch (sdkEx) {
final cometChatEx = CometChatException(
sdkEx.code,
sdkEx.details ?? sdkEx.message,
sdkEx.message,
);
_errorCallbackHandler(cometChatEx, null, null, onError);
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
}
}