コード例 #1
0
  private void handleMsgRecv(UnreadEntity entity) {
    logger.d("notification#recv unhandled message");
    int peerId = entity.getPeerId();
    int sessionType = entity.getSessionType();
    logger.d("notification#msg no one handled, peerId:%d, sessionType:%d", peerId, sessionType);

    // 判断是否设定了免打扰
    if (entity.isForbidden()) {
      logger.d("notification#GROUP_STATUS_SHIELD");
      return;
    }

    // PC端是否登陆 取消 【暂时先关闭】
    //        if(IMLoginManager.instance().isPcOnline()){
    //            logger.d("notification#isPcOnline");
    //            return;
    //        }

    // 全局开关
    boolean globallyOnOff =
        configurationSp.getCfg(
            SysConstant.SETTING_GLOBAL, ConfigurationSp.CfgDimension.NOTIFICATION);
    if (globallyOnOff) {
      logger.d("notification#shouldGloballyShowNotification is false, return");
      return;
    }

    // 单独的设置
    boolean singleOnOff =
        configurationSp.getCfg(entity.getSessionKey(), ConfigurationSp.CfgDimension.NOTIFICATION);
    if (singleOnOff) {
      logger.d("notification#shouldShowNotificationBySession is false, return");
      return;
    }

    // if the message is a multi login message which send from another terminal,not need notificate
    // to status bar
    // 判断是否是自己的消息
    if (IMLoginManager.instance().getLoginId() != peerId) {
      showNotification(entity);
    }
  }