public void onNewMessage(Peer peer,int sender,long date,ContentDescription description,boolean hasCurrentUserMention,int messagesCount,int dialogsCount){
  if (date <= getLastReadDate(peer)) {
    return;
  }
  boolean isEnabled=isNotificationsEnabled(peer,hasCurrentUserMention);
  if (isEnabled) {
    List<PendingNotification> pendingNotifications=getNotifications();
    PendingNotification pendingNotification=new PendingNotification(peer,sender,date,description);
    pendingNotifications.add(pendingNotification);
    pendingStorage.setMessagesCount(messagesCount);
    pendingStorage.setDialogsCount(dialogsCount);
    allPendingNotifications.add(pendingNotification);
    saveStorage();
  }
  if (isNotificationsPaused) {
    if (!notificationsDuringPause.containsKey(peer)) {
      notificationsDuringPause.put(peer,hasCurrentUserMention);
    }
 else {
      if (hasCurrentUserMention && !notificationsDuringPause.get(peer)) {
        notificationsDuringPause.put(peer,true);
      }
    }
    return;
  }
  if (isAppVisible) {
    if (visiblePeer != null && visiblePeer.equals(peer)) {
      if (isMobilePlatform) {
        playEffectIfEnabled();
      }
 else {
      }
    }
 else {
      if (isMobilePlatform) {
      }
 else {
        if (isEnabled) {
          playEffectIfEnabled();
        }
      }
    }
  }
 else {
    if (isEnabled) {
      showNotification();
    }
  }
}

public void onNewMessage ( Peer peer , int sender , long date , ContentDescription description , boolean hasCurrentUserMention , int messagesCount , int dialogsCount ) { if ( date <= getLastReadDate ( peer ) ) { return ; } boolean isEnabled = isNotificationsEnabled ( peer , hasCurrentUserMention ) ; if ( isEnabled ) { List < PendingNotification > pendingNotifications = getNotifications ( ) ; PendingNotification pendingNotification = new PendingNotification ( peer , sender , date , description ) ; pendingNotifications . add ( pendingNotification ) ; pendingStorage . setMessagesCount ( messagesCount ) ; pendingStorage . setDialogsCount ( dialogsCount ) ; allPendingNotifications . add ( pendingNotification ) ; saveStorage ( ) ; } if ( isNotificationsPaused ) { if ( ! notificationsDuringPause . containsKey ( peer ) ) { notificationsDuringPause . put ( peer , hasCurrentUserMention ) ; } else { if ( hasCurrentUserMention && ! notificationsDuringPause . get ( peer ) ) { notificationsDuringPause . put ( peer , true ) ; } } return ; } if ( isAppVisible ) { if ( visiblePeer != null && visiblePeer . equals ( peer ) ) { if ( isMobilePlatform ) { playEffectIfEnabled ( ) ; } else { } } else { if ( isMobilePlatform ) { } else { if ( isEnabled ) { playEffectIfEnabled ( ) ; } } } } else { if ( isEnabled ) { showNotification ( ) ; } } }
handling event about incoming notification
