Package io.rong.common
Class SystemUtils
-
- All Implemented Interfaces:
public class SystemUtilsCreated by weiqinxiao on 15/10/14.
-
-
Field Summary
Fields Modifier and Type Field Description public static ContextapplicationContext
-
Constructor Summary
Constructors Constructor Description SystemUtils()
-
Method Summary
Modifier and Type Method Description static ContextgetApplicationContext()static voidsetApplicationContext(Context context)static StringgetCurrentProcessName(Context context)static booleanisMainProcess(Context context)当前进程是否为主进程。 static booleanisValidAppKey(String appKey)服务端 appKey 目前的策略:只包含小写字母或数字。 客户端为了便于以后的扩展,增加大写字母的逻辑。 校验字符串是否只包含 a-z、A-Z、0-9. static StringlistToString(List<String> list)将 List转换成 String。 每个 String 之间用 , 分隔 static StringlistCmpDataToString(List<CmpData> list)将 List转换成 String。 每个 CmpData 之间用 , 分隔, CmpData 的 addr、protocol、weight 之间用 ; 分隔 static StringmapToString(Map map)Map 转 string。 每个 entry 之间用 ; 分隔, key 和 value 之间用:分隔 static booleanisParameterValid(ConversationType conversationType, String targetId, String channelId)static booleanisConversationTypeValid(ConversationType conversationType)static booleanisTargetIdValid(String targetId)static booleanisChannelIdValid(String channelId)static booleannonSupportSuperGroup(ConversationType conversationType)static booleanjudgeUIDInvalid(String messageUId, OperationCallback callback)static booleanjudgeListInvalid(List<String> keyArray, OperationCallback callback)static booleanjudgeMapInvalid(Map<String, String> expansion, OperationCallback callback)static CoreErrorCodefilterSendMessage(Message message)过滤发送的消息。 -
-
Method Detail
-
getApplicationContext
static Context getApplicationContext()
-
setApplicationContext
static void setApplicationContext(Context context)
-
getCurrentProcessName
static String getCurrentProcessName(Context context)
- Parameters:
context- 上下文- Returns:
当前进程名
-
isMainProcess
static boolean isMainProcess(Context context)
当前进程是否为主进程。
- Parameters:
context- 上下文- Returns:
当前进程是否为主进程。true 是主进程; false 不是主进程。
-
isValidAppKey
static boolean isValidAppKey(String appKey)
服务端 appKey 目前的策略:只包含小写字母或数字。 客户端为了便于以后的扩展,增加大写字母的逻辑。 校验字符串是否只包含 a-z、A-Z、0-9. 长度小于等于 20.
- Parameters:
appKey- 待校验字符串- Returns:
true 符合条件
-
listToString
static String listToString(List<String> list)
将 List转换成 String。 每个 String 之间用 , 分隔
- Parameters:
list- 待转换的 List- Returns:
转换后的 String
-
listCmpDataToString
static String listCmpDataToString(List<CmpData> list)
将 List转换成 String。 每个 CmpData 之间用 , 分隔, CmpData 的 addr、protocol、weight 之间用 ; 分隔
- Parameters:
list- 待转换的 List- Returns:
转换后的 String
-
mapToString
static String mapToString(Map map)
Map 转 string。 每个 entry 之间用 ; 分隔, key 和 value 之间用:分隔
- Parameters:
map- 待转换的 map- Returns:
转换完的字符串。
-
isParameterValid
static boolean isParameterValid(ConversationType conversationType, String targetId, String channelId)
-
isConversationTypeValid
static boolean isConversationTypeValid(ConversationType conversationType)
-
isTargetIdValid
static boolean isTargetIdValid(String targetId)
-
isChannelIdValid
static boolean isChannelIdValid(String channelId)
-
nonSupportSuperGroup
static boolean nonSupportSuperGroup(ConversationType conversationType)
-
judgeUIDInvalid
static boolean judgeUIDInvalid(String messageUId, OperationCallback callback)
-
judgeListInvalid
static boolean judgeListInvalid(List<String> keyArray, OperationCallback callback)
-
judgeMapInvalid
static boolean judgeMapInvalid(Map<String, String> expansion, OperationCallback callback)
-
filterSendMessage
static CoreErrorCode filterSendMessage(Message message)
过滤发送的消息。
- Parameters:
message- 消息- Returns:
IRongCoreEnum.CoreErrorCode ,errorCode 为 null 时可以发送。
-
-
-
-