添加voip免打扰开关
This commit is contained in:
@@ -121,6 +121,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
private volatile long lastUpdateSensitiveTime = 0;
|
||||
|
||||
private ConcurrentHashMap<String, Boolean> userGlobalSlientMap = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<String, Boolean> userVoipSlientMap = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<String, Boolean> userPushHiddenDetail = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<String, Boolean> userConvSlientMap = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -3378,6 +3379,8 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
userConvSlientMap.remove(key);
|
||||
} else if(request.getScope() == UserSettingScope.kUserSettingGlobalSilent) {
|
||||
userGlobalSlientMap.remove(userId);
|
||||
} else if(request.getScope() == UserSettingScope.kUserSettingVoipSilent) {
|
||||
userVoipSlientMap.remove(userId);
|
||||
} else if(request.getScope() == UserSettingScope.kUserSettingHiddenNotificationDetail) {
|
||||
userPushHiddenDetail.remove(userId);
|
||||
}
|
||||
@@ -3408,6 +3411,21 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
return slient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getUserVoipSilent(String userId) {
|
||||
Boolean slient = userVoipSlientMap.get(userId);
|
||||
if (slient == null) {
|
||||
WFCMessage.UserSettingEntry entry = getUserSetting(userId, UserSettingScope.kUserSettingVoipSilent, null);
|
||||
if (entry == null || !entry.getValue().equals("1")) {
|
||||
slient = false;
|
||||
} else {
|
||||
slient = true;
|
||||
}
|
||||
userVoipSlientMap.put(userId, slient);
|
||||
}
|
||||
return slient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getUserPushHiddenDetail(String userId) {
|
||||
Boolean hidden = userPushHiddenDetail.get(userId);
|
||||
|
||||
@@ -195,6 +195,7 @@ public interface IMessagesStore {
|
||||
long updateUserSettings(String userId, WFCMessage.ModifyUserSettingReq request, String clientId);
|
||||
void clearUserSettings(String userId);
|
||||
boolean getUserGlobalSilent(String userId);
|
||||
boolean getUserVoipSilent(String userId);
|
||||
|
||||
boolean getUserPushHiddenDetail(String userId);
|
||||
boolean getUserConversationSilent(String userId, WFCMessage.Conversation conversation);
|
||||
|
||||
@@ -253,12 +253,18 @@ public class MessagesPublisher {
|
||||
}
|
||||
|
||||
boolean isSilent;
|
||||
boolean isVoipSilent;
|
||||
boolean isNoDisturb;
|
||||
boolean isConvSilent = false;
|
||||
if (pullType == ProtoConstants.PullType.Pull_ChatRoom) {
|
||||
isSilent = true;
|
||||
isConvSilent = true;
|
||||
isVoipSilent = true;
|
||||
isNoDisturb = true;
|
||||
} else {
|
||||
isSilent = false;
|
||||
isVoipSilent = false;
|
||||
isNoDisturb = false;
|
||||
|
||||
if (!user.equals(sender)) {
|
||||
WFCMessage.Conversation conversation;
|
||||
@@ -278,14 +284,19 @@ public class MessagesPublisher {
|
||||
isSilent = true;
|
||||
}
|
||||
|
||||
if (m_messagesStore.getUserVoipSilent(user)) {
|
||||
LOG.info("The user {} is voip sliented", user);
|
||||
isVoipSilent = true;
|
||||
}
|
||||
|
||||
if (!isSilent && isPcOnline && m_messagesStore.getSilentWhenPcOnline(user)) {
|
||||
LOG.info("The user {} pc online and silent when pc online", user);
|
||||
isSilent = true;
|
||||
}
|
||||
|
||||
if (!isSilent && m_messagesStore.isUserNoDisturbing(user)) {
|
||||
if (m_messagesStore.isUserNoDisturbing(user)) {
|
||||
LOG.info("The user {} is no disturbing", user);
|
||||
isSilent = true;
|
||||
isNoDisturb = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,8 +342,9 @@ public class MessagesPublisher {
|
||||
isConvSilent = false;
|
||||
}
|
||||
}
|
||||
boolean isVoip = messageContentType == 402 || messageContentType == 400 || messageContentType == 401 || messageContentType == 406;
|
||||
|
||||
if ((StringUtil.isNullOrEmpty(pushContent) && messageContentType != 402 && messageContentType != 400 && messageContentType != 401 && messageContentType != 406)) {
|
||||
if (StringUtil.isNullOrEmpty(pushContent) && !isVoip) {
|
||||
LOG.info("push content is empty and contenttype is {}", messageContentType);
|
||||
continue;
|
||||
}
|
||||
@@ -342,16 +354,26 @@ public class MessagesPublisher {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isConvSilent) {
|
||||
if (isConvSilent && !isVoip) {
|
||||
LOG.info("Silent of user or conversation");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isSilent) {
|
||||
if (isSilent && !isVoip) {
|
||||
LOG.info("Silent of user");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(isVoip && isVoipSilent) {
|
||||
LOG.info("voip silent of user");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(isNoDisturb) {
|
||||
LOG.info("no disturb of user");
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isHiddenDetail = m_messagesStore.getUserPushHiddenDetail(user);
|
||||
|
||||
if(!nameLoaded) {
|
||||
|
||||
@@ -10,4 +10,9 @@ public interface UserSettingScope {
|
||||
int kUserSettingPCOnline = 10;
|
||||
int kUserSettingMuteWhenPCOnline = 15;
|
||||
int kUserSettingNoDisturbing = 17;
|
||||
int kUserSettingConversationClearMessage = 18;
|
||||
int kUserSettingConversationDraft = 19;
|
||||
int kUserSettingDisableSyncDraft = 20;
|
||||
int kUserSettingVoipSilent = 21;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user