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