use of com.azure.android.communication.chat.models.ChatEventType in project azure-sdk-for-android by Azure.
the class PushNotificationClient method handlePushNotification.
/**
* Handle incoming push notification.
* Invoke corresponding chat event handle if registered.
* @param pushNotification Incoming push notification payload from the FCM SDK.
*
* @return True if there's handler(s) for incoming push notification; otherwise, false.
*/
public boolean handlePushNotification(ChatPushNotification pushNotification) {
this.logger.info(" Receive handle push notification request.");
ChatEventType chatEventType = this.parsePushNotificationEventType(pushNotification);
this.logger.info(" " + chatEventType + " received.");
if (this.pushNotificationListeners.containsKey(chatEventType)) {
ChatEvent event = this.parsePushNotificationEvent(chatEventType, pushNotification);
Set<Consumer<ChatEvent>> callbacks = this.pushNotificationListeners.get(chatEventType);
for (Consumer<ChatEvent> callback : callbacks) {
this.logger.info(" invoke callback " + callback + " for " + chatEventType);
callback.accept(event);
}
return true;
}
return false;
}
Aggregations