添加项目

This commit is contained in:
zhanglei
2025-06-30 14:12:14 +08:00
commit 8a60755b60
2374 changed files with 198527 additions and 0 deletions
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tencent.qcloud.tuicore">
<application>
<activity
android:name=".permission.PermissionActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTask"
android:theme="@style/CoreActivityTranslucent"
android:windowSoftInputMode="stateHidden|stateAlwaysHidden" />
<activity
android:name=".util.PermissionRequester$PermissionActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:multiprocess="true"
android:launchMode="singleTask"
android:theme="@style/CoreActivityTranslucent"
android:windowSoftInputMode="stateHidden|stateAlwaysHidden" />
<provider
android:name=".ServiceInitializer"
android:authorities="${applicationId}.TUICore.Init"
android:enabled="true"
android:exported="false"/>
</application>
</manifest>
@@ -0,0 +1,91 @@
package com.tencent.qcloud.tuicore;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import com.tencent.qcloud.tuicore.interfaces.ITUINotification;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* Notification registration, removal and triggering
*/
class EventManager {
private static final String TAG = EventManager.class.getSimpleName();
private static class EventManagerHolder {
private static final EventManager eventManager = new EventManager();
}
public static EventManager getInstance() {
return EventManagerHolder.eventManager;
}
private final Map<Pair<String, String>, List<ITUINotification>> eventMap = new ConcurrentHashMap<>();
private EventManager() {}
public void registerEvent(String key, String subKey, ITUINotification notification) {
Log.i(TAG, "registerEvent : key : " + key + ", subKey : " + subKey + ", notification : " + notification);
if (TextUtils.isEmpty(key) || TextUtils.isEmpty(subKey) || notification == null) {
return;
}
Pair<String, String> keyPair = new Pair<>(key, subKey);
List<ITUINotification> list = eventMap.get(keyPair);
if (list == null) {
list = new CopyOnWriteArrayList<>();
eventMap.put(keyPair, list);
}
if (!list.contains(notification)) {
list.add(notification);
}
}
public void unRegisterEvent(String key, String subKey, ITUINotification notification) {
Log.i(TAG, "removeEvent : key : " + key + ", subKey : " + subKey + " notification : " + notification);
if (TextUtils.isEmpty(key) || TextUtils.isEmpty(subKey) || notification == null) {
return;
}
Pair<String, String> keyPair = new Pair<>(key, subKey);
List<ITUINotification> list = eventMap.get(keyPair);
if (list == null) {
return;
}
list.remove(notification);
}
public void unRegisterEvent(ITUINotification notification) {
Log.i(TAG, "removeEvent : notification : " + notification);
if (notification == null) {
return;
}
for (Pair<String, String> key : eventMap.keySet()) {
List<ITUINotification> value = eventMap.get(key);
if (value == null) {
continue;
}
for (ITUINotification item : value) {
if (item == notification) {
value.remove(item);
break;
}
}
}
}
public void notifyEvent(String key, String subKey, Map<String, Object> param) {
Log.i(TAG, "notifyEvent : key : " + key + ", subKey : " + subKey);
if (TextUtils.isEmpty(key) || TextUtils.isEmpty(subKey)) {
return;
}
Pair<String, String> keyPair = new Pair<>(key, subKey);
List<ITUINotification> notificationList = eventMap.get(keyPair);
if (notificationList != null) {
for (ITUINotification notification : notificationList) {
notification.onNotifyEvent(key, subKey, param);
}
}
}
}
@@ -0,0 +1,108 @@
package com.tencent.qcloud.tuicore;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import com.tencent.qcloud.tuicore.interfaces.ITUIExtension;
import com.tencent.qcloud.tuicore.interfaces.TUIExtensionInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* UI extension registration and acquisition
*/
class ExtensionManager {
private static final String TAG = ExtensionManager.class.getSimpleName();
private static class ExtensionManagerHolder {
private static final ExtensionManager extensionManager = new ExtensionManager();
}
public static ExtensionManager getInstance() {
return ExtensionManagerHolder.extensionManager;
}
private final Map<String, List<ITUIExtension>> extensionHashMap = new ConcurrentHashMap<>();
private ExtensionManager() {}
public void registerExtension(String extensionID, ITUIExtension extension) {
Log.i(TAG, "registerExtension extensionID : " + extensionID + ", extension : " + extension);
if (TextUtils.isEmpty(extensionID) || extension == null) {
return;
}
List<ITUIExtension> list = extensionHashMap.get(extensionID);
if (list == null) {
list = new CopyOnWriteArrayList<>();
extensionHashMap.put(extensionID, list);
}
if (!list.contains(extension)) {
list.add(extension);
}
}
public void unRegisterExtension(String extensionID, ITUIExtension extension) {
Log.i(TAG, "removeExtension extensionID : " + extensionID + ", extension : " + extension);
if (TextUtils.isEmpty(extensionID) || extension == null) {
return;
}
List<ITUIExtension> list = extensionHashMap.get(extensionID);
if (list == null) {
return;
}
list.remove(extension);
}
@Deprecated
public Map<String, Object> getExtensionInfo(String key, Map<String, Object> param) {
Log.i(TAG, "getExtensionInfo key : " + key);
if (TextUtils.isEmpty(key)) {
return null;
}
List<ITUIExtension> list = extensionHashMap.get(key);
if (list == null) {
return null;
}
for (ITUIExtension extension : list) {
return extension.onGetExtensionInfo(key, param);
}
return null;
}
public List<TUIExtensionInfo> getExtensionList(String extensionID, Map<String, Object> param) {
Log.i(TAG, "getExtensionInfoList extensionID : " + extensionID);
List<TUIExtensionInfo> extensionInfoList = new ArrayList<>();
if (TextUtils.isEmpty(extensionID)) {
return extensionInfoList;
}
List<ITUIExtension> ituiExtensionList = extensionHashMap.get(extensionID);
if (ituiExtensionList == null || ituiExtensionList.isEmpty()) {
return extensionInfoList;
}
for (ITUIExtension ituiExtension : ituiExtensionList) {
List<TUIExtensionInfo> extensionInfo = ituiExtension.onGetExtension(extensionID, param);
if (extensionInfo != null) {
extensionInfoList.addAll(extensionInfo);
}
}
return extensionInfoList;
}
public void raiseExtension(String extensionID, View parentView, Map<String, Object> param) {
Log.i(TAG, "raiseExtension extensionID : " + extensionID);
if (TextUtils.isEmpty(extensionID)) {
return;
}
List<ITUIExtension> list = extensionHashMap.get(extensionID);
if (list == null) {
return;
}
for (ITUIExtension extension : list) {
extension.onRaiseExtension(extensionID, parentView, param);
return;
}
}
}
@@ -0,0 +1,56 @@
package com.tencent.qcloud.tuicore;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.qcloud.tuicore.interfaces.ITUIObjectFactory;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Object register and create
*/
class ObjectManager {
private static final String TAG = ObjectManager.class.getSimpleName();
private static class ObjectManagerHolder {
private static final ObjectManager serviceManager = new ObjectManager();
}
public static ObjectManager getInstance() {
return ObjectManagerHolder.serviceManager;
}
private final Map<String, ITUIObjectFactory> objectFactoryMap = new ConcurrentHashMap<>();
private ObjectManager() {}
public void registerObjectFactory(String factoryName, ITUIObjectFactory objectFactory) {
Log.i(TAG, "registerObjectFactory : " + factoryName + " " + objectFactory);
if (TextUtils.isEmpty(factoryName) || objectFactory == null) {
return;
}
objectFactoryMap.put(factoryName, objectFactory);
}
public void unregisterObjectFactory(String factoryName) {
Log.i(TAG, "unregisterObjectFactory : " + factoryName);
if (TextUtils.isEmpty(factoryName)) {
return;
}
objectFactoryMap.remove(factoryName);
}
public Object createObject(String factoryName, String objectName, Map<String, Object> param) {
Log.i(TAG, "createObject : " + factoryName + " objectName : " + objectName);
if (TextUtils.isEmpty(factoryName)) {
return null;
}
ITUIObjectFactory objectFactory = objectFactoryMap.get(factoryName);
if (objectFactory != null) {
return objectFactory.onCreateObject(objectName, param);
} else {
Log.w(TAG, "can't find objectFactory : " + factoryName);
return null;
}
}
}
@@ -0,0 +1,96 @@
package com.tencent.qcloud.tuicore;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* If each module needs to be initialized, it needs to implement the init method of this class
* and register it in the form of ContentProvider in the Manifest file.
*/
public class ServiceInitializer extends ContentProvider {
/**
* @param context applicationContext
*/
public void init(Context context) {}
/**
* LightTheme id
*/
public int getLightThemeResId() {
return R.style.TUIBaseLightTheme;
}
/**
* LivelyTheme id
*/
public int getLivelyThemeResId() {
return R.style.TUIBaseLivelyTheme;
}
/**
* SeriousTheme id
*/
public int getSeriousThemeResId() {
return R.style.TUIBaseSeriousTheme;
}
/////////////////////////////////////////////////////////////////////////////////
// The following methods do not need to be overridden //
/////////////////////////////////////////////////////////////////////////////////
private static Context appContext;
public static Context getAppContext() {
return appContext;
}
@Override
public boolean onCreate() {
if (appContext == null) {
appContext = getContext().getApplicationContext();
}
TUIRouter.init(appContext);
TUIConfig.init(appContext);
TUIThemeManager.addLightTheme(getLightThemeResId());
TUIThemeManager.addLivelyTheme(getLivelyThemeResId());
TUIThemeManager.addSeriousTheme(getSeriousThemeResId());
TUIThemeManager.setTheme(appContext);
init(appContext);
return false;
}
@Nullable
@Override
public Cursor query(
@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
return null;
}
@Nullable
@Override
public String getType(@NonNull Uri uri) {
return null;
}
@Nullable
@Override
public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
return null;
}
@Override
public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
return 0;
}
@Override
public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
return 0;
}
}
@@ -0,0 +1,75 @@
package com.tencent.qcloud.tuicore;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.qcloud.tuicore.interfaces.ITUIService;
import com.tencent.qcloud.tuicore.interfaces.TUIServiceCallback;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Service register and call
*/
class ServiceManager {
private static final String TAG = ServiceManager.class.getSimpleName();
private static class ServiceManagerHolder {
private static final ServiceManager serviceManager = new ServiceManager();
}
public static ServiceManager getInstance() {
return ServiceManagerHolder.serviceManager;
}
private final Map<String, ITUIService> serviceMap = new ConcurrentHashMap<>();
private ServiceManager() {}
public void registerService(String serviceName, ITUIService service) {
Log.i(TAG, "registerService : " + serviceName + " " + service);
if (TextUtils.isEmpty(serviceName) || service == null) {
return;
}
serviceMap.put(serviceName, service);
}
public void unregisterService(String serviceName) {
Log.i(TAG, "unregisterService : " + serviceName);
if (TextUtils.isEmpty(serviceName)) {
return;
}
serviceMap.remove(serviceName);
}
public ITUIService getService(String serviceName) {
Log.i(TAG, "getService : " + serviceName);
if (TextUtils.isEmpty(serviceName)) {
return null;
}
return serviceMap.get(serviceName);
}
public Object callService(String serviceName, String method, Map<String, Object> param) {
Log.i(TAG, "callService : " + serviceName + " method : " + method);
ITUIService service = serviceMap.get(serviceName);
if (service != null) {
return service.onCall(method, param);
} else {
Log.w(TAG, "can't find service : " + serviceName);
return null;
}
}
public Object callService(String serviceName, String method, Map<String, Object> param, TUIServiceCallback callback) {
Log.i(TAG, "callService : " + serviceName + " method : " + method);
ITUIService service = serviceMap.get(serviceName);
if (service != null) {
return service.onCall(method, param, callback);
} else {
Log.w(TAG, "can't find service : " + serviceName);
return null;
}
}
}
@@ -0,0 +1,373 @@
package com.tencent.qcloud.tuicore;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* TUI configuration, such as file path configuration, user information
*/
public class TUIConfig {
private static Context appContext;
private static String appDir = "";
private static String selfFaceUrl = "";
private static String selfNickName = "";
private static int selfAllowType = 0;
private static long selfBirthDay = 0L;
private static String selfSignature = "";
private static int gender;
public static final String TUICORE_SETTINGS_SP_NAME = "TUICoreSettings";
private static final String RECORD_DIR_SUFFIX = "/record/";
private static final String RECORD_DOWNLOAD_DIR_SUFFIX = "/record/download/";
public static final String VIDEO_BASE_DIR_SUFFIX = "/video/";
private static final String VIDEO_DOWNLOAD_DIR_SUFFIX = "/video/download/";
public static final String IMAGE_BASE_DIR_SUFFIX = "/image/";
private static final String IMAGE_DOWNLOAD_DIR_SUFFIX = "/image/download/";
private static final String MEDIA_DIR_SUFFIX = "/media/";
private static final String FILE_DOWNLOAD_DIR_SUFFIX = "/file/download/";
private static final String CRASH_LOG_DIR_SUFFIX = "/crash/";
private static boolean initialized = false;
private static boolean enableGroupGridAvatar = true;
private static int defaultAvatarImage;
private static int defaultGroupAvatarImage;
public static final int TUI_HOST_TYPE_IMAPP = 0;
public static final int TUI_HOST_TYPE_RTCUBE = 1;
// 0,im app; 1,rtcube app
private static int tuiHostType = TUI_HOST_TYPE_IMAPP;
public static void init(Context context) {
if (initialized) {
return;
}
TUIConfig.appContext = context;
initPath();
initialized = true;
}
public static String getDefaultAppDir() {
if (TextUtils.isEmpty(appDir)) {
Context context = null;
if (appContext != null) {
context = appContext;
} else if (TUIRouter.getContext() != null) {
context = TUIRouter.getContext();
} else if (TUILogin.getAppContext() != null) {
context = TUILogin.getAppContext();
}
if (context != null) {
appDir = context.getFilesDir().getAbsolutePath();
}
}
return appDir;
}
public static void setDefaultAppDir(String appDir) {
TUIConfig.appDir = appDir;
}
public static String getRecordDir() {
return getDefaultAppDir() + RECORD_DIR_SUFFIX;
}
public static String getRecordDownloadDir() {
return getDefaultAppDir() + RECORD_DOWNLOAD_DIR_SUFFIX;
}
public static String getVideoBaseDir() {
return getDefaultAppDir() + VIDEO_BASE_DIR_SUFFIX;
}
public static String getVideoDownloadDir() {
return getDefaultAppDir() + VIDEO_DOWNLOAD_DIR_SUFFIX;
}
public static String getImageBaseDir() {
return getDefaultAppDir() + IMAGE_BASE_DIR_SUFFIX;
}
public static String getImageDownloadDir() {
return getDefaultAppDir() + IMAGE_DOWNLOAD_DIR_SUFFIX;
}
public static String getMediaDir() {
return getDefaultAppDir() + MEDIA_DIR_SUFFIX;
}
public static String getFileDownloadDir() {
return getDefaultAppDir() + FILE_DOWNLOAD_DIR_SUFFIX;
}
public static String getCrashLogDir() {
return getDefaultAppDir() + CRASH_LOG_DIR_SUFFIX;
}
public static String getSelfFaceUrl() {
return selfFaceUrl;
}
public static void setSelfFaceUrl(String selfFaceUrl) {
TUIConfig.selfFaceUrl = selfFaceUrl;
}
public static String getSelfNickName() {
return selfNickName;
}
public static void setSelfNickName(String selfNickName) {
TUIConfig.selfNickName = selfNickName;
}
public static int getSelfAllowType() {
return selfAllowType;
}
public static void setSelfAllowType(int selfAllowType) {
TUIConfig.selfAllowType = selfAllowType;
}
public static long getSelfBirthDay() {
return selfBirthDay;
}
public static void setSelfBirthDay(long selfBirthDay) {
TUIConfig.selfBirthDay = selfBirthDay;
}
public static String getSelfSignature() {
return selfSignature;
}
public static void setSelfSignature(String selfSignature) {
TUIConfig.selfSignature = selfSignature;
}
public static void setGender(int gender) {
TUIConfig.gender = gender;
}
public static int getGender() {
return gender;
}
public static void setTUIHostType(int type) {
TUIConfig.tuiHostType = type;
}
public static int getTUIHostType() {
return tuiHostType;
}
/**
* 获取群组会话否展示九宫格样式的头像,默认为 true
* Gets whether to display the avatar in the nine-square grid style in the group conversation, the default is true
*/
public static boolean isEnableGroupGridAvatar() {
return enableGroupGridAvatar;
}
/**
* 设置群组会话是否展示九宫格样式的头像
* Set whether to display the avatar in the nine-square grid style in group conversations
*/
public static void setEnableGroupGridAvatar(boolean enableGroupGridAvatar) {
TUIConfig.enableGroupGridAvatar = enableGroupGridAvatar;
}
/**
* 获取 c2c 会话的默认头像
*
* Get the default avatar for c2c conversation
*
* @return
*/
public static int getDefaultAvatarImage() {
return defaultAvatarImage;
}
/**
* 设置 c2c 会话的默认头像
*
*Set the default avatar for c2c conversation
*
* @return
*/
public static void setDefaultAvatarImage(int defaultAvatarImage) {
TUIConfig.defaultAvatarImage = defaultAvatarImage;
}
/**
* 获取 group 会话的默认头像
*
* Get the default avatar for group conversation
*
* @return
*/
public static int getDefaultGroupAvatarImage() {
return defaultGroupAvatarImage;
}
/**
* 设置 group 会话的默认头像
*
*Set the default avatar for group conversation
*
* @return
*/
public static void setDefaultGroupAvatarImage(int defaultGroupAvatarImage) {
TUIConfig.defaultGroupAvatarImage = defaultGroupAvatarImage;
}
/**
* Set login user information
*/
public static void setSelfInfo(V2TIMUserFullInfo userFullInfo) {
TUIConfig.selfFaceUrl = userFullInfo.getFaceUrl();
TUIConfig.selfNickName = userFullInfo.getNickName();
TUIConfig.selfAllowType = userFullInfo.getAllowType();
TUIConfig.selfBirthDay = userFullInfo.getBirthday();
TUIConfig.selfSignature = userFullInfo.getSelfSignature();
TUIConfig.gender = userFullInfo.getGender();
}
/**
* Clear login user information
*/
public static void clearSelfInfo() {
TUIConfig.selfFaceUrl = "";
TUIConfig.selfNickName = "";
TUIConfig.selfAllowType = 0;
TUIConfig.selfBirthDay = 0L;
TUIConfig.selfSignature = "";
}
/**
* init file path
*/
public static void initPath() {
File f = new File(getMediaDir());
if (!f.exists()) {
f.mkdirs();
}
f = new File(getRecordDir());
if (!f.exists()) {
f.mkdirs();
}
f = new File(getRecordDownloadDir());
if (!f.exists()) {
f.mkdirs();
}
f = new File(getVideoDownloadDir());
if (!f.exists()) {
f.mkdirs();
}
f = new File(getImageDownloadDir());
if (!f.exists()) {
f.mkdirs();
}
f = new File(getImageBaseDir());
if (!f.exists()) {
f.mkdirs();
}
f = new File(getVideoBaseDir());
if (!f.exists()) {
f.mkdirs();
}
f = new File(getFileDownloadDir());
if (!f.exists()) {
f.mkdirs();
}
f = new File(getCrashLogDir());
if (!f.exists()) {
f.mkdirs();
}
}
public static Context getAppContext() {
return appContext;
}
public static void setSceneOptimizParams(final String scene) {
new Thread(new Runnable() {
@Override
public void run() {
try {
String packageName = "";
if (getAppContext() != null) {
packageName = getAppContext().getPackageName();
}
URL url = new URL("https://demos.trtc.tencent-cloud.com/prod/base/v1/events/stat");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
String sdkAPPId = TUILogin.getSdkAppId() + "";
JSONObject msgObject = new JSONObject();
msgObject.put("sdkappid", sdkAPPId);
msgObject.put("bundleId", "");
msgObject.put("component", scene);
msgObject.put("package", packageName);
String userId = TUILogin.getUserId();
JSONObject bodyObject = new JSONObject();
bodyObject.put("userId", userId);
bodyObject.put("event", "useScenario");
bodyObject.put("msg", msgObject);
String paramStr = String.valueOf(bodyObject);
OutputStream out = conn.getOutputStream();
out.write(paramStr.getBytes());
out.flush();
out.close();
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
InputStream is = conn.getInputStream();
ByteArrayOutputStream message = new ByteArrayOutputStream();
int len = 0;
byte[] buffer = new byte[1024];
while ((len = is.read(buffer)) != -1) {
message.write(buffer, 0, len);
}
String msg = new String(message.toByteArray());
Log.d("setSceneOptimizParams", "msg:" + msg);
is.close();
message.close();
conn.disconnect();
} else {
Log.d("setSceneOptimizParams", "ResponseCode:" + conn.getResponseCode());
}
} catch (Exception e) {
Log.d("TUICore", "setSceneOptimizParams exception");
}
}
}).start();
}
}
@@ -0,0 +1,732 @@
package com.tencent.qcloud.tuicore;
import com.tencent.imsdk.BaseConstants;
/**
* TUI constants
*/
public final class TUIConstants {
public static final class GroupType {
public static final String TYPE = "type";
public static final String IS_GROUP = "isGroup";
public static final String TYPE_PRIVATE = "Private";
public static final String TYPE_WORK = "Work";
public static final String TYPE_PUBLIC = "Public";
public static final String TYPE_CHAT_ROOM = "ChatRoom";
public static final String TYPE_MEETING = "Meeting";
public static final String TYPE_COMMUNITY = "Community";
}
public static final class Service {
public static final String TUI_CHAT = "TUIChatService";
public static final String TUI_CONVERSATION = "TUIConversationService";
public static final String TUI_CONTACT = "TUIContactService";
public static final String TUI_SEARCH = "TUISearchService";
public static final String TUI_GROUP = "TUIGroupService";
public static final String TUI_CALLING = "TUICallingService";
public static final String TUI_AUDIO_RECORD = "TUIAudioMessageRecordService";
public static final String TUI_LIVE = "TUILiveService";
public static final String TUI_BEAUTY = "TUIBeauty";
public static final String TUI_OFFLINEPUSH = "TUIOfflinePushService";
public static final String TUI_COMMUNITY = "TUICommunityService";
public static final String TUI_DEMO = "TIMAppService";
public static final String TUI_POLL = "TUIPollService";
public static final String TUI_GROUP_NOTE = "TUIGroupNoteService";
public static final String TUI_CONVERSATION_GROUP = "TUIConversationGroupService";
public static final String TUI_CONVERSATION_MARK = "TUIConversationMarkService";
}
public static final class ObjectFactory {
public static final String FACTORY_CONVERSATION_GROUP = "objectConversationGroup";
public static final String FACTORY_CONVERSATION_MARK = "objectConversationMark";
}
public static final class TUICore {
public static final String LANGUAGE_EVENT = "TUIThemeManager";
public static final String LANGUAGE_EVENT_SUB_KEY = "onInitLanguage";
}
public static final class TUILogin {
// User login status change broadcast
public static final String EVENT_LOGIN_STATE_CHANGED = "eventLoginStateChanged";
// User kicked offline
public static final String EVENT_SUB_KEY_USER_KICKED_OFFLINE = "eventSubKeyUserKickedOffline";
// User ticket expired
public static final String EVENT_SUB_KEY_USER_SIG_EXPIRED = "eventSubKeyUserSigExpired";
// Changes in user personal information
public static final String EVENT_SUB_KEY_USER_INFO_UPDATED = "eventSubKeyUserInfoUpdated";
// Imsdk initialize state change
public static final String EVENT_IMSDK_INIT_STATE_CHANGED = "eventIMSDKInitStateChanged";
// Init
public static final String EVENT_SUB_KEY_START_INIT = "eventSubKeyStartInit";
// Uint
public static final String EVENT_SUB_KEY_START_UNINIT = "eventSubKeyStartUnInit";
// Login success
public static final String EVENT_SUB_KEY_USER_LOGIN_SUCCESS = "eventSubKeyUserLoginSuccess";
// Logout success
public static final String EVENT_SUB_KEY_USER_LOGOUT_SUCCESS = "eventSubKeyUserLogoutSuccess";
public static final String SELF_ID = "selfId";
public static final String SELF_SIGNATURE = "selfSignature";
public static final String SELF_FACE_URL = "selfFaceUrl";
public static final String SELF_NICK_NAME = "selfNickName";
public static final String SELF_LEVEL = "selfLevel";
public static final String SELF_GENDER = "selfGender";
public static final String SELF_ROLE = "selfRole";
public static final String SELF_BIRTHDAY = "selfBirthday";
public static final String SELF_ALLOW_TYPE = "selfAllowType";
}
public static final class TUIChat {
public static final String SERVICE_NAME = TUIConstants.Service.TUI_CHAT;
// Send message
public static final String METHOD_SEND_MESSAGE = "sendMessage";
// Exit chat
public static final String METHOD_EXIT_CHAT = "exitChat";
// Get a message digest to display in the conversation list
public static final String METHOD_GET_DISPLAY_STRING = "getDisplayString";
// add message to chat list
public static final String METHOD_ADD_MESSAGE_TO_CHAT = "addMessageToChat";
// Set chat extension
public static final String METHOD_SET_CHAT_EXTENSION = "setChatExtension";
// More actions
public static final String EXTENSION_INPUT_MORE_VIDEO_CALL = "inputMoreVideoCall";
public static final String EXTENSION_INPUT_MORE_AUDIO_CALL = "inputMoreAudioCall";
public static final String EXTENSION_INPUT_MORE_GROUP_NOTE = "inputMoreGroupNote";
public static final String EXTENSION_INPUT_MORE_POLL = "inputMoreGroupPoll";
// Message actions
public static final String EVENT_KEY_RECEIVE_MESSAGE = "eventReceiveMessage";
public static final String EVENT_SUB_KEY_CONVERSATION_ID = "eventConversationID";
public static final String EVENT_KEY_INPUT_MORE = "eventKeyInputMore";
public static final String EVENT_SUB_KEY_ON_CLICK = "eventSubKeyOnClick";
public static final String EVENT_KEY_MESSAGE_EVENT = "eventKeyMessageEvent";
public static final String EVENT_SUB_KEY_SEND_MESSAGE_SUCCESS = "eventSubKeySendMessageSuccess";
public static final String EVENT_SUB_KEY_SEND_MESSAGE_FAILED = "eventSubKeySendMessageFailed";
public static final String EVENT_SUB_KEY_REPLY_MESSAGE_SUCCESS = "eventSubKeyReplyMessageSuccess";
public static final String C2C_CHAT_ACTIVITY_NAME = "TUIC2CChatActivity";
public static final String GROUP_CHAT_ACTIVITY_NAME = "TUIGroupChatActivity";
public static final String CHAT_ID = "chatId";
public static final String CHAT_NAME = "chatName";
public static final String CHAT_TYPE = "chatType";
public static final String GROUP_NAME = "groupName";
public static final String GROUP_TYPE = "groupType";
public static final String DRAFT_TEXT = "draftText";
public static final String DRAFT_TIME = "draftTime";
public static final String IS_TOP_CHAT = "isTopChat";
public static final String LOCATE_MESSAGE = "locateMessage";
public static final String AT_INFO_LIST = "atInfoList";
public static final String FACE_URL = "faceUrl";
public static final String FACE_URL_LIST = "faceUrlList";
public static final String JOIN_TYPE = "joinType";
public static final String MEMBER_COUNT = "memberCount";
public static final String RECEIVE_OPTION = "receiveOption";
public static final String NOTICE = "notice";
public static final String OWNER = "owner";
public static final String MEMBER_DETAILS = "memberDetails";
public static final String IS_GROUP_CHAT = "isGroupChat";
public static final String V2TIMMESSAGE = "v2TIMMessage";
public static final String MESSAGE_BEAN = "messageBean";
public static final String GROUP_APPLY_NUM = "groupApplicaitonNumber";
public static final String CONVERSATION_ID = "conversationID";
public static final String IS_TYPING_MESSAGE = "isTypingMessage";
public static final String CALL_BACK = "callback";
public static final String PLUGIN_ITEM_VIEW = "pluginItemView";
public static final String PLUGIN_BEAN_OBJECT = "pluginBeanObject";
// Send custom message fields
public static final String MESSAGE_CONTENT = "messageContent";
public static final String MESSAGE_DESCRIPTION = "messageDescription";
public static final String MESSAGE_EXTENSION = "messageExtension";
// More input button extension field
public static final String CONTEXT = "context";
public static final String INPUT_MORE_ICON = "icon";
public static final String INPUT_MORE_TITLE = "title";
public static final String INPUT_MORE_ACTION_ID = "actionId";
public static final String INPUT_MORE_VIEW = "inputMoreView";
// Background
public static final String CHAT_CONVERSATION_BACKGROUND_URL =
"https://im.sdk.qcloud.com/download/tuikit-resource/conversation-backgroundImage/backgroundImage_%s_full.png";
public static final String CHAT_CONVERSATION_BACKGROUND_THUMBNAIL_URL =
"https://im.sdk.qcloud.com/download/tuikit-resource/conversation-backgroundImage/backgroundImage_%s.png";
public static final int CHAT_CONVERSATION_BACKGROUND_COUNT = 7;
public static final String CHAT_CONVERSATION_BACKGROUND_DEFAULT_URL = "chat/conversation/background/default/url";
public static final int CHAT_REQUEST_BACKGROUND_CODE = 1001;
public static final String METHOD_UPDATE_DATA_STORE_CHAT_URI = "updateDatastoreChatUri";
public static final String CHAT_BACKGROUND_URI = "chatBackgroundUri";
// Chat plugin
public static final String ENABLE_VIDEO_CALL = "enableVideoCall";
public static final String ENABLE_AUDIO_CALL = "enableAudioCall";
public static final String ENABLE_LINK = "enableLink";
// Translation
public static final String CHAT_RECYCLER_VIEW = "chatRecyclerView";
public static final String THEME_STYLE_CLASSIC = "classicTheme";
public static final String THEME_STYLE_MINIMALIST = "minimalistTheme";
public static final String FRAGMENT = "fragment";
public static final String ACTIVITY = "activity";
public static class Extension {
// UI extension for the input area at the bottom of the chat page
public static class InputMore {
public static final String CLASSIC_EXTENSION_ID = "ChatInputMoreExtensionClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ChatInputMoreExtensionMinimalistID";
public static final String FILTER_VOICE_CALL = "ChatInputMoreExtensionFilterAudioCall";
public static final String FILTER_VIDEO_CALL = "ChatInputMoreExtensionFilterVideoCall";
public static final String CONTEXT = "ChatContext";
public static final String USER_ID = "ChatInputMoreUserID";
public static final String GROUP_ID = "ChatInputMoreGroupID";
public static final String INPUT_MORE_LISTENER = "ChatInputMoreListener";
}
// Message long press pop-up window extension
public static class MessagePopMenu {
public static final String CLASSIC_EXTENSION_ID = "ChatMessagePopMenuExtensionClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ChatMessagePopMenuExtensionMinimalistID";
public static final String MESSAGE_BEAN = "ChatMessageBean";
public static final String ON_POP_CLICK_LISTENER = "ChatOnPopClickListener";
}
// UI extension on the right side of navigation bar in chat page
public static class ChatNavigationMoreItem {
public static final String CLASSIC_EXTENSION_ID = "ChatNavigationMoreItemExtensionClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ChatNavigationMoreItemExtensionMinimalistID";
public static final String FILTER_VOICE_CALL = "ChatNavigationMoreItemFilterAudioCall";
public static final String FILTER_VIDEO_CALL = "ChatNavigationMoreItemFilterVideoCall";
public static final String CHAT_BACKGROUND_URI = "ChatBackgroundUri";
public static final String USER_ID = "ChatUserID";
public static final String GROUP_ID = "ChatGroupID";
public static final String TOPIC_ID = "ChatTopicID";
public static final String CONTEXT = "ChatContext";
}
}
public static class Method {
// Register a message type with Chat
public static class RegisterCustomMessage {
public static final String CLASSIC_SERVICE_NAME = TUIChat.Service.CLASSIC_SERVICE_NAME;
public static final String MINIMALIST_SERVICE_NAME = TUIChat.Service.MINIMALIST_SERVICE_NAME;
public static final String METHOD_NAME = "ChatRegisterCustomMessageName";
public static final String MESSAGE_BUSINESS_ID = "ChatMessageBusinessID";
public static final String MESSAGE_BEAN_CLASS = "ChatMessageBeanClass";
public static final String MESSAGE_VIEW_HOLDER_CLASS = "ChatMessageViewHolderClass";
public static final String MESSAGE_REPLY_BEAN_CLASS = "ChatMessageReplyBeanClass";
public static final String MESSAGE_REPLY_VIEW_CLASS = "ChatMessageReplyViewClass";
public static final String IS_NEED_EMPTY_VIEW_GROUP = "ChatMessageIsNeedEmptyViewGroup";
}
}
public static class Service {
public static final String CHAT_SERVICE_NAME = TUIConstants.Service.TUI_CHAT;
public static final String CLASSIC_SERVICE_NAME = "ChatClassicService";
public static final String MINIMALIST_SERVICE_NAME = "ChatMinimalistService";
}
}
public static final class TUIConversation {
public static final String SERVICE_NAME = Service.TUI_CONVERSATION;
public static final String METHOD_IS_TOP_CONVERSATION = "isTopConversation";
public static final String METHOD_SET_TOP_CONVERSATION = "setTopConversation";
public static final String METHOD_GET_TOTAL_UNREAD_COUNT = "getTotalUnreadCount";
public static final String METHOD_UPDATE_TOTAL_UNREAD_COUNT = "updateTotalUnreadCount";
public static final String METHOD_DELETE_CONVERSATION = "deleteConversation";
public static final String METHOD_CLEAR_CONVERSATION_MESSAGE = "clearConversationMessage";
public static final String EVENT_UNREAD = "eventTotalUnreadCount";
public static final String EVENT_SUB_KEY_UNREAD_CHANGED = "unreadCountChanged";
public static final String EXTENSION_CLASSIC_SEARCH = "extensionClassicSearch";
public static final String EXTENSION_MINIMALIST_SEARCH = "extensionMinimalistSearch";
public static final String CHAT_ID = "chatId";
public static final String CONVERSATION_ID = "conversationId";
public static final String IS_SET_TOP = "isSetTop";
public static final String IS_TOP = "isTop";
public static final String IS_GROUP = "isGroup";
public static final String TOTAL_UNREAD_COUNT = "totalUnreadCount";
public static final String CONTEXT = "context";
public static final String SEARCH_VIEW = "searchView";
public static final String KEY_CONVERSATION_INFO = "keyConversationInfo";
public static final String CONVERSATION_C2C_PREFIX = "c2c_";
public static final String CONVERSATION_GROUP_PREFIX = "group_";
public static final String EVENT_KEY_MESSAGE_SEND_FOR_CONVERSATION = "eventKeyMessageSendForConversation";
public static final String EVENT_SUB_KEY_MESSAGE_SEND_FOR_CONVERSATION = "eventSubKeyMessageSendForConversation";
public static class Extension {
// Conversation List Header Extension
public static class ConversationListHeader {
public static final String CLASSIC_EXTENSION_ID = "TUIConversationListHeaderClassicID";
public static final String MINIMALIST_EXTENSION_ID = "TUIConversationListHeaderMinimalistID";
public static final String HEADER_CONTAINER = "TUIConversationListHeaderContainer";
}
// Conversation popmenu Extension
public static class ConversationPopMenu {
public static final String CLASSIC_EXTENSION_ID = "ConversationPopMenuExtensionClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ConversationPopMenuExtensionMinimalistID";
}
// Conversation group Extension
public static class ConversationGroupBean {
public static final String CLASSIC_EXTENSION_ID = "ConversationGroupPopMenuExtensionClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ConversationGroupPopMenuExtensionMinimalistID";
public static final String KEY_DATA = "conversationGroupBeanData";
}
}
}
public static final class TUIContact {
public static final String SERVICE_NAME = Service.TUI_CONTACT;
public static final String EVENT_FRIEND_STATE_CHANGED = "eventFriendStateChanged";
public static final String EVENT_FRIEND_INFO_CHANGED = "eventFriendInfoChanged";
public static final String EVENT_USER = "eventUser";
public static final String EVENT_SUB_KEY_FRIEND_REMARK_CHANGED = "eventFriendRemarkChanged";
public static final String EVENT_SUB_KEY_FRIEND_DELETE = "eventSubKeyFriendDelete";
public static final String EVENT_SUB_KEY_CLEAR_MESSAGE = "eventSubKeyC2CClearMessage";
public static final String FRIEND_ID_LIST = "friendIdList";
public static final String FRIEND_ID = "friendId";
public static final String FRIEND_REMARK = "friendRemark";
public static final String GROUP_TYPE_KEY = "type";
public static final String COMMUNITY_SUPPORT_TOPIC_KEY = "communitySupportTopic";
public static final int GROUP_TYPE_PRIVATE = 0;
public static final int GROUP_TYPE_PUBLIC = 1;
public static final int GROUP_TYPE_CHAT_ROOM = 2;
public static final int GROUP_TYPE_COMMUNITY = 3;
public static final String GROUP_FACE_URL = "https://im.sdk.qcloud.com/download/tuikit-resource/group-avatar/group_avatar_%s.png";
public static final int GROUP_FACE_COUNT = 24;
public static class Extension {
public static class FriendProfileItem {
public static final String CLASSIC_EXTENSION_ID = "ContactFriendProfileItemClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ContactFriendProfileItemMinimalistID";
public static final String USER_ID = "ContactFriendProfileUserID";
}
}
public static class StartActivity {
// Group members selector
public static class GroupMemberSelect {
public static final String CLASSIC_ACTIVITY_NAME = "StartGroupMemberSelectActivity";
public static final String MINIMALIST_ACTIVITY_NAME = "StartGroupMemberSelectMinimalistActivity";
public static final String GROUP_ID = "ContactGroupMemberSelectGroupID";
public static final String MEMBER_LIMIT = "ContactGroupMemberSelectMemberLimit";
public static final String SELECT_FOR_CALL = "ContactGroupMemberSelectForCall";
public static final String SELECTED_LIST = "ContactGroupMemberSelectedList";
public static final String SELECT_FRIENDS = "ContactGroupMemberSelectFriends";
public static final String DATA_LIST = "ContactGroupMemberSelectDataList";
public static final String PAGE_TITLE = "ContactGroupMemberSelectTitle";
public static final String USER_NAME_CARD_SELECT = "ContactGroupMemberSelectNameCardSelected";
public static final String USER_ID_SELECT = "ContactGroupMemberSelectUserIDSelected";
}
}
}
public static final class TUICalling {
public static final String SERVICE_NAME = Service.TUI_CALLING;
public static final String METHOD_NAME_CALL = "call";
public static final String METHOD_NAME_RECEIVEAPNSCALLED = "receiveAPNSCalled";
public static final String METHOD_NAME_ENABLE_FLOAT_WINDOW = "methodEnableFloatWindow";
public static final String METHOD_NAME_ENABLE_MULTI_DEVICE = "methodEnableMultiDeviceAbility";
public static final String PARAM_NAME_TYPE = "type";
public static final String PARAM_NAME_USERIDS = "userIDs";
public static final String PARAM_NAME_GROUPID = "groupId";
public static final String PARAM_NAME_CALLMODEL = "call_model_data";
public static final String PARAM_NAME_ENABLE_FLOAT_WINDOW = "enableFloatWindow";
public static final String PARAM_NAME_ENABLE_MULTI_DEVICE = "enableMultiDeviceAbility";
public static final String METHOD_START_CALL = "startCall";
public static final String CUSTOM_MESSAGE_BUSINESS_ID = "av_call";
public static final Double CALL_TIMEOUT_BUSINESS_ID = 1.0;
public static final String CALL_ID = "callId";
public static final String SENDER = "sender";
public static final String GROUP_ID = "groupId";
public static final String INVITED_LIST = "invitedList";
public static final String DATA = "data";
public static final String TYPE_AUDIO = "audio";
public static final String TYPE_VIDEO = "video";
public static final int ACTION_ID_AUDIO_CALL = 1;
public static final int ACTION_ID_VIDEO_CALL = 2;
public static final String EVENT_KEY_CALLING = "calling";
public static final String EVENT_KEY_NAME = "event_name";
public static final String EVENT_ACTIVE_HANGUP = "active_hangup";
public static final String SERVICE_NAME_AUDIO_RECORD = Service.TUI_AUDIO_RECORD;
public static final String METHOD_NAME_START_RECORD_AUDIO_MESSAGE = "methodStartRecordAudioMessage";
public static final String METHOD_NAME_STOP_RECORD_AUDIO_MESSAGE = "methodStopRecordAudioMessage";
public static final String EVENT_KEY_RECORD_AUDIO_MESSAGE = "eventRecordAudioMessage";
public static final String EVENT_SUB_KEY_RECORD_START = "eventSubKeyStartRecordAudioMessage";
public static final String EVENT_SUB_KEY_RECORD_STOP = "eventSubKeyStopRecordAudioMessage";
public static final String PARAM_NAME_SDK_APP_ID = "sdkappid";
public static final String PARAM_NAME_AUDIO_SIGNATURE = "signature";
public static final String PARAM_NAME_AUDIO_PATH = "path";
// Error Code
public static final int ERROR_NONE = 0; // init success or record success
public static final int ERROR_INVALID_PARAM = -1001; // param is invalid
public static final int ERROR_STATUS_IN_CALL = -1002; // recording rejected, currently in call
public static final int ERROR_STATUS_IS_AUDIO_RECORDING = -1003; // recording rejected, the current recording is not finished
public static final int ERROR_MIC_PERMISSION_REFUSED = -1004; // recording rejected, failed to obtain microphone permission
public static final int ERROR_REQUEST_AUDIO_FOCUS_FAILED = -1005; // recording rejected, failed to obtain audio focus
public static final int ERROR_RECORD_INIT_FAILED = -2001; // -1, init failed(onLocalRecordBegin)
public static final int ERROR_PATH_FORMAT_NOT_SUPPORT = -2002; // -2, file format is invalid(onLocalRecordBegin)
public static final int ERROR_RECORD_FAILED = -2003; // -1, record failed(onLocalRecordComplete)
public static final int ERROR_NO_MESSAGE_TO_RECORD = -2004; // -3, The audio data has not arrived(onLocalRecordComplete)
public static final int ERROR_SIGNATURE_ERROR = -3001; // -4, signature error(onLocalRecordBegin)
public static final int ERROR_SIGNATURE_EXPIRED = -3002; // -5, signature expired(onLocalRecordBegin)
// TRTC-SDK MIC Error Code
public static final int ERR_MIC_START_FAIL = -1302; // start microphone failed
public static final int ERR_MIC_NOT_AUTHORIZED = -1317; // microphone authorize failed
public static final int ERR_MIC_SET_PARAM_FAIL = -1318; // microphone param is invalid
public static final int ERR_MIC_OCCUPY = -1319; // microphone is occupied
public static class ObjectFactory {
public static final String FACTORY_NAME = "TUICallingObjectFactory";
public static class RecentCalls {
public static final String OBJECT_NAME = "TUICallingRecentCallsFragment";
public static final String UI_STYLE = "TUICallingRecentCallsFragmentUIStyle";
public static final String UI_STYLE_CLASSIC = "ClassicStyle";
public static final String UI_STYLE_MINIMALIST = "MinimalistStyle";
}
}
}
public static final class TUILive {
public static final String SERVICE_NAME = Service.TUI_LIVE;
public static final String METHOD_LOGIN = "methodLogin";
public static final String METHOD_LOGOUT = "methodLogout";
public static final String METHOD_START_ANCHOR = "methodStartAnchor";
public static final String METHOD_START_AUDIENCE = "methodStartAudience";
public static final String CUSTOM_MESSAGE_BUSINESS_ID = "group_live";
public static final String SDK_APP_ID = "sdkAppId";
public static final String USER_ID = "userId";
public static final String USER_SIG = "userSig";
public static final String GROUP_ID = "groupId";
public static final String ROOM_ID = "roomId";
public static final String ROOM_NAME = "roomName";
public static final String ROOM_STATUS = "roomStatus";
public static final String ROOM_COVER = "roomCover";
public static final String USE_CDN_PLAY = "use_cdn_play";
public static final String ANCHOR_ID = "anchorId";
public static final String ANCHOR_NAME = "anchorName";
public static final String PUSHER_NAME = "pusherName";
public static final String COVER_PIC = "coverPic";
public static final String PUSHER_AVATAR = "pusherAvatar";
public static final int ACTION_ID_LIVE = 0;
}
public static final class TUIGroup {
public static final String SERVICE_NAME = Service.TUI_GROUP;
public static final String EVENT_GROUP = "eventGroup";
public static final String EVENT_SUB_KEY_EXIT_GROUP = "eventExitGroup";
public static final String EVENT_SUB_KEY_MEMBER_KICKED_GROUP = "eventMemberKickedGroup";
public static final String EVENT_SUB_KEY_GROUP_RECYCLE = "eventMemberGroupRecycle";
public static final String EVENT_SUB_KEY_GROUP_DISMISS = "eventMemberGroupDismiss";
public static final String EVENT_SUB_KEY_JOIN_GROUP = "eventSubKeyJoinGroup";
public static final String EVENT_SUB_KEY_INVITED_GROUP = "eventSubKeyInvitedGroup";
public static final String EVENT_SUB_KEY_GROUP_INFO_CHANGED = "eventSubKeyGroupInfoChanged";
public static final String EVENT_SUB_KEY_CLEAR_MESSAGE = "eventSubKeyGroupClearMessage";
public static final String EVENT_SUB_KEY_GROUP_MEMBER_SELECTED = "eventSubKeyGroupMemberSelected";
public static final String GROUP_ID = "groupId";
public static final String GROUP_NAME = "groupName";
public static final String GROUP_FACE_URL = "groupFaceUrl";
public static final String GROUP_OWNER = "groupOwner";
public static final String GROUP_INTRODUCTION = "groupIntroduction";
public static final String GROUP_NOTIFICATION = "groupNotification";
public static final String GROUP_MEMBER_ID_LIST = "groupMemberIdList";
public static final String SELECT_FRIENDS = "select_friends";
public static final String SELECT_FOR_CALL = "isSelectForCall";
public static final String USER_DATA = "userData";
public static final String IS_SELECT_MODE = "isSelectMode";
public static final String EXCLUDE_LIST = "excludeList";
public static final String SELECTED_LIST = "selectedList";
public static final String CONTENT = "content";
public static final String TYPE = "type";
public static final String TITLE = "title";
public static final String LIST = "list";
public static final String LIMIT = "limit";
public static final String FILTER = "filter";
public static final String JOIN_TYPE_INDEX = "joinTypeIndex";
public static class Extension {
public static class GroupProfileItem {
public static final String CLASSIC_EXTENSION_ID = "GroupProfileItemClassicID";
public static final String MINIMALIST_EXTENSION_ID = "GroupProfileItemMinimalistID";
public static final String GROUP_ID = "GroupProfileGroupID";
public static final String CONTEXT = "GroupProfileContext";
}
}
public static class Event {
public static class GroupApplication {
public static final String KEY_GROUP_APPLICATION = "groupApplication";
public static final String SUB_KEY_GROUP_APPLICATION_NUM_CHANGED = "groupApplicationNumChanged";
}
}
}
public static final class TUIBeauty {
public static final String SERVICE_NAME = Service.TUI_BEAUTY;
public static final String PARAM_NAME_CONTEXT = "context";
public static final String PARAM_NAME_LICENSE_KEY = "licenseKey";
public static final String PARAM_NAME_LICENSE_URL = "licenseUrl";
public static final String PARAM_NAME_FRAME_WIDTH = "frameWidth";
public static final String PARAM_NAME_FRAME_HEIGHT = "frameHeight";
public static final String PARAM_NAME_SRC_TEXTURE_ID = "srcTextureId";
public static final String METHOD_PROCESS_VIDEO_FRAME = "processVideoFrame";
public static final String METHOD_INIT_XMAGIC = "setLicense";
public static final String METHOD_DESTROY_XMAGIC = "destroy";
}
public static final class TUIOfflinePush {
public static final String SERVICE_NAME = Service.TUI_OFFLINEPUSH;
public static final String METHOD_UNREGISTER_PUSH = "unRegiterPush";
public static final String EVENT_NOTIFY = "offlinePushNotifyEvent";
public static final String EVENT_NOTIFY_NOTIFICATION = "notifyNotificationEvent";
public static final String NOTIFICATION_INTENT_KEY = "notificationIntentKey";
public static final String NOTIFICATION_EXT_KEY = "ext";
public static final String NOTIFICATION_BROADCAST_ACTION = "com.tencent.tuiofflinepush.BROADCAST_PUSH_RECEIVER";
}
public static final class TUICommunity {
public static final String SERVICE_NAME = Service.TUI_COMMUNITY;
public static final String TOPIC_ID = "topic_id";
public static final String EVENT_KEY_COMMUNITY_EXPERIENCE = "eventKeyCommunityExperience";
public static final String EVENT_SUB_KEY_ADD_COMMUNITY = "eventSubKeyAddCommunity";
public static final String EVENT_SUB_KEY_CREATE_COMMUNITY = "eventSubKeyCreateCommunity";
public static final String EVENT_SUB_KEY_DISBAND_COMMUNITY = "eventSubKeyDisbandCommunity";
public static final String EVENT_SUB_KEY_CREATE_TOPIC = "eventSubKeyCreateTopic";
public static final String EVENT_SUB_KEY_DELETE_TOPIC = "eventSubKeyDeleteTopic";
}
public static final class TUIPlugin {
public static final String PLUGIN_BUSINESS_ID = "businessID";
public static final String PLUGIN_TITLE = "title";
public static final String PLUGIN_DESCRIPTION = "description";
public static final String PLUGIN_CONTENT = "content";
public static final String PLUGIN_EXTENSION_CONFIG = "config";
public static final String PLUGIN_ORIGINAL_MESSAGE_ID = "original_msg_id";
public static final String PLUGIN_ORIGINAL_MESSAGE_SEQUENCE = "original_msg_seq";
public static final String BUSINESS_ID_PLUGIN_GROUP_NOTE = "group_note";
public static final String BUSINESS_ID_PLUGIN_GROUP_NOTE_TIPS = "group_note_tips";
public static final String BUSINESS_ID_PLUGIN_POLL = "group_poll";
public static final String KEY_EXTENSIONS = "key_extensions";
}
public static final class TUIPollPlugin {
public static final String SERVICE_NAME = Service.TUI_POLL;
public static final int ACTION_ID_POLL = 3;
public static final String POLL_CREATOR_ACTIVITY_NAME = "TUIPollCreatorActivity";
public static final String PLUGIN_POLL_OPTION_LIST = "option_list";
public static final String PLUGIN_POLL_OPTION_INDEX = "index";
public static final String PLUGIN_POLL_OPTION_CONTENT = "option";
public static final String PLUGIN_POLL_ENABLE_PUBLIC = "public";
public static final String PLUGIN_POLL_ENABLE_MULTI_VOTE = "allow_multi_vote";
public static final String PLUGIN_POLL_ANONYMOUS = "anonymous";
public static final String METHOD_GET_POLL_MESSAGE_LAYOUT = "getPollMessageLayout";
public static final String EVENT_KEY_POLL_MESSAGE_LAYOUT = "eventKeyPollMessageLayout";
public static final String EVENT_SUB_KEY_REFRESH_POLL_MESSAGE_LAYOUT = "eventKeyRefreshPollMessageLayout";
public static final String EVENT_KEY_POLL_EVENT = "eventKeyPollEvent";
public static final String EVENT_SUB_KEY_POLL_VOTE_CHANGED = "eventSubKeyVoteChanged";
}
public static final class TUIGroupNotePlugin {
public static final String SERVICE_NAME = Service.TUI_GROUP_NOTE;
public static final int ACTION_ID_GROUP_NOTE = 4;
public static final String GROUP_NOTE_CREATOR_ACTIVITY_NAME = "TUIGroupNoteCreatorActivity";
public static final String PLUGIN_GROUP_NOTE_CREATOR = "creator";
public static final String PLUGIN_GROUP_NOTE_SHOW_LINE_NUM = "show_line_num";
public static final String PLUGIN_GROUP_NOTE_FORMAT = "format";
public static final String PLUGIN_GROUP_NOTE_ENABLE_MULTIPLE_SUBMISSION = "multi_submit";
public static final String PLUGIN_GROUP_NOTE_DEADLINE = "deadline";
public static final String PLUGIN_GROUP_NOTE_ENABLE_NOTIFICATION = "notify";
public static final String METHOD_GET_GROUP_NOTE_MESSAGE_LAYOUT = "getGroupNoteMessageLayout";
public static final String METHOD_GET_GROUP_NOTE_TIPS_MESSAGE_LAYOUT = "getGroupNoteTipsMessageLayout";
public static final String EVENT_KEY_GROUP_NOTE_EVENT = "eventKeyGroupNoteEvent";
public static final String EVENT_SUB_KEY_GROUP_NOTE_CHANGED = "eventSubKeyGroupNoteChanged";
}
public static final class TIMAppKit {
public static final String SERVICE_NAME = Service.TUI_DEMO;
public static final String METHOD_INIT_IM_BEFORE_LOGIN = "initIMBeforeLogin";
public static final String METHOD_ENTER_IM_FROM_RTCUBE = "enterIMFromRTCube";
public static final String SDK_APP_ID = "sdkAppId";
public static final String IM_DEMO_ITEM_TYPE_KEY = "imDemoItemTypeKey";
public static final String IM_DEMO_ITEM_TYPE_CHAT = "imDemoItemTypeChat";
public static final String IM_DEMO_ITEM_TYPE_COMMUNITY = "imDemoItemTypeCommunity";
public static final String IM_DEMO_ITEM_TYPE_CONTACT = "imDemoItemTypeContact";
public static final String IM_DEMO_ITEM_TYPE_RECENT_CALLS = "imDemoItemTypeRecentCalls";
public static final String IM_DEMO_ITEM_TYPE_PROFILE = "imDemoItemTypeProfile";
public static final String BACK_TO_RTCUBE_DEMO_TYPE_KEY = "backToRTCubeDemoTypeKey";
public static final String BACK_TO_RTCUBE_DEMO_TYPE_IM = "backToRTCubeDemoTypeIM";
public static final String NOTIFY_RTCUBE_EVENT_KEY = "notifyRTCubeEventKey";
public static final String NOTIFY_RTCUBE_LOGIN_SUB_KEY = "notifyRTCubeLoginSubKey";
public static final String NOFITY_IMLOGIN_SUCCESS_SUB_KEY = "nofityIMLoginSuccessSubKey";
public static final String OFFLINE_PUSH_INTENT_DATA = "offlinePushIntentData";
public static final int BACK_RTCUBE_HOME_ICON_WIDTH = 40;
public static final int BACK_RTCUBE_HOME_ICON_HEIGHT = 32;
public static class Extension {
public static class ProfileSettings {
public static final String CLASSIC_EXTENSION_ID = "ProfileSettingsViewClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ProfileSettingsMinimalistID";
public static final String KEY_VIEW = "view";
}
}
}
public static final class TUITranslationPlugin {
public static class Extension {
// TranslationView Extension
public static class TranslationView {
public static final String CLASSIC_EXTENSION_ID = "TUITranslationViewClassicID";
public static final String MINIMALIST_EXTENSION_ID = "TUITranslationViewMinimalistID";
}
}
// show translation view
public static final String EVENT_KEY_TRANSLATION_EVENT = "eventKeyTranslationEvent";
public static final String EVENT_SUB_KEY_TRANSLATION_CHANGED = "eventSubKeyTranslationChanged";
// select target language
public static final String METHOD_SELECT_TRANSLATION_LANGUAGE = "selectTranslationLanguage";
public static final String LANGUAGE_NAME = "languageName";
}
public static final class TUIConversationGroupPlugin {
public static final String SERVICE_NAME = Service.TUI_CONVERSATION_GROUP;
public static final String OBJECT_FACTORY_NAME = ObjectFactory.FACTORY_CONVERSATION_GROUP;
public static final String CONTEXT = "context";
public static final String EXTENSION_GROUP_SETTING_MENU = "extensionGroupSettingMenu";
public static final String OBJECT_CONVERSATION_GROUP_FRAGMENT = "objectConversationGroupFragment";
public static class Extension {
// ConversationGroup popmenu Extension
public static class ConversationPopMenu {
public static final String CLASSIC_EXTENSION_ID = "ConversationGroupPopMenuExtensionClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ConversationGroupPopMenuExtensionMinimalistID";
}
}
}
public static final class TUIConversationMarkPlugin {
public static final String SERVICE_NAME = Service.TUI_CONVERSATION_MARK;
public static final String OBJECT_FACTORY_NAME = ObjectFactory.FACTORY_CONVERSATION_MARK;
public static final String CONTEXT = "context";
public static final String OBJECT_CONVERSATION_MARK_BEANS = "objectConversationMarkBeans";
public static final String OBJECT_CONVERSATION_MARK_FRAGMENT = "objectConversationMarkFragment";
public static class Extension {
// ConversationMark popmenu Extension
public static class ConversationPopMenu {
public static final String CLASSIC_EXTENSION_ID = "ConversationMarkPopMenuExtensionClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ConversationMarkPopMenuExtensionMinimalistID";
}
public static class ConversationGroupBean {
public static final String CLASSIC_EXTENSION_ID = "ConversationGroupPopMenuExtensionClassicID";
public static final String MINIMALIST_EXTENSION_ID = "ConversationGroupPopMenuExtensionMinimalistID";
}
}
}
public static final class Message {
public static final String CUSTOM_BUSINESS_ID_KEY = "businessID";
public static final String CALLING_TYPE_KEY = "call_type";
}
public static final class NetworkConnection {
public static final String EVENT_CONNECTION_STATE_CHANGED = "eventConnectionStateChanged";
public static final String EVENT_SUB_KEY_CONNECTING = "eventSubKeyConnecting";
public static final String EVENT_SUB_KEY_CONNECT_SUCCESS = "eventSubKeyConnectSuccess";
public static final String EVENT_SUB_KEY_CONNECT_FAILED = "eventSubKeyConnectFailed";
}
public static final class BuyingFeature {
public static final int ERR_SDK_INTERFACE_NOT_SUPPORT = BaseConstants.ERR_SDK_INTERFACE_NOT_SUPPORT;
public static final String BUYING_GUIDELINES_EN = "https://intl.cloud.tencent.com/document/product/1047/36021?lang=en&pg=#changing-configuration";
public static final String BUYING_GUIDELINES = "https://cloud.tencent.com/document/product/269/32458";
public static final String BUYING_PRICE_DESC_EN = "https://www.tencentcloud.com/document/product/1047/34349#basic-services";
public static final String BUYING_PRICE_DESC =
"https://cloud.tencent.com/document/product/269/11673?from=17219#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85";
public static final String BUYING_FEATURE_MESSAGE_RECEIPT = "buying_chat_message_read_receipt";
public static final String BUYING_FEATURE_COMMUNITY = "buying_community";
public static final String BUYING_FEATURE_SEARCH = "buying_search";
public static final String BUYING_FEATURE_ONLINE_STATUS = "buying_online_status";
}
public static final class TUIVideoSeat {
public static final String SERVICE_VIDEO_SEAT = "com.tencent.cloud.tuikit.videoseat.core.TUIVideoSeatExtension";
public static final String METHOD_SWITCH_VIDEO_LAYOUT = "switchVideoLayout";
}
public static final class Privacy {
public static class PermissionsFactory {
public static final String FACTORY_NAME = "PrivacyPermissionsFactory";
public static class PermissionsName {
public static final String CAMERA_PERMISSIONS = "CameraPermissions";
public static final String MICROPHONE_PERMISSIONS = "MicrophonePermissions";
}
}
}
// localBroadcast
public static final String CONVERSATION_UNREAD_COUNT_ACTION = "conversation_unread_count_action";
public static final String UNREAD_COUNT_EXTRA = "unread_count_extra";
}
@@ -0,0 +1,232 @@
package com.tencent.qcloud.tuicore;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultCaller;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.tencent.qcloud.tuicore.interfaces.ITUIExtension;
import com.tencent.qcloud.tuicore.interfaces.ITUINotification;
import com.tencent.qcloud.tuicore.interfaces.ITUIObjectFactory;
import com.tencent.qcloud.tuicore.interfaces.ITUIService;
import com.tencent.qcloud.tuicore.interfaces.TUIExtensionInfo;
import com.tencent.qcloud.tuicore.interfaces.TUIServiceCallback;
import java.util.List;
import java.util.Map;
/**
* TUI Plugin core class, mainly responsible for data transfer between TUI plugins, notification broadcast, function extension, etc.
*/
public class TUICore {
private static final String TAG = TUICore.class.getSimpleName();
/**
* Register Service
* @param serviceName service name
* @param service service object
*/
public static void registerService(String serviceName, ITUIService service) {
ServiceManager.getInstance().registerService(serviceName, service);
}
/**
* unregister Service
*
* @param serviceName service name
*/
public static void unregisterService(String serviceName) {
ServiceManager.getInstance().unregisterService(serviceName);
}
/**
* get Service
*
* @param serviceName service name
* @return service
*/
public static ITUIService getService(String serviceName) {
return ServiceManager.getInstance().getService(serviceName);
}
/**
* Call Service
*
* @param serviceName service name
* @param method method name
* @param param pass parameters
* @return object
*/
public static Object callService(String serviceName, String method, Map<String, Object> param) {
return ServiceManager.getInstance().callService(serviceName, method, param);
}
/**
* Call service asynchronously
*
* @param serviceName service name
* @param method method name
* @param param pass parameters
* @return object
*/
public static Object callService(String serviceName, String method, Map<String, Object> param, TUIServiceCallback callback) {
return ServiceManager.getInstance().callService(serviceName, method, param, callback);
}
/**
* start Activity
* @param activityName activity namesuch as "TUIGroupChatActivity"
* @param param pass parameters
*/
public static void startActivity(String activityName, Bundle param) {
startActivity(null, activityName, param, -1);
}
/**
* start Activity
* @param starter Initiator, either {@link Context} or {@link Fragment}
* @param activityName activity namesuch as "TUIGroupChatActivity"
* @param param pass parameters
*/
public static void startActivity(@Nullable Object starter, String activityName, Bundle param) {
startActivity(starter, activityName, param, -1);
}
/**
* start Activity
* @param starter Initiator, either {@link Context} or {@link Fragment}
* @param activityName activity namesuch as "TUIGroupChatActivity"
* @param param pass parameters
* @param requestCode The request value passed to the Activity, used to return the result in the initiator's
* onActivityResult method when the Activity ends, greater than or equal to 0 is valid.
* @note The method has been deprecateduse {@link #startActivityForResult}
*/
@Deprecated
public static void startActivity(@Nullable Object starter, String activityName, Bundle param, int requestCode) {
TUIRouter.startActivity(starter, activityName, param, requestCode);
}
/**
* Start the activity and get the result asynchronously
* @param caller {@link androidx.activity.result.ActivityResultCaller}
* @param activityName activity namesuch as "TUIGroupChatActivity"
* @param param pass parameters
* @param resultCallback the result callback
*/
public static void startActivityForResult(
@Nullable ActivityResultCaller caller, String activityName, Bundle param, ActivityResultCallback<ActivityResult> resultCallback) {
TUIRouter.startActivityForResult(caller, activityName, param, resultCallback);
}
/**
* Start the activity and get the result asynchronously
* @param caller {@link androidx.activity.result.ActivityResultCaller}
* @param activityClazz activity's Class Object
* @param param pass parameters
* @param resultCallback the result callback
*/
public static void startActivityForResult(
@Nullable ActivityResultCaller caller, Class<? extends Activity> activityClazz, Bundle param, ActivityResultCallback<ActivityResult> resultCallback) {
TUIRouter.startActivityForResult(caller, activityClazz, param, resultCallback);
}
/**
* Start the activity and get the result asynchronously
* @param caller {@link androidx.activity.result.ActivityResultCaller}
* @param intent the intent
* @param resultCallback the result callback
*/
public static void startActivityForResult(@Nullable ActivityResultCaller caller, Intent intent, ActivityResultCallback<ActivityResult> resultCallback) {
TUIRouter.startActivityForResult(caller, intent, resultCallback);
}
/**
* Register event
*/
public static void registerEvent(String key, String subKey, ITUINotification notification) {
EventManager.getInstance().registerEvent(key, subKey, notification);
}
/**
* Unregister event
*/
public static void unRegisterEvent(String key, String subKey, ITUINotification notification) {
EventManager.getInstance().unRegisterEvent(key, subKey, notification);
}
/**
* Removes all notifications for the specified notification object
*/
public static void unRegisterEvent(ITUINotification notification) {
EventManager.getInstance().unRegisterEvent(notification);
}
/**
* Notify event
*/
public static void notifyEvent(String key, String subKey, Map<String, Object> param) {
EventManager.getInstance().notifyEvent(key, subKey, param);
}
/**
* Register extension
*/
public static void registerExtension(String extensionID, ITUIExtension extension) {
ExtensionManager.getInstance().registerExtension(extensionID, extension);
}
/**
* Unregister extension
*/
public static void unRegisterExtension(String key, ITUIExtension extension) {
ExtensionManager.getInstance().unRegisterExtension(key, extension);
}
/**
* Get Extension
* @note The method has been deprecateduse {@link #getExtensionList}
*/
@Deprecated
public static Map<String, Object> getExtensionInfo(String key, Map<String, Object> param) {
return ExtensionManager.getInstance().getExtensionInfo(key, param);
}
/**
* Get Extension list
*/
public static List<TUIExtensionInfo> getExtensionList(String extensionID, Map<String, Object> param) {
return ExtensionManager.getInstance().getExtensionList(extensionID, param);
}
/**
* invoke Extension
*/
public static void raiseExtension(String key, View parentView, Map<String, Object> param) {
ExtensionManager.getInstance().raiseExtension(key, parentView, param);
}
/**
* Register object factory
*/
public static void registerObjectFactory(String factoryName, ITUIObjectFactory objectFactory) {
ObjectManager.getInstance().registerObjectFactory(factoryName, objectFactory);
}
/**
* Unregister object factory
*/
public static void unregisterObjectFactory(String factoryName) {
ObjectManager.getInstance().unregisterObjectFactory(factoryName);
}
/**
* Create object and get
*/
public static Object createObject(String objectFactory, String objectName, Map<String, Object> param) {
return ObjectManager.getInstance().createObject(objectFactory, objectName, param);
}
}
@@ -0,0 +1,485 @@
package com.tencent.qcloud.tuicore;
import static com.tencent.imsdk.v2.V2TIMManager.V2TIM_STATUS_LOGINED;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMLogListener;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSDKConfig;
import com.tencent.imsdk.v2.V2TIMSDKListener;
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
import com.tencent.imsdk.v2.V2TIMValueCallback;
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
import com.tencent.qcloud.tuicore.interfaces.TUILogListener;
import com.tencent.qcloud.tuicore.interfaces.TUILoginConfig;
import com.tencent.qcloud.tuicore.interfaces.TUILoginListener;
import com.tencent.qcloud.tuicore.util.ErrorMessageConverter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* Login logic for IM and TRTC
*/
public class TUILogin {
private static final String TAG = TUILogin.class.getSimpleName();
private static class TUILoginHolder {
private static final TUILogin loginInstance = new TUILogin();
}
public static TUILogin getInstance() {
return TUILoginHolder.loginInstance;
}
private Context appContext;
private int sdkAppId = 0;
private String userId;
private String userSig;
private boolean hasLoginSuccess = false;
private int currentBusinessScene = TUIBusinessScene.NONE;
private final List<TUILoginListener> listenerList = new CopyOnWriteArrayList<>();
private TUILogin() {}
private final V2TIMSDKListener imSdkListener = new V2TIMSDKListener() {
@Override
public void onConnecting() {
for (TUILoginListener listener : listenerList) {
listener.onConnecting();
}
TUICore.notifyEvent(TUIConstants.NetworkConnection.EVENT_CONNECTION_STATE_CHANGED, TUIConstants.NetworkConnection.EVENT_SUB_KEY_CONNECTING, null);
}
@Override
public void onConnectSuccess() {
for (TUILoginListener listener : listenerList) {
listener.onConnectSuccess();
}
TUICore.notifyEvent(
TUIConstants.NetworkConnection.EVENT_CONNECTION_STATE_CHANGED, TUIConstants.NetworkConnection.EVENT_SUB_KEY_CONNECT_SUCCESS, null);
}
@Override
public void onConnectFailed(int code, String error) {
for (TUILoginListener listener : listenerList) {
listener.onConnectFailed(code, error);
}
TUICore.notifyEvent(
TUIConstants.NetworkConnection.EVENT_CONNECTION_STATE_CHANGED, TUIConstants.NetworkConnection.EVENT_SUB_KEY_CONNECT_FAILED, null);
}
@Override
public void onKickedOffline() {
for (TUILoginListener listener : listenerList) {
listener.onKickedOffline();
}
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_KICKED_OFFLINE, null);
}
@Override
public void onUserSigExpired() {
for (TUILoginListener listener : listenerList) {
listener.onUserSigExpired();
}
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_SIG_EXPIRED, null);
}
@Override
public void onSelfInfoUpdated(V2TIMUserFullInfo info) {
TUIConfig.setSelfInfo(info);
notifyUserInfoChanged(info);
}
};
/**
* IMSDK login
*
* @param context The context of the application, generally is ApplicationContext
* @param sdkAppId Assigned when you register your app with Tencent Cloud
* @param userId User ID
* @param userSig Obtained from the business server
* @param callback login callback
*/
public static void login(@NonNull Context context, int sdkAppId, String userId, String userSig, TUICallback callback) {
getInstance().internalLogin(context, sdkAppId, userId, userSig, null, callback);
}
/**
* IMSDK login
*
* @param context The context of the application, generally is ApplicationContext
* @param sdkAppId Assigned when you register your app with Tencent Cloud
* @param userId User ID
* @param userSig Obtained from the business server
* @param config log related configs
* @param callback login callback
*/
public static void login(@NonNull Context context, int sdkAppId, String userId, String userSig, TUILoginConfig config, TUICallback callback) {
getInstance().internalLogin(context, sdkAppId, userId, userSig, config, callback);
}
/**
* User Login
*
* @param userId User ID
* @param userSig Obtained from the business server
* @param callback login callback
*/
@Deprecated
public static void login(@NonNull String userId, @NonNull String userSig, @Nullable V2TIMCallback callback) {
getInstance().userId = userId;
getInstance().userSig = userSig;
if (TextUtils.equals(userId, V2TIMManager.getInstance().getLoginUser()) && !TextUtils.isEmpty(userId)) {
if (callback != null) {
callback.onSuccess();
}
getUserInfo(userId);
return;
}
V2TIMManager.getInstance().login(userId, userSig, new V2TIMCallback() {
@Override
public void onSuccess() {
getInstance().hasLoginSuccess = true;
if (callback != null) {
callback.onSuccess();
}
getUserInfo(userId);
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_LOGIN_SUCCESS, null);
}
@Override
public void onError(int code, String desc) {
if (callback != null) {
callback.onError(code, ErrorMessageConverter.convertIMError(code, desc));
}
}
});
}
/**
* IMSDK logout
* @param callback logout callback
*/
public static void logout(TUICallback callback) {
getInstance().internalLogout(callback);
}
/**
* User Logout
*
* @param callback Logout callback
*/
@Deprecated
public static void logout(@Nullable V2TIMCallback callback) {
V2TIMManager.getInstance().logout(new V2TIMCallback() {
@Override
public void onSuccess() {
getInstance().userId = null;
getInstance().userSig = null;
if (callback != null) {
callback.onSuccess();
}
TUIConfig.clearSelfInfo();
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_LOGOUT_SUCCESS, null);
}
@Override
public void onError(int code, String desc) {
if (callback != null) {
callback.onError(code, ErrorMessageConverter.convertIMError(code, desc));
}
}
});
}
public static void addLoginListener(TUILoginListener listener) {
getInstance().internalAddLoginListener(listener);
}
public static void removeLoginListener(TUILoginListener listener) {
getInstance().internalRemoveLoginListener(listener);
}
private void internalLogin(Context context, final int sdkAppId, final String userId, final String userSig, TUILoginConfig config, TUICallback callback) {
if (this.sdkAppId != 0 && sdkAppId != this.sdkAppId) {
logout((TUICallback) null);
}
this.appContext = context.getApplicationContext();
this.sdkAppId = sdkAppId;
currentBusinessScene = TUIBusinessScene.NONE;
V2TIMManager.getInstance().addIMSDKListener(imSdkListener);
// Notify init event
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_IMSDK_INIT_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_START_INIT, null);
// User operation initialization, the privacy agreement has been read by default
V2TIMSDKConfig v2TIMSDKConfig = null;
if (config != null) {
v2TIMSDKConfig = new V2TIMSDKConfig();
v2TIMSDKConfig.setLogLevel(config.getLogLevel());
TUILogListener logListener = config.getLogListener();
if (logListener != null) {
v2TIMSDKConfig.setLogListener(new V2TIMLogListener() {
@Override
public void onLog(int logLevel, String logContent) {
logListener.onLog(logLevel, logContent);
}
});
}
}
boolean initSuccess = V2TIMManager.getInstance().initSDK(context, sdkAppId, v2TIMSDKConfig);
if (initSuccess) {
this.userId = userId;
this.userSig = userSig;
if (TextUtils.equals(userId, V2TIMManager.getInstance().getLoginUser()) && !TextUtils.isEmpty(userId)) {
hasLoginSuccess = true;
getUserInfo(userId);
TUICallback.onSuccess(callback);
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_LOGIN_SUCCESS, null);
return;
}
V2TIMManager.getInstance().login(userId, userSig, new V2TIMCallback() {
@Override
public void onSuccess() {
hasLoginSuccess = true;
getUserInfo(userId);
TUICallback.onSuccess(callback);
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_LOGIN_SUCCESS, null);
}
@Override
public void onError(int code, String desc) {
TUICallback.onError(callback, code, ErrorMessageConverter.convertIMError(code, desc));
}
});
} else {
TUICallback.onError(callback, -1, "init failed");
}
}
private void internalLogout(TUICallback callback) {
// Notify unit event
currentBusinessScene = TUIBusinessScene.NONE;
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_IMSDK_INIT_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_START_UNINIT, null);
V2TIMManager.getInstance().logout(new V2TIMCallback() {
@Override
public void onSuccess() {
sdkAppId = 0;
userId = null;
userSig = null;
V2TIMManager.getInstance().unInitSDK();
TUIConfig.clearSelfInfo();
TUICallback.onSuccess(callback);
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_LOGOUT_SUCCESS, null);
}
@Override
public void onError(int code, String desc) {
TUICallback.onError(callback, code, desc);
}
});
}
private void internalAddLoginListener(TUILoginListener listener) {
Log.i(TAG, "addLoginListener listener : " + listener);
if (listener == null) {
return;
}
if (!listenerList.contains(listener)) {
listenerList.add(listener);
}
}
private void internalRemoveLoginListener(TUILoginListener listener) {
Log.i(TAG, "removeLoginListener listener : " + listener);
if (listener == null) {
return;
}
listenerList.remove(listener);
}
/**
* IMSDK init
*
* @param context The context of the application, generally is ApplicationContext
* @param sdkAppId Assigned when you register your app with Tencent Cloud
* @param config The related configuration items of IMSDK, generally use the default,
* and need special configuration, please refer to the API documentation
* @param listener Listener of IMSDK init
* @return trueinit successfalseinit failed
*/
@Deprecated
public static boolean init(@NonNull Context context, int sdkAppId, @Nullable V2TIMSDKConfig config, @Nullable V2TIMSDKListener listener) {
if (getInstance().sdkAppId != 0 && sdkAppId != getInstance().sdkAppId) {
logout((V2TIMCallback) null);
unInit();
}
getInstance().appContext = context.getApplicationContext();
getInstance().sdkAppId = sdkAppId;
V2TIMManager.getInstance().addIMSDKListener(new V2TIMSDKListener() {
@Override
public void onConnecting() {
if (listener != null) {
listener.onConnecting();
}
}
@Override
public void onConnectSuccess() {
if (listener != null) {
listener.onConnectSuccess();
}
}
@Override
public void onConnectFailed(int code, String error) {
if (listener != null) {
listener.onConnectFailed(code, ErrorMessageConverter.convertIMError(code, error));
}
}
@Override
public void onKickedOffline() {
if (listener != null) {
listener.onKickedOffline();
}
setCurrentBusinessScene(TUIBusinessScene.NONE);
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_KICKED_OFFLINE, null);
}
@Override
public void onUserSigExpired() {
if (listener != null) {
listener.onUserSigExpired();
}
setCurrentBusinessScene(TUIBusinessScene.NONE);
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_SIG_EXPIRED, null);
}
@Override
public void onSelfInfoUpdated(V2TIMUserFullInfo info) {
if (listener != null) {
listener.onSelfInfoUpdated(info);
}
TUIConfig.setSelfInfo(info);
notifyUserInfoChanged(info);
}
});
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_IMSDK_INIT_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_START_INIT, null);
return V2TIMManager.getInstance().initSDK(context, sdkAppId, config);
}
@Deprecated
public static void unInit() {
getInstance().sdkAppId = 0;
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_IMSDK_INIT_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_START_UNINIT, null);
V2TIMManager.getInstance().unInitSDK();
TUIConfig.clearSelfInfo();
}
private static void getUserInfo(String userId) {
List<String> userIdList = new ArrayList<>();
userIdList.add(userId);
V2TIMManager.getInstance().getUsersInfo(userIdList, new V2TIMValueCallback<List<V2TIMUserFullInfo>>() {
@Override
public void onSuccess(List<V2TIMUserFullInfo> v2TIMUserFullInfos) {
if (v2TIMUserFullInfos.isEmpty()) {
Log.e(TAG, "get logined userInfo failed. list is empty");
return;
}
V2TIMUserFullInfo userFullInfo = v2TIMUserFullInfos.get(0);
TUIConfig.setSelfInfo(userFullInfo);
notifyUserInfoChanged(userFullInfo);
}
@Override
public void onError(int code, String desc) {
Log.e(TAG, "get logined userInfo failed. code : " + code + " desc : " + ErrorMessageConverter.convertIMError(code, desc));
}
});
}
private static void notifyUserInfoChanged(V2TIMUserFullInfo userFullInfo) {
HashMap<String, Object> param = new HashMap<>();
param.put(TUIConstants.TUILogin.SELF_ID, userFullInfo.getUserID());
param.put(TUIConstants.TUILogin.SELF_SIGNATURE, userFullInfo.getSelfSignature());
param.put(TUIConstants.TUILogin.SELF_NICK_NAME, userFullInfo.getNickName());
param.put(TUIConstants.TUILogin.SELF_FACE_URL, userFullInfo.getFaceUrl());
param.put(TUIConstants.TUILogin.SELF_BIRTHDAY, userFullInfo.getBirthday());
param.put(TUIConstants.TUILogin.SELF_ROLE, userFullInfo.getRole());
param.put(TUIConstants.TUILogin.SELF_GENDER, userFullInfo.getGender());
param.put(TUIConstants.TUILogin.SELF_LEVEL, userFullInfo.getLevel());
param.put(TUIConstants.TUILogin.SELF_ALLOW_TYPE, userFullInfo.getAllowType());
TUICore.notifyEvent(TUIConstants.TUILogin.EVENT_LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY_USER_INFO_UPDATED, param);
}
public static int getSdkAppId() {
return getInstance().sdkAppId;
}
public static String getUserId() {
return getInstance().userId;
}
public static String getUserSig() {
return getInstance().userSig;
}
public static String getNickName() {
return TUIConfig.getSelfNickName();
}
public static String getFaceUrl() {
return TUIConfig.getSelfFaceUrl();
}
public static Context getAppContext() {
return getInstance().appContext;
}
public static boolean isUserLogined() {
return getInstance().hasLoginSuccess && V2TIMManager.getInstance().getLoginStatus() == V2TIM_STATUS_LOGINED;
}
public static String getLoginUser() {
return V2TIMManager.getInstance().getLoginUser();
}
public static class TUIBusinessScene {
public static final int NONE = 0;
public static final int IN_RECORDING = 1;
public static final int IN_CALLING_ROOM = 2;
public static final int IN_MEETING_ROOM = 3;
public static final int IN_LIVING_ROOM = 4;
}
/**
* No-thread-safe
* @param scene
*/
public static void setCurrentBusinessScene(int scene) {
getInstance().currentBusinessScene = scene;
}
public static int getCurrentBusinessScene() {
return getInstance().currentBusinessScene;
}
}
@@ -0,0 +1,523 @@
package com.tencent.qcloud.tuicore;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Log;
import android.util.Pair;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultCaller;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
/**
* For Activity routing jump, only used inside TUICore, not exposed to the outside
*/
class TUIRouter {
private static final String TAG = TUIRouter.class.getSimpleName();
private static final TUIRouter router = new TUIRouter();
public static TUIRouter getInstance() {
return router;
}
private static final Map<String, String> routerMap = new HashMap<>();
private static final Map<ActivityResultCaller, ActivityResultLauncher<Pair<Intent, ActivityResultCallback<ActivityResult>>>> activityResultLauncherMap =
new WeakHashMap<>();
@SuppressLint("StaticFieldLeak") private static Context context;
private static boolean initialized = false;
private TUIRouter() {}
public static synchronized void init(Context context) {
if (initialized) {
return;
}
TUIRouter.context = context;
if (context == null) {
Log.e(TAG, "init failed, context is null.");
return;
}
initRouter(context);
initActivityResultLauncher(context);
initialized = true;
}
static class RouterActivityResultContract
extends ActivityResultContract<Pair<Intent, ActivityResultCallback<ActivityResult>>, Pair<ActivityResult, ActivityResultCallback<ActivityResult>>> {
private ActivityResultCallback<ActivityResult> callback;
@NonNull
@Override
public Intent createIntent(@NonNull Context context, Pair<Intent, ActivityResultCallback<ActivityResult>> input) {
callback = input.second;
return input.first;
}
@Override
public Pair<ActivityResult, ActivityResultCallback<ActivityResult>> parseResult(int resultCode, @Nullable Intent intent) {
Pair<ActivityResult, ActivityResultCallback<ActivityResult>> pair = Pair.create(new ActivityResult(resultCode, intent), callback);
callback = null;
return pair;
}
}
static class RouterActivityResultCallback implements ActivityResultCallback<Pair<ActivityResult, ActivityResultCallback<ActivityResult>>> {
@Override
public void onActivityResult(Pair<ActivityResult, ActivityResultCallback<ActivityResult>> resultCallbackPair) {
if (resultCallbackPair.second != null) {
resultCallbackPair.second.onActivityResult(resultCallbackPair.first);
}
}
}
private static void initActivityResultLauncher(Context context) {
if (context instanceof Application) {
((Application) context).registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() {
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
if (activity instanceof ActivityResultCaller) {
registerForActivityResult((ActivityResultCaller) activity);
if (activity instanceof FragmentActivity) {
((FragmentActivity) activity)
.getSupportFragmentManager()
.registerFragmentLifecycleCallbacks(new FragmentManager.FragmentLifecycleCallbacks() {
@Override
public void onFragmentCreated(
@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, @Nullable Bundle savedInstanceState) {
registerForActivityResult(fragment);
}
@Override
public void onFragmentDestroyed(@NonNull FragmentManager fm, @NonNull Fragment fragment) {
clearLauncher(fragment);
}
}, true);
}
}
}
private void registerForActivityResult(ActivityResultCaller resultCaller) {
ActivityResultLauncher<Pair<Intent, ActivityResultCallback<ActivityResult>>> activityFragmentResultLauncher =
resultCaller.registerForActivityResult(new RouterActivityResultContract(), new RouterActivityResultCallback());
activityResultLauncherMap.put(resultCaller, activityFragmentResultLauncher);
}
private void clearLauncher(ActivityResultCaller resultCaller) {
activityResultLauncherMap.remove(resultCaller);
}
@Override
public void onActivityStarted(@NonNull Activity activity) {}
@Override
public void onActivityResumed(@NonNull Activity activity) {}
@Override
public void onActivityPaused(@NonNull Activity activity) {}
@Override
public void onActivityStopped(@NonNull Activity activity) {}
@Override
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {}
@Override
public void onActivityDestroyed(@NonNull Activity activity) {
if (activity instanceof ActivityResultCaller) {
clearLauncher((ActivityResultCaller) activity);
}
}
});
}
}
public Navigation setDestination(String path) {
Navigation navigation = new Navigation();
navigation.setDestination(path);
return navigation;
}
public Navigation setDestination(Class<? extends Activity> activityClazz) {
Navigation navigation = new Navigation();
navigation.setDestination(activityClazz);
return navigation;
}
static class Navigation {
String destination;
Bundle options;
Intent intent = new Intent();
public Navigation setOptions(Bundle options) {
this.options = options;
return this;
}
public Navigation putExtra(String key, boolean value) {
intent.putExtra(key, value);
return this;
}
public Navigation putExtra(String key, byte value) {
intent.putExtra(key, value);
return this;
}
public Navigation putExtra(String key, char value) {
intent.putExtra(key, value);
return this;
}
public Navigation putExtra(String key, short value) {
intent.putExtra(key, value);
return this;
}
public Navigation putExtra(String key, int value) {
intent.putExtra(key, value);
return this;
}
public Navigation putExtra(String key, long value) {
intent.putExtra(key, value);
return this;
}
public Navigation putExtra(String key, float value) {
intent.putExtra(key, value);
return this;
}
public Navigation putExtra(String key, double value) {
intent.putExtra(key, value);
return this;
}
public Navigation putExtra(String key, String value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, CharSequence value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, Parcelable value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, Parcelable[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, Serializable value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, boolean[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, byte[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, short[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, char[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, int[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, long[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, float[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, double[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, String[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, CharSequence[] value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtra(String key, Bundle value) {
if (value != null) {
intent.putExtra(key, value);
}
return this;
}
public Navigation putExtras(Bundle bundle) {
if (bundle != null) {
intent.putExtras(bundle);
}
return this;
}
public Navigation putExtras(Intent src) {
if (src != null) {
intent.putExtras(src);
}
return this;
}
public Navigation setDestination(String path) {
destination = routerMap.get(path);
if (destination == null) {
Log.e(TAG, "destination is null.");
return this;
}
intent.setComponent(new ComponentName(TUIRouter.context, destination));
return this;
}
public Navigation setDestination(Class<? extends Activity> activityClazz) {
intent.setComponent(new ComponentName(TUIRouter.context, activityClazz));
return this;
}
public Navigation setIntent(Intent intent) {
this.intent = intent;
return this;
}
public Intent getIntent() {
return this.intent;
}
public void navigate() {
navigate((Context) null);
}
public void navigate(Context context) {
navigate(context, -1);
}
public void navigate(Fragment fragment) {
navigate(fragment, -1);
}
@Deprecated
public void navigate(Fragment fragment, int requestCode) {
if (!initialized) {
Log.e(TAG, "have not initialized.");
return;
}
if (intent == null) {
Log.e(TAG, "intent is null.");
return;
}
try {
if (fragment != null) {
if (requestCode >= 0) {
fragment.startActivityForResult(intent, requestCode);
} else {
fragment.startActivity(intent, options);
}
} else {
startActivity(null, requestCode);
}
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
public void navigate(ActivityResultCaller caller, ActivityResultCallback<ActivityResult> callback) {
if (!initialized) {
Log.e(TAG, "have not initialized.");
return;
}
if (intent == null) {
Log.e(TAG, "intent is null.");
return;
}
try {
ActivityResultLauncher<Pair<Intent, ActivityResultCallback<ActivityResult>>> launcher = activityResultLauncherMap.get(caller);
if (launcher != null) {
launcher.launch(Pair.create(intent, callback));
}
} catch (Exception e) {
Log.e(TAG, "start activity failed, " + e.getLocalizedMessage());
}
}
@Deprecated
public void navigate(Context context, int requestCode) {
if (!initialized) {
Log.e(TAG, "have not initialized.");
return;
}
if (intent == null) {
Log.e(TAG, "intent is null.");
return;
}
Context startContext = context;
if (context == null) {
startContext = TUIRouter.context;
}
startActivity(startContext, requestCode);
}
private void startActivity(Context context, int requestCode) {
if (context == null) {
Log.e(TAG, "StartActivity failed, context is null.Please init");
return;
}
try {
if (context instanceof Activity && requestCode >= 0) {
ActivityCompat.startActivityForResult((Activity) context, intent, requestCode, options);
} else {
if (!(context instanceof Activity)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
ActivityCompat.startActivity(context, intent, options);
}
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
}
public static void startActivityForResult(
@Nullable ActivityResultCaller caller, String activityName, Bundle param, ActivityResultCallback<ActivityResult> resultCallback) {
Navigation navigation = TUIRouter.getInstance().setDestination(activityName).putExtras(param);
navigation.navigate(caller, resultCallback);
}
public static void startActivityForResult(
@Nullable ActivityResultCaller caller, Class<? extends Activity> activityClazz, Bundle param, ActivityResultCallback<ActivityResult> resultCallback) {
Navigation navigation = TUIRouter.getInstance().setDestination(activityClazz).putExtras(param);
navigation.navigate(caller, resultCallback);
}
public static void startActivityForResult(@Nullable ActivityResultCaller caller, Intent intent, ActivityResultCallback<ActivityResult> resultCallback) {
Navigation navigation = new Navigation();
navigation.setIntent(intent);
navigation.navigate(caller, resultCallback);
}
/**
* use {@link #startActivityForResult}
*/
@Deprecated
public static void startActivity(@Nullable Object starter, String activityName, Bundle param, int requestCode) {
TUIRouter.Navigation navigation = TUIRouter.getInstance().setDestination(activityName).putExtras(param);
if (starter instanceof Fragment) {
navigation.navigate((Fragment) starter, requestCode);
} else if (starter instanceof Context) {
navigation.navigate((Context) starter, requestCode);
} else {
navigation.navigate((Context) null, requestCode);
}
}
public static void initRouter(Context context) {
ActivityInfo[] activityInfos = null;
List<String> activityNames = new ArrayList<>();
PackageManager packageManager = context.getPackageManager();
try {
PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES);
activityInfos = packageInfo.activities;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (activityInfos != null) {
for (ActivityInfo activityInfo : activityInfos) {
activityNames.add(activityInfo.name);
}
}
for (String activityName : activityNames) {
String[] splitStr = activityName.split("\\.");
routerMap.put(splitStr[splitStr.length - 1], activityName);
}
}
public static Context getContext() {
return context;
}
}
@@ -0,0 +1,326 @@
package com.tencent.qcloud.tuicore;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tencent.qcloud.tuicore.util.SPUtils;
import com.tencent.qcloud.tuicore.util.TUIBuild;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
* Static skinning, language
*/
public class TUIThemeManager {
private static final String TAG = TUIThemeManager.class.getSimpleName();
private static final String SP_THEME_AND_LANGUAGE_NAME = "TUIThemeAndLanguage";
private static final String SP_KEY_LANGUAGE = "language";
private static final String SP_KEY_THEME = "theme";
public static final int THEME_LIGHT = 0; // default
public static final int THEME_LIVELY = 1;
public static final int THEME_SERIOUS = 2;
public static final String LANGUAGE_ZH_CN = "zh";
public static final String LANGUAGE_EN = "en";
private static final class ThemeManagerHolder {
private static final TUIThemeManager instance = new TUIThemeManager();
}
public static TUIThemeManager getInstance() {
return ThemeManagerHolder.instance;
}
private boolean isInit = false;
private final Map<Integer, List<Integer>> themeResIDMap = new HashMap<>();
private final Map<String, Locale> languageMap = new HashMap<>();
private int currentThemeID = THEME_LIGHT;
private String currentLanguage = "";
private Locale defaultLocale = null;
private TUIThemeManager() {
languageMap.put(LANGUAGE_ZH_CN, Locale.SIMPLIFIED_CHINESE);
languageMap.put(LANGUAGE_EN, Locale.ENGLISH);
}
public static void setTheme(Context context) {
getInstance().setThemeInternal(context);
}
private void setThemeInternal(Context context) {
if (context == null) {
return;
}
Context appContext = context.getApplicationContext();
if (!isInit) {
isInit = true;
if (appContext instanceof Application) {
((Application) appContext).registerActivityLifecycleCallbacks(new ThemeAndLanguageCallback());
}
notifySetLanguageEvent();
Locale defaultLocale = getLocale(appContext);
SPUtils spUtils = SPUtils.getInstance(SP_THEME_AND_LANGUAGE_NAME);
currentLanguage = spUtils.getString(SP_KEY_LANGUAGE, defaultLocale.getLanguage());
currentThemeID = spUtils.getInt(SP_KEY_THEME, THEME_LIGHT);
// The language only needs to be initialized once
applyLanguage(appContext);
}
// The theme needs to be updated multiple times
applyTheme(appContext);
}
private static String currentProcessName = "";
public static String getProcessName() {
if (!TextUtils.isEmpty(currentProcessName)) {
return currentProcessName;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
currentProcessName = Application.getProcessName();
return currentProcessName;
}
try {
final Method declaredMethod = Class.forName("android.app.ActivityThread", false, Application.class.getClassLoader())
.getDeclaredMethod("currentProcessName", (Class<?>[]) new Class[0]);
declaredMethod.setAccessible(true);
final Object invoke = declaredMethod.invoke(null, new Object[0]);
if (invoke instanceof String) {
currentProcessName = (String) invoke;
}
} catch (Throwable e) {
e.printStackTrace();
}
return currentProcessName;
}
private void notifySetLanguageEvent() {
TUICore.notifyEvent(TUIConstants.TUICore.LANGUAGE_EVENT, TUIConstants.TUICore.LANGUAGE_EVENT_SUB_KEY, null);
}
/**
* Solve the problem that WebView on Android 7 and above causes failure to switch languages.
* Solve the problem of using WebView Crash for multiple processes above Android 9.
*/
public static void setWebViewLanguage(Context appContext) {
try {
Log.i(TAG, "setWebViewLanguage");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
WebView.setDataDirectorySuffix(getProcessName());
}
new WebView(appContext).destroy();
} catch (Throwable throwable) {
Log.e("TUIThemeManager", "init language settings failed, " + throwable.getMessage());
}
}
public void setDefaultLocale(Locale defaultLocale) {
this.defaultLocale = defaultLocale;
}
public static void addTheme(int themeID, int resID) {
if (resID == 0) {
Log.e(TAG, "addTheme failed, theme resID is zero");
return;
}
Log.i(TAG, "addTheme themeID=" + themeID + " resID=" + resID);
List<Integer> themeResIDList = getInstance().themeResIDMap.get(themeID);
if (themeResIDList == null) {
themeResIDList = new ArrayList<>();
getInstance().themeResIDMap.put(themeID, themeResIDList);
}
if (themeResIDList.contains(resID)) {
return;
}
themeResIDList.add(resID);
TUIThemeManager.getInstance().applyTheme(ServiceInitializer.getAppContext());
}
public static void addLightTheme(int resId) {
addTheme(THEME_LIGHT, resId);
}
public static void addLivelyTheme(int resId) {
addTheme(THEME_LIVELY, resId);
}
public static void addSeriousTheme(int resId) {
addTheme(THEME_SERIOUS, resId);
}
public int getCurrentTheme() {
return currentThemeID;
}
private void mergeTheme(Resources.Theme theme) {
if (theme == null) {
return;
}
List<Integer> currentThemeResIDList = themeResIDMap.get(currentThemeID);
if (currentThemeResIDList == null) {
return;
}
for (Integer resId : currentThemeResIDList) {
theme.applyStyle(resId, true);
}
}
public static void addLanguage(String language, Locale locale) {
Log.i(TAG, "addLanguage language=" + language + " locale=" + locale);
getInstance().languageMap.put(language, locale);
}
public void changeLanguage(Context context, String language) {
if (context == null) {
return;
}
if (TextUtils.equals(language, currentLanguage)) {
return;
}
currentLanguage = language;
SPUtils spUtils = SPUtils.getInstance(SP_THEME_AND_LANGUAGE_NAME);
spUtils.put(SP_KEY_LANGUAGE, language, true);
applyLanguage(context.getApplicationContext());
applyLanguage(context);
}
public void applyLanguage(Context context) {
if (context == null) {
return;
}
Locale locale = languageMap.get(currentLanguage);
if (locale == null) {
if (defaultLocale != null) {
locale = defaultLocale;
} else {
locale = getLocale(context);
}
}
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
if (TUIBuild.getVersionInt() >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
configuration.setLocale(locale);
}
resources.updateConfiguration(configuration, null);
if (Build.VERSION.SDK_INT >= 25) {
context = context.createConfigurationContext(configuration);
context.getResources().updateConfiguration(configuration, resources.getDisplayMetrics());
}
}
public String getCurrentLanguage() {
return currentLanguage;
}
public Locale getLocale(Context context) {
Locale locale;
if (TUIBuild.getVersionInt() < Build.VERSION_CODES.N) {
locale = context.getResources().getConfiguration().locale;
} else {
locale = context.getResources().getConfiguration().getLocales().get(0);
}
return locale;
}
public void changeTheme(Context context, int themeId) {
if (context == null) {
return;
}
if (themeId == currentThemeID) {
return;
}
currentThemeID = themeId;
SPUtils spUtils = SPUtils.getInstance(SP_THEME_AND_LANGUAGE_NAME);
spUtils.put(SP_KEY_THEME, themeId, true);
applyTheme(context.getApplicationContext());
applyTheme(context);
}
private void applyTheme(Context context) {
if (context == null) {
return;
}
Resources.Theme theme = context.getTheme();
if (theme == null) {
context.setTheme(R.style.TUIBaseTheme);
theme = context.getTheme();
}
mergeTheme(theme);
}
/**
* Get resources for skinning
*
* @param context context
* @param attrId custom attribute
* @return resources for skinning
*/
public static int getAttrResId(Context context, int attrId) {
if (context == null || attrId == 0) {
return 0;
}
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(attrId, typedValue, true);
return typedValue.resourceId;
}
static class ThemeAndLanguageCallback implements Application.ActivityLifecycleCallbacks {
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
TUIThemeManager.getInstance().applyTheme(activity);
TUIThemeManager.getInstance().applyLanguage(activity);
TUIThemeManager.getInstance().applyLanguage(activity.getApplicationContext());
}
@Override
public void onActivityStarted(@NonNull Activity activity) {}
@Override
public void onActivityResumed(@NonNull Activity activity) {}
@Override
public void onActivityPaused(@NonNull Activity activity) {}
@Override
public void onActivityStopped(@NonNull Activity activity) {}
@Override
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {}
@Override
public void onActivityDestroyed(@NonNull Activity activity) {}
}
}
@@ -0,0 +1,21 @@
package com.tencent.qcloud.tuicore.interfaces;
import android.view.View;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface ITUIExtension {
@Deprecated
default Map<String, Object> onGetExtensionInfo(String key, Map<String, Object> param) {
return new HashMap<>();
}
default void onRaiseExtension(String extensionID, View parentView, Map<String, Object> param) {}
default List<TUIExtensionInfo> onGetExtension(String extensionID, Map<String, Object> param) {
return new ArrayList<>();
}
}
@@ -0,0 +1,7 @@
package com.tencent.qcloud.tuicore.interfaces;
import java.util.Map;
public interface ITUINotification {
void onNotifyEvent(String key, String subKey, Map<String, Object> param);
}
@@ -0,0 +1,7 @@
package com.tencent.qcloud.tuicore.interfaces;
import java.util.Map;
public interface ITUIObjectFactory {
Object onCreateObject(String objectName, Map<String, Object> param);
}
@@ -0,0 +1,13 @@
package com.tencent.qcloud.tuicore.interfaces;
import java.util.Map;
public interface ITUIService {
default Object onCall(String method, Map<String, Object> param) {
return null;
}
default Object onCall(String method, Map<String, Object> param, TUIServiceCallback callback) {
return null;
}
}
@@ -0,0 +1,19 @@
package com.tencent.qcloud.tuicore.interfaces;
public abstract class TUICallback {
public abstract void onSuccess();
public static void onSuccess(TUICallback callback) {
if (callback != null) {
callback.onSuccess();
}
}
public abstract void onError(int errorCode, String errorMessage);
public static void onError(TUICallback callback, int errorCode, String errorMessage) {
if (callback != null) {
callback.onError(errorCode, errorMessage);
}
}
}
@@ -0,0 +1,13 @@
package com.tencent.qcloud.tuicore.interfaces;
import java.util.Map;
public abstract class TUIExtensionEventListener {
public void onClicked(Map<String, Object> param) {}
public void onLongPressed(Map<String, Object> param) {}
public void onTouched(Map<String, Object> param) {}
public void onSwiped(int direction, Map<String, Object> param) {}
}
@@ -0,0 +1,58 @@
package com.tencent.qcloud.tuicore.interfaces;
import java.util.Map;
public class TUIExtensionInfo implements Comparable<TUIExtensionInfo> {
private int weight;
private String text;
private Object icon;
private Map<String, Object> data;
private TUIExtensionEventListener extensionListener;
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Object getIcon() {
return icon;
}
public void setIcon(Object icon) {
this.icon = icon;
}
public Map<String, Object> getData() {
return data;
}
public void setData(Map<String, Object> data) {
this.data = data;
}
public void setExtensionListener(TUIExtensionEventListener extensionListener) {
this.extensionListener = extensionListener;
}
public TUIExtensionEventListener getExtensionListener() {
return extensionListener;
}
@Override
public int compareTo(TUIExtensionInfo o) {
return o.getWeight() - this.weight;
}
}
@@ -0,0 +1,5 @@
package com.tencent.qcloud.tuicore.interfaces;
public abstract class TUILogListener {
public void onLog(int logLevel, String logContent) {}
}
@@ -0,0 +1,64 @@
package com.tencent.qcloud.tuicore.interfaces;
public class TUILoginConfig {
/**
* ## Do not output any SDK logs
*/
public static final int TUI_LOG_NONE = 0;
/**
* ## Output logs at the DEBUG, INFO, WARNING, and ERROR levels
*/
public static final int TUI_LOG_DEBUG = 3;
/**
* ## Output logs at the INFO, WARNING, and ERROR levels
*/
public static final int TUI_LOG_INFO = 4;
/**
* ## Output logs at the WARNING and ERROR levels
*/
public static final int TUI_LOG_WARN = 5;
/**
* ## Output logs at the ERROR level
*/
public static final int TUI_LOG_ERROR = 6;
// Log level
private int logLevel = TUI_LOG_INFO;
// Log callback
private TUILogListener tuiLogListener;
/**
* Configuration class constructor
*/
public TUILoginConfig() {}
/**
* Set the write log level. This operation must be performed before IM SDK initialization. Otherwise, the setting does not take effect.
*
* @param logLevel Log level
*/
public void setLogLevel(int logLevel) {
this.logLevel = logLevel;
}
public int getLogLevel() {
return this.logLevel;
}
/**
* Get the current log callback listener
*/
public TUILogListener getLogListener() {
return tuiLogListener;
}
/**
* Set the current log callback listener. This operation must be performed before IM SDK initialization.
* @note The callback is in the main thread. Log callbacks can be quite frequent, so be careful not to synchronize too many time-consuming tasks in the
* callback, which may block the main thread.
*/
public void setLogListener(TUILogListener logListener) {
this.tuiLogListener = logListener;
}
}
@@ -0,0 +1,40 @@
package com.tencent.qcloud.tuicore.interfaces;
public abstract class TUILoginListener {
/**
* SDK 正在连接到腾讯云服务器
*
* The SDK is connecting to the CVM instance
*/
public void onConnecting() {}
/**
* SDK 已经成功连接到腾讯云服务器
*
* The SDK is successfully connected to the CVM instance
*/
public void onConnectSuccess() {}
/**
* SDK 连接腾讯云服务器失败
*
* The SDK failed to connect to the CVM instance
*/
public void onConnectFailed(int code, String error) {}
/**
* 当前用户被踢下线,此时可以 UI 提示用户,并再次调用 TUILogin 的 login() 函数重新登录。
*
* The current user is kicked offline: the SDK notifies the user on the UI, and the user can choose to call the login() function of V2TIMManager to log in
* again.
*/
public void onKickedOffline() {}
/**
* 在线时票据过期:此时您需要生成新的 userSig 并再次调用 TUILogin 的 login() 函数重新登录。
*
* The ticket expires when the user is online: the user needs to generate a new userSig and call the login() function of V2TIMManager to log in again.
*/
public void onUserSigExpired() {
}
}
@@ -0,0 +1,7 @@
package com.tencent.qcloud.tuicore.interfaces;
import android.os.Bundle;
public abstract class TUIServiceCallback {
public abstract void onServiceCallback(int errorCode, String errorMessage, Bundle bundle);
}
@@ -0,0 +1,19 @@
package com.tencent.qcloud.tuicore.interfaces;
public abstract class TUIValueCallback<T> {
public abstract void onSuccess(T object);
public static <T> void onSuccess(TUIValueCallback<T> callback, T result) {
if (callback != null) {
callback.onSuccess(result);
}
}
public abstract void onError(int errorCode, String errorMessage);
public static <T> void onError(TUIValueCallback<T> callback, int errorCode, String errorMessage) {
if (callback != null) {
callback.onError(errorCode, errorMessage);
}
}
}
@@ -0,0 +1,232 @@
package com.tencent.qcloud.tuicore.permission;
import static com.tencent.qcloud.tuicore.permission.PermissionRequester.PERMISSION_NOTIFY_EVENT_KEY;
import static com.tencent.qcloud.tuicore.permission.PermissionRequester.PERMISSION_NOTIFY_EVENT_SUB_KEY;
import static com.tencent.qcloud.tuicore.permission.PermissionRequester.PERMISSION_RESULT;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.tencent.qcloud.tuicore.R;
import com.tencent.qcloud.tuicore.TUICore;
import com.tencent.qcloud.tuicore.util.TUIBuild;
import java.util.HashMap;
import java.util.Map;
@RequiresApi(api = Build.VERSION_CODES.M)
public class PermissionActivity extends Activity {
private static final String TAG = "PermissionActivity";
private static final int PERMISSION_REQUEST_CODE = 100;
private TextView mRationaleTitleTv;
private TextView mRationaleDescriptionTv;
private ImageView mPermissionIconIv;
private PermissionRequester.RequestData mRequestData;
private PermissionRequester.Result mResult = PermissionRequester.Result.Denied;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mRequestData = getPermissionRequest();
if (mRequestData == null || mRequestData.isPermissionsExistEmpty()) {
Log.e(TAG, "onCreate mRequestData exist empty permission");
finishWithResult(PermissionRequester.Result.Denied);
return;
}
Log.i(TAG, "onCreate : " + mRequestData.toString());
if (TUIBuild.getVersionInt() < Build.VERSION_CODES.M) {
finishWithResult(PermissionRequester.Result.Granted);
return;
}
makeBackGroundTransparent();
initView();
showPermissionRationale();
requestPermissions(mRequestData.getPermissions(), PERMISSION_REQUEST_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
hidePermissionRationale();
if (isAllPermissionsGranted(grantResults)) {
finishWithResult(PermissionRequester.Result.Granted);
return;
}
showSettingsTip();
}
private void showSettingsTip() {
if (mRequestData == null) {
return;
}
View tipLayout = LayoutInflater.from(this).inflate(R.layout.permission_tip_layout, null);
TextView tipsTv = tipLayout.findViewById(R.id.tips);
TextView positiveBtn = tipLayout.findViewById(R.id.positive_btn);
TextView negativeBtn = tipLayout.findViewById(R.id.negative_btn);
tipsTv.setText(mRequestData.getSettingsTip());
Dialog permissionTipDialog = new AlertDialog.Builder(this).setView(tipLayout).setCancelable(false).create();
positiveBtn.setOnClickListener(v -> {
permissionTipDialog.dismiss();
launchAppDetailsSettings();
finishWithResult(PermissionRequester.Result.Requesting);
});
negativeBtn.setOnClickListener(v -> {
permissionTipDialog.dismiss();
finishWithResult(PermissionRequester.Result.Denied);
});
permissionTipDialog.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
permissionTipDialog.dismiss();
}
return true;
});
Window dialogWindow = permissionTipDialog.getWindow();
dialogWindow.setBackgroundDrawable(new ColorDrawable());
WindowManager.LayoutParams layoutParams = dialogWindow.getAttributes();
layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
dialogWindow.setAttributes(layoutParams);
permissionTipDialog.show();
}
/**
* 启动应用程序的详细信息设置。
*
* Launch the application's details settings.
*/
private void launchAppDetailsSettings() {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.parse("package:" + getPackageName()));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).size() <= 0) {
Log.e(TAG, "launchAppDetailsSettings can not find system settings");
return;
}
startActivity(intent);
}
private void finishWithResult(PermissionRequester.Result result) {
Log.i(TAG, "finishWithResult : " + result);
mResult = result;
Map<String, Object> map = new HashMap<>(1);
map.put(PERMISSION_RESULT, result);
TUICore.notifyEvent(PERMISSION_NOTIFY_EVENT_KEY, PERMISSION_NOTIFY_EVENT_SUB_KEY, map);
finish();
}
/*
* APP 从异常中恢复时,有些 Activity 在 onCreate 时就会申请权限;同时对于异常恢复,所有 Activity 可能被干掉,从新走流程;
* 所以可能导致本次权限申请过早结束,此时须在 onDestroy 中返回结果。
*/
@Override
protected void onDestroy() {
super.onDestroy();
Map<String, Object> result = new HashMap<>(1);
result.put(PERMISSION_RESULT, mResult);
TUICore.notifyEvent(PERMISSION_NOTIFY_EVENT_KEY, PERMISSION_NOTIFY_EVENT_SUB_KEY, result);
}
private PermissionRequester.RequestData getPermissionRequest() {
Intent intent = getIntent();
if (intent == null) {
return null;
}
return intent.getParcelableExtra(PermissionRequester.PERMISSION_REQUEST_KEY);
}
@SuppressLint("NewApi")
private void makeBackGroundTransparent() {
if (TUIBuild.getVersionInt() >= Build.VERSION_CODES.LOLLIPOP) {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().setNavigationBarColor(Color.TRANSPARENT);
}
ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.hide();
}
}
private void initView() {
setContentView(R.layout.permission_activity_layout);
mRationaleTitleTv = findViewById(R.id.permission_reason_title);
mRationaleDescriptionTv = findViewById(R.id.permission_reason);
mPermissionIconIv = findViewById(R.id.permission_icon);
}
/**
* 安全合规要求,申请权限时,必须显示申请权限的理由。
*
* Security compliance requires that when applying for permission, the reason for applying for permission must be
* displayed.
*/
private void showPermissionRationale() {
if (mRequestData == null) {
return;
}
mRationaleTitleTv.setText(mRequestData.getTitle());
mRationaleDescriptionTv.setText(mRequestData.getDescription());
mPermissionIconIv.setBackgroundResource(mRequestData.getPermissionIconId());
mRationaleTitleTv.setVisibility(View.VISIBLE);
mRationaleDescriptionTv.setVisibility(View.VISIBLE);
mPermissionIconIv.setVisibility(View.VISIBLE);
}
private void hidePermissionRationale() {
mRationaleTitleTv.setVisibility(View.INVISIBLE);
mRationaleDescriptionTv.setVisibility(View.INVISIBLE);
mPermissionIconIv.setVisibility(View.INVISIBLE);
}
private boolean isAllPermissionsGranted(@NonNull int[] grantResults) {
for (int result : grantResults) {
if (result != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return true;
}
}
@@ -0,0 +1,9 @@
package com.tencent.qcloud.tuicore.permission;
public abstract class PermissionCallback {
public abstract void onGranted();
public void onRequesting() {}
public void onDenied() {}
}
@@ -0,0 +1,322 @@
package com.tencent.qcloud.tuicore.permission;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.Size;
import androidx.core.content.ContextCompat;
import com.tencent.qcloud.tuicore.TUIConfig;
import com.tencent.qcloud.tuicore.TUICore;
import com.tencent.qcloud.tuicore.interfaces.ITUINotification;
import com.tencent.qcloud.tuicore.util.TUIBuild;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
public class PermissionRequester {
private static final String TAG = "PermissionRequester";
public static final String PERMISSION_NOTIFY_EVENT_KEY = "PERMISSION_NOTIFY_EVENT_KEY";
public static final String PERMISSION_NOTIFY_EVENT_SUB_KEY = "PERMISSION_NOTIFY_EVENT_SUB_KEY";
public static final String PERMISSION_RESULT = "PERMISSION_RESULT";
public static final String PERMISSION_REQUEST_KEY = "PERMISSION_REQUEST_KEY";
private static final Object sLock = new Object();
private static AtomicBoolean sIsRequesting = new AtomicBoolean(false);
private PermissionCallback mPermissionCallback;
private String[] mPermissions;
private String mTitle;
private String mDescription;
private String mSettingsTip;
private ITUINotification mPermissionNotification;
public enum Result { Granted, Denied, Requesting }
private PermissionRequester(String... permissions) {
mPermissions = permissions;
mPermissionNotification = (key, subKey, param) -> {
if (param == null) {
return;
}
Object result = param.get(PERMISSION_RESULT);
if (result == null) {
return;
}
notifyPermissionRequestResult((Result) result);
};
}
/**
* 生成 PermissionRequester 的实例,其中参数为具体需要申请的权限,可以传入一个或多个权限。
*
* @param permissions 需要申请的权限名称。
* @return PermissionRequester 的实例。
*
* Generate an instance of PermissionRequester, where the parameters are the specific permissions that need to be
* applied for, and one or more permissions can be passed in.
*
* @param permissions The name of the permission that needs to be applied for.
* @return An instance of PermissionRequester.
*/
public static PermissionRequester newInstance(@NonNull @Size(min = 1) String... permissions) {
return new PermissionRequester(permissions);
}
/**
* 理由的标题:安全合规要求,请求权限时,须向用户解释为什么需要申请该权限;
*
* @param title 理由的标题;
* @return PermissionRequester 的实例。
*
* The title of the reason: security compliance requirements, when requesting permission, you
* must explain to the user why you need to apply for the permission;
*
* @param title The title of the reason;
* @return An instance of PermissionRequester.
*/
public PermissionRequester title(@NonNull String title) {
mTitle = title;
return this;
}
/**
* 理由的正文:安全合规要求,请求权限时,须向用户解释为什么需要申请该权限;
*
* @param description 理由的正文;
* @return PermissionRequester 的实例。
*
* The text of the reason: security compliance requirements, when requesting permission,
* explain to the user why the permission is required;
*
* @param description The text of the reason;
* @return An instance of PermissionRequester.
*/
public PermissionRequester description(@NonNull String description) {
mDescription = description;
return this;
}
/**
* 向用户说明到 Settings 后需要打开什么权限,以保证功能的正常运行;
*
* @param settingsTip 提示用户到设置中做什么;
* @return PermissionRequester 的实例。
*
* Explain to the user what permissions need to be opened after entering the Settings to
* ensure the normal operation of the function;
*
* @param settingsTip Prompt user what to do in settings;
* @return An instance of PermissionRequester.
*/
public PermissionRequester settingsTip(@NonNull String settingsTip) {
mSettingsTip = settingsTip;
return this;
}
/**
* 设置用于获取权限申请结果的回调。
*
* @param callback 权限申请的回调;
* @return PermissionRequester 的实例。
*
* Set the callback used to get the permission application result.
*
* @param callback callback for permission application;
* @return An instance of PermissionRequester.
*/
public PermissionRequester callback(@NonNull PermissionCallback callback) {
mPermissionCallback = callback;
return this;
}
/**
* 开始请求权限。
*
* Start requesting permission.
*/
@SuppressLint("NewApi")
public void request() {
synchronized (sLock) {
if (sIsRequesting.get()) {
Log.e(TAG, "can not request during requesting");
mPermissionCallback.onDenied();
return;
}
sIsRequesting.set(true);
}
TUICore.registerEvent(PERMISSION_NOTIFY_EVENT_KEY, PERMISSION_NOTIFY_EVENT_SUB_KEY, mPermissionNotification);
if (TUIBuild.getVersionInt() < Build.VERSION_CODES.M) {
Log.i(TAG, "current version is lower than 23");
notifyPermissionRequestResult(Result.Granted);
return;
}
String[] unauthorizedPermissions = findUnauthorizedPermissions(mPermissions);
if (unauthorizedPermissions.length <= 0) {
notifyPermissionRequestResult(Result.Granted);
return;
}
RequestData realRequest = new RequestData(mTitle, mDescription, mSettingsTip, unauthorizedPermissions);
startPermissionActivity(realRequest);
}
public boolean has() {
for (String permission : mPermissions) {
if (!has(permission)) {
return false;
}
}
return true;
}
private boolean has(final String permission) {
return TUIBuild.getVersionInt() < Build.VERSION_CODES.M
|| PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(TUIConfig.getAppContext(), permission);
}
private void notifyPermissionRequestResult(Result result) {
TUICore.unRegisterEvent(PERMISSION_NOTIFY_EVENT_KEY, PERMISSION_NOTIFY_EVENT_SUB_KEY, mPermissionNotification);
sIsRequesting.set(false);
if (mPermissionCallback == null) {
return;
}
if (Result.Granted.equals(result)) {
mPermissionCallback.onGranted();
} else if (Result.Requesting.equals(result)) {
mPermissionCallback.onRequesting();
} else {
mPermissionCallback.onDenied();
}
mPermissionCallback = null;
}
private String[] findUnauthorizedPermissions(String[] permissions) {
Context appContext = TUIConfig.getAppContext();
if (appContext == null) {
Log.e(TAG, "findUnauthorizedPermissions appContext is null");
return permissions;
}
List<String> unauthorizedList = new LinkedList<>();
for (String permission : permissions) {
if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(appContext, permission)) {
unauthorizedList.add(permission);
}
}
return unauthorizedList.toArray(new String[0]);
}
@RequiresApi(api = Build.VERSION_CODES.M)
private void startPermissionActivity(RequestData request) {
Context context = TUIConfig.getAppContext();
if (context == null) {
return;
}
Intent intent = new Intent(context, PermissionActivity.class);
intent.putExtra(PERMISSION_REQUEST_KEY, request);
// 在Activity之外startActivity需要添加FLAG_ACTIVITY_NEW_TASK,否则会crash
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
static class RequestData implements Parcelable {
private final String[] mPermissions;
private final String mTitle;
private final String mDescription;
private final String mSettingsTip;
private int mPermissionIconId;
public RequestData(@NonNull String title, @NonNull String description, @NonNull String settingsTip, @NonNull String... perms) {
mTitle = title;
mDescription = description;
mSettingsTip = settingsTip;
mPermissions = perms.clone();
}
protected RequestData(Parcel in) {
mPermissions = in.createStringArray();
mTitle = in.readString();
mDescription = in.readString();
mSettingsTip = in.readString();
mPermissionIconId = in.readInt();
}
public static final Creator<RequestData> CREATOR = new Creator<RequestData>() {
@Override
public RequestData createFromParcel(Parcel in) {
return new RequestData(in);
}
@Override
public RequestData[] newArray(int size) {
return new RequestData[size];
}
};
public boolean isPermissionsExistEmpty() {
if (mPermissions == null || mPermissions.length <= 0) {
return true;
}
for (String permission : mPermissions) {
if (TextUtils.isEmpty(permission)) {
return true;
}
}
return false;
}
public String[] getPermissions() {
return mPermissions.clone();
}
public String getTitle() {
return mTitle;
}
public String getDescription() {
return mDescription;
}
public String getSettingsTip() {
return mSettingsTip;
}
public int getPermissionIconId() {
return mPermissionIconId;
}
public void setPermissionIconId(int permissionIconId) {
mPermissionIconId = permissionIconId;
}
@Override
public String toString() {
return "PermissionRequest{"
+ "mPermissions=" + Arrays.toString(mPermissions) + ", mTitle=" + mTitle + ", mDescription='" + mDescription + ", mSettingsTip='" + mSettingsTip
+ '}';
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeStringArray(mPermissions);
dest.writeString(mTitle);
dest.writeString(mDescription);
dest.writeString(mSettingsTip);
dest.writeInt(mPermissionIconId);
}
}
}
@@ -0,0 +1,23 @@
package com.tencent.qcloud.tuicore.util;
import android.os.Handler;
import android.os.Looper;
public class BackgroundTasks {
private static final BackgroundTasks instance = new BackgroundTasks();
private final Handler handler = new Handler(Looper.getMainLooper());
public static BackgroundTasks getInstance() {
return instance;
}
private BackgroundTasks() {}
public void runOnUiThread(Runnable runnable) {
handler.post(runnable);
}
public boolean postDelayed(Runnable r, long delayMillis) {
return handler.postDelayed(r, delayMillis);
}
}
@@ -0,0 +1,154 @@
package com.tencent.qcloud.tuicore.util;
import android.content.Context;
import com.tencent.qcloud.tuicore.R;
import com.tencent.qcloud.tuicore.TUIConfig;
import com.tencent.qcloud.tuicore.TUIThemeManager;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class DateTimeUtil {
private static final long minute = 60 * 1000;
private static final long hour = 60 * minute;
private static final long day = 24 * hour;
private static final long week = 7 * day;
private static final long month = 31 * day;
private static final long year = 12 * month;
/**
* return format text for time
* you can see https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html
* todayHH:MM
* this weekSunday, Friday ..
* this yearMM/DD
* before this yearYYYY/MM/DD
* @param date current time
* @return format text
*/
public static String getTimeFormatText(Date date) {
if (date == null) {
return "";
}
Context context = TUIConfig.getAppContext();
Locale locale;
if (context == null) {
locale = Locale.getDefault();
} else {
locale = TUIThemeManager.getInstance().getLocale(context);
}
String timeText;
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_WEEK, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_YEAR, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
long yearStartTimeInMillis = calendar.getTimeInMillis();
long outTimeMillis = date.getTime();
long weekStartTimeInMillis = calendar.getTimeInMillis();
long dayStartTimeInMillis = calendar.getTimeInMillis();
if (outTimeMillis < yearStartTimeInMillis) {
timeText = String.format(locale, "%tD", date);
} else if (outTimeMillis < weekStartTimeInMillis) {
timeText = String.format(locale, "%1$tm/%1$td", date);
} else if (outTimeMillis < dayStartTimeInMillis) {
timeText = String.format(locale, "%tA", date);
} else {
timeText = String.format(locale, "%tR", date);
}
return timeText;
}
/**
* HH:MM
* @param date current time
* @return format text e.g. "12:12"
*/
public static String getHMTimeString(Date date) {
if (date == null) {
return "";
}
Context context = TUIConfig.getAppContext();
Locale locale;
if (context == null) {
locale = Locale.getDefault();
} else {
locale = TUIThemeManager.getInstance().getLocale(context);
}
return String.format(locale, "%tR", date);
}
public static String formatSeconds(long seconds) {
Context context = TUIConfig.getAppContext();
String timeStr = seconds + context.getString(R.string.date_second_short);
if (seconds > 60) {
long second = seconds % 60;
long min = seconds / 60;
timeStr = min + context.getString(R.string.date_minute_short) + second + context.getString(R.string.date_second_short);
if (min > 60) {
min = (seconds / 60) % 60;
long hour = (seconds / 60) / 60;
timeStr = hour + context.getString(R.string.date_hour_short) + min + context.getString(R.string.date_minute_short) + second
+ context.getString(R.string.date_second_short);
if (hour % 24 == 0) {
long day = (((seconds / 60) / 60) / 24);
timeStr = day + context.getString(R.string.date_day_short);
} else if (hour > 24) {
hour = ((seconds / 60) / 60) % 24;
long day = (((seconds / 60) / 60) / 24);
timeStr = day + context.getString(R.string.date_day_short) + hour + context.getString(R.string.date_hour_short) + min
+ context.getString(R.string.date_minute_short) + second + context.getString(R.string.date_second_short);
}
}
}
return timeStr;
}
public static String formatSecondsTo00(int timeSeconds) {
int second = timeSeconds % 60;
int minuteTemp = timeSeconds / 60;
if (minuteTemp > 0) {
int minute = minuteTemp % 60;
int hour = minuteTemp / 60;
if (hour > 0) {
return (hour >= 10 ? (hour + "") : ("0" + hour)) + ":" + (minute >= 10 ? (minute + "") : ("0" + minute)) + ":"
+ (second >= 10 ? (second + "") : ("0" + second));
} else {
return (minute >= 10 ? (minute + "") : ("0" + minute)) + ":" + (second >= 10 ? (second + "") : ("0" + second));
}
} else {
return "00:" + (second >= 10 ? (second + "") : ("0" + second));
}
}
public static long getStringToDate(String dateString, String pattern) {
SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
Date date = new Date();
try {
date = dateFormat.parse(dateString);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return date.getTime();
}
public static String getTimeStringFromDate(Date date, String pattern) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
return simpleDateFormat.format(date);
}
}
@@ -0,0 +1,428 @@
package com.tencent.qcloud.tuicore.util;
import com.tencent.imsdk.BaseConstants;
import com.tencent.qcloud.tuicore.R;
import com.tencent.qcloud.tuicore.TUIConfig;
import java.util.HashMap;
import java.util.Map;
public class ErrorMessageConverter {
public static final Map<Integer, Integer> ERROR_CODE_MAP = new HashMap<>();
static {
/////////////////////////////////////////////////////////////////////////////////
//
// (一)IM SDK 的错误码
// IM SDK error codes
//
/////////////////////////////////////////////////////////////////////////////////
// 通用错误码
// Common error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_IN_PROGESS, R.string.TUIKitErrorInProcess);
ERROR_CODE_MAP.put(BaseConstants.ERR_INVALID_PARAMETERS, R.string.TUIKitErrorInvalidParameters);
ERROR_CODE_MAP.put(BaseConstants.ERR_IO_OPERATION_FAILED, R.string.TUIKitErrorIOOperateFaild);
ERROR_CODE_MAP.put(BaseConstants.ERR_INVALID_JSON, R.string.TUIKitErrorInvalidJson);
ERROR_CODE_MAP.put(BaseConstants.ERR_OUT_OF_MEMORY, R.string.TUIKitErrorOutOfMemory);
ERROR_CODE_MAP.put(BaseConstants.ERR_PARSE_RESPONSE_FAILED, R.string.TUIKitErrorParseResponseFaild);
ERROR_CODE_MAP.put(BaseConstants.ERR_SERIALIZE_REQ_FAILED, R.string.TUIKitErrorSerializeReqFaild);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NOT_INITIALIZED, R.string.TUIKitErrorSDKNotInit);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOADMSG_FAILED, R.string.TUIKitErrorLoadMsgFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_DATABASE_OPERATE_FAILED, R.string.TUIKitErrorDatabaseOperateFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_COMM_CROSS_THREAD, R.string.TUIKitErrorCrossThread);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_COMM_TINYID_EMPTY, R.string.TUIKitErrorTinyIdEmpty);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_COMM_INVALID_IDENTIFIER, R.string.TUIKitErrorInvalidIdentifier);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_COMM_FILE_NOT_FOUND, R.string.TUIKitErrorFileNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_COMM_FILE_TOO_LARGE, R.string.TUIKitErrorFileTooLarge);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_COMM_FILE_SIZE_EMPTY, R.string.TUIKitErrorEmptyFile);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_COMM_FILE_OPEN_FAILED, R.string.TUIKitErrorFileOpenFailed);
// 帐号错误码
// Account error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NOT_LOGGED_IN, R.string.TUIKitErrorNotLogin);
ERROR_CODE_MAP.put(BaseConstants.ERR_NO_PREVIOUS_LOGIN, R.string.TUIKitErrorNoPreviousLogin);
ERROR_CODE_MAP.put(BaseConstants.ERR_USER_SIG_EXPIRED, R.string.TUIKitErrorUserSigExpired);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOGIN_KICKED_OFF_BY_OTHER, R.string.TUIKitErrorLoginKickedOffByOther);
// errorCodeMap.put(BaseConstants.ERR_LOGIN_IN_PROCESS:
// return @"登录正在执行中";
// errorCodeMap.put(BaseConstants.ERR_LOGOUT_IN_PROCESS:
// return @"登出正在执行中";
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_ACCOUNT_TLS_INIT_FAILED, R.string.TUIKitErrorTLSSDKInit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_ACCOUNT_TLS_NOT_INITIALIZED, R.string.TUIKitErrorTLSSDKUninit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_ACCOUNT_TLS_TRANSPKG_ERROR, R.string.TUIKitErrorTLSSDKTRANSPackageFormat);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_ACCOUNT_TLS_DECRYPT_FAILED, R.string.TUIKitErrorTLSDecrypt);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_ACCOUNT_TLS_REQUEST_FAILED, R.string.TUIKitErrorTLSSDKRequest);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_ACCOUNT_TLS_REQUEST_TIMEOUT, R.string.TUIKitErrorTLSSDKRequestTimeout);
// 消息错误码
// Message error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_INVALID_CONVERSATION, R.string.TUIKitErrorInvalidConveration);
ERROR_CODE_MAP.put(BaseConstants.ERR_FILE_TRANS_AUTH_FAILED, R.string.TUIKitErrorFileTransAuthFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_FILE_TRANS_NO_SERVER, R.string.TUIKitErrorFileTransNoServer);
ERROR_CODE_MAP.put(BaseConstants.ERR_FILE_TRANS_UPLOAD_FAILED, R.string.TUIKitErrorFileTransUploadFailed);
// errorCodeMap.put(BaseConstants.ERR_IMAGE_UPLOAD_FAILED_NOTIMAGE:
// return TUIKitLocalizableString(R.string.TUIKitErrorFileTransUploadFailedNotImage);
ERROR_CODE_MAP.put(BaseConstants.ERR_FILE_TRANS_DOWNLOAD_FAILED, R.string.TUIKitErrorFileTransDownloadFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_HTTP_REQ_FAILED, R.string.TUIKitErrorHTTPRequestFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_INVALID_MSG_ELEM, R.string.TUIKitErrorInvalidMsgElem);
ERROR_CODE_MAP.put(BaseConstants.ERR_INVALID_SDK_OBJECT, R.string.TUIKitErrorInvalidSDKObject);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_MSG_BODY_SIZE_LIMIT, R.string.TUIKitSDKMsgBodySizeLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_MSG_KEY_REQ_DIFFER_RSP, R.string.TUIKitErrorSDKMsgKeyReqDifferRsp);
// 群组错误码
// Group error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_INVALID_ID, R.string.TUIKitErrorSDKGroupInvalidID);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_INVALID_NAME, R.string.TUIKitErrorSDKGroupInvalidName);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_INVALID_INTRODUCTION, R.string.TUIKitErrorSDKGroupInvalidIntroduction);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_INVALID_NOTIFICATION, R.string.TUIKitErrorSDKGroupInvalidNotification);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_INVALID_FACE_URL, R.string.TUIKitErrorSDKGroupInvalidFaceURL);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_INVALID_NAME_CARD, R.string.TUIKitErrorSDKGroupInvalidNameCard);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_MEMBER_COUNT_LIMIT, R.string.TUIKitErrorSDKGroupMemberCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_JOIN_PRIVATE_GROUP_DENY, R.string.TUIKitErrorSDKGroupJoinPrivateGroupDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_INVITE_SUPER_DENY, R.string.TUIKitErrorSDKGroupInviteSuperDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_GROUP_INVITE_NO_MEMBER, R.string.TUIKitErrorSDKGroupInviteNoMember);
// 关系链错误码
// Relationship chain error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_FRIENDSHIP_INVALID_PROFILE_KEY, R.string.TUIKitErrorSDKFriendShipInvalidProfileKey);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_FRIENDSHIP_INVALID_ADD_REMARK, R.string.TUIKitErrorSDKFriendshipInvalidAddRemark);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_FRIENDSHIP_INVALID_ADD_WORDING, R.string.TUIKitErrorSDKFriendshipInvalidAddWording);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_FRIENDSHIP_INVALID_ADD_SOURCE, R.string.TUIKitErrorSDKFriendshipInvalidAddSource);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_FRIENDSHIP_FRIEND_GROUP_EMPTY, R.string.TUIKitErrorSDKFriendshipFriendGroupEmpty);
// 网络错误码
// Network error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_ENCODE_FAILED, R.string.TUIKitErrorSDKNetEncodeFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_DECODE_FAILED, R.string.TUIKitErrorSDKNetDecodeFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_AUTH_INVALID, R.string.TUIKitErrorSDKNetAuthInvalid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_COMPRESS_FAILED, R.string.TUIKitErrorSDKNetCompressFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_UNCOMPRESS_FAILED, R.string.TUIKitErrorSDKNetUncompressFaile);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_FREQ_LIMIT, R.string.TUIKitErrorSDKNetFreqLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_REQ_COUNT_LIMIT, R.string.TUIKitErrorSDKnetReqCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_DISCONNECT, R.string.TUIKitErrorSDKNetDisconnect);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_ALLREADY_CONN, R.string.TUIKitErrorSDKNetAllreadyConn);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_CONN_TIMEOUT, R.string.TUIKitErrorSDKNetConnTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_CONN_REFUSE, R.string.TUIKitErrorSDKNetConnRefuse);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_NET_UNREACH, R.string.TUIKitErrorSDKNetNetUnreach);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_SOCKET_NO_BUFF, R.string.TUIKitErrorSDKNetSocketNoBuff);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_RESET_BY_PEER, R.string.TUIKitERRORSDKNetResetByPeer);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_SOCKET_INVALID, R.string.TUIKitErrorSDKNetSOcketInvalid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_HOST_GETADDRINFO_FAILED, R.string.TUIKitErrorSDKNetHostGetAddressFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_CONNECT_RESET, R.string.TUIKitErrorSDKNetConnectReset);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_WAIT_INQUEUE_TIMEOUT, R.string.TUIKitErrorSDKNetWaitInQueueTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_WAIT_SEND_TIMEOUT, R.string.TUIKitErrorSDKNetWaitSendTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_NET_WAIT_ACK_TIMEOUT, R.string.TUIKitErrorSDKNetWaitAckTimeut);
/////////////////////////////////////////////////////////////////////////////////
//
// (二)服务端
// Server error codes
//
/////////////////////////////////////////////////////////////////////////////////
// 网络接入层的错误码
// Access layer error codes for network
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_CONNECT_LIMIT, R.string.TUIKitErrorSDKSVRSSOConnectLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_VCODE, R.string.TUIKitErrorSDKSVRSSOVCode);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_D2_EXPIRED, R.string.TUIKitErrorSVRSSOD2Expired);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_A2_UP_INVALID, R.string.TUIKitErrorSVRA2UpInvalid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_A2_DOWN_INVALID, R.string.TUIKitErrorSVRA2DownInvalid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_EMPTY_KEY, R.string.TUIKitErrorSVRSSOEmpeyKey);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_UIN_INVALID, R.string.TUIKitErrorSVRSSOUinInvalid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_VCODE_TIMEOUT, R.string.TUIKitErrorSVRSSOVCodeTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_NO_IMEI_AND_A2, R.string.TUIKitErrorSVRSSONoImeiAndA2);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_COOKIE_INVALID, R.string.TUIKitErrorSVRSSOCookieInvalid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_DOWN_TIP, R.string.TUIKitErrorSVRSSODownTips);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_DISCONNECT, R.string.TUIKitErrorSVRSSODisconnect);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_IDENTIFIER_INVALID, R.string.TUIKitErrorSVRSSOIdentifierInvalid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_CLIENT_CLOSE, R.string.TUIKitErrorSVRSSOClientClose);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_MSFSDK_QUIT, R.string.TUIKitErrorSVRSSOMSFSDKQuit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_D2KEY_WRONG, R.string.TUIKitErrorSVRSSOD2KeyWrong);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_UNSURPPORT, R.string.TUIKitErrorSVRSSOUnsupport);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_PREPAID_ARREARS, R.string.TUIKitErrorSVRSSOPrepaidArrears);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_PACKET_WRONG, R.string.TUIKitErrorSVRSSOPacketWrong);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_APPID_BLACK_LIST, R.string.TUIKitErrorSVRSSOAppidBlackList);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_CMD_BLACK_LIST, R.string.TUIKitErrorSVRSSOCmdBlackList);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_APPID_WITHOUT_USING, R.string.TUIKitErrorSVRSSOAppidWithoutUsing);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_FREQ_LIMIT, R.string.TUIKitErrorSVRSSOFreqLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_SSO_OVERLOAD, R.string.TUIKitErrorSVRSSOOverload);
// 资源文件错误码
// Resource file error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_RES_NOT_FOUND, R.string.TUIKitErrorSVRResNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_RES_ACCESS_DENY, R.string.TUIKitErrorSVRResAccessDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_RES_SIZE_LIMIT, R.string.TUIKitErrorSVRResSizeLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_RES_SEND_CANCEL, R.string.TUIKitErrorSVRResSendCancel);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_RES_READ_FAILED, R.string.TUIKitErrorSVRResReadFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_RES_TRANSFER_TIMEOUT, R.string.TUIKitErrorSVRResTransferTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_RES_INVALID_PARAMETERS, R.string.TUIKitErrorSVRResInvalidParameters);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_RES_INVALID_FILE_MD5, R.string.TUIKitErrorSVRResInvalidFileMd5);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_RES_INVALID_PART_MD5, R.string.TUIKitErrorSVRResInvalidPartMd5);
// 后台公共错误码
// Common backend error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_INVALID_HTTP_URL, R.string.TUIKitErrorSVRCommonInvalidHttpUrl);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_REQ_JSON_PARSE_FAILED, R.string.TUIKitErrorSVRCommomReqJsonParseFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_INVALID_ACCOUNT, R.string.TUIKitErrorSVRCommonInvalidAccount);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_INVALID_ACCOUNT_EX, R.string.TUIKitErrorSVRCommonInvalidAccount);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_INVALID_SDKAPPID, R.string.TUIKitErrorSVRCommonInvalidSdkappid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_REST_FREQ_LIMIT, R.string.TUIKitErrorSVRCommonRestFreqLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_REQUEST_TIMEOUT, R.string.TUIKitErrorSVRCommonRequestTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_INVALID_RES, R.string.TUIKitErrorSVRCommonInvalidRes);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_ID_NOT_ADMIN, R.string.TUIKitErrorSVRCommonIDNotAdmin);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_SDKAPPID_FREQ_LIMIT, R.string.TUIKitErrorSVRCommonSdkappidFreqLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_SDKAPPID_MISS, R.string.TUIKitErrorSVRCommonSdkappidMiss);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_RSP_JSON_PARSE_FAILED, R.string.TUIKitErrorSVRCommonRspJsonParseFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_EXCHANGE_ACCOUNT_TIMEUT, R.string.TUIKitErrorSVRCommonExchangeAccountTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_INVALID_ID_FORMAT, R.string.TUIKitErrorSVRCommonInvalidIdFormat);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_SDKAPPID_FORBIDDEN, R.string.TUIKitErrorSVRCommonSDkappidForbidden);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_REQ_FORBIDDEN, R.string.TUIKitErrorSVRCommonReqForbidden);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_REQ_FREQ_LIMIT, R.string.TUIKitErrorSVRCommonReqFreqLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_REQ_FREQ_LIMIT_EX, R.string.TUIKitErrorSVRCommonReqFreqLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_INVALID_SERVICE, R.string.TUIKitErrorSVRCommonInvalidService);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_SENSITIVE_TEXT, R.string.TUIKitErrorSVRCommonSensitiveText);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_COMM_BODY_SIZE_LIMIT, R.string.TUIKitErrorSVRCommonBodySizeLimit);
// 帐号错误码
// Account error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_USERSIG_EXPIRED, R.string.TUIKitErrorSVRAccountUserSigExpired);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_USERSIG_EMPTY, R.string.TUIKitErrorSVRAccountUserSigEmpty);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_USERSIG_CHECK_FAILED, R.string.TUIKitErrorSVRAccountUserSigCheckFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_USERSIG_CHECK_FAILED_EX, R.string.TUIKitErrorSVRAccountUserSigCheckFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_USERSIG_MISMATCH_PUBLICKEY, R.string.TUIKitErrorSVRAccountUserSigMismatchPublicKey);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_USERSIG_MISMATCH_ID, R.string.TUIKitErrorSVRAccountUserSigMismatchId);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_USERSIG_MISMATCH_SDKAPPID, R.string.TUIKitErrorSVRAccountUserSigMismatchSdkAppid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_USERSIG_PUBLICKEY_NOT_FOUND, R.string.TUIKitErrorSVRAccountUserSigPublicKeyNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_SDKAPPID_NOT_FOUND, R.string.TUIKitErrorSVRAccountUserSigSdkAppidNotFount);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_INVALID_USERSIG, R.string.TUIKitErrorSVRAccountInvalidUserSig);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_NOT_FOUND, R.string.TUIKitErrorSVRAccountNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_SEC_RSTR, R.string.TUIKitErrorSVRAccountSecRstr);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_INTERNAL_TIMEOUT, R.string.TUIKitErrorSVRAccountInternalTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_INVALID_COUNT, R.string.TUIKitErrorSVRAccountInvalidCount);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_INVALID_PARAMETERS, R.string.TUIkitErrorSVRAccountINvalidParameters);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_ADMIN_REQUIRED, R.string.TUIKitErrorSVRAccountAdminRequired);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_LOW_SDK_VERSION, R.string.TUIKitErrorSVRAccountLowSDKVersion);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_FREQ_LIMIT, R.string.TUIKitErrorSVRAccountFreqLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_BLACKLIST, R.string.TUIKitErrorSVRAccountBlackList);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_COUNT_LIMIT, R.string.TUIKitErrorSVRAccountCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_INTERNAL_ERROR, R.string.TUIKitErrorSVRAccountInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_ACCOUNT_USER_STATUS_DISABLED, R.string.TUIKitErrorEnableUserStatusOnConsole);
// 资料错误码
// Profile error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_INVALID_PARAMETERS, R.string.TUIKitErrorSVRProfileInvalidParameters);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_ACCOUNT_MISS, R.string.TUIKitErrorSVRProfileAccountMiss);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_ACCOUNT_NOT_FOUND, R.string.TUIKitErrorSVRProfileAccountNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_ADMIN_REQUIRED, R.string.TUIKitErrorSVRProfileAdminRequired);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_SENSITIVE_TEXT, R.string.TUIKitErrorSVRProfileSensitiveText);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_INTERNAL_ERROR, R.string.TUIKitErrorSVRProfileInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_READ_PERMISSION_REQUIRED, R.string.TUIKitErrorSVRProfileReadWritePermissionRequired);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_WRITE_PERMISSION_REQUIRED, R.string.TUIKitErrorSVRProfileReadWritePermissionRequired);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_TAG_NOT_FOUND, R.string.TUIKitErrorSVRProfileTagNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_SIZE_LIMIT, R.string.TUIKitErrorSVRProfileSizeLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_VALUE_ERROR, R.string.TUIKitErrorSVRProfileValueError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_PROFILE_INVALID_VALUE_FORMAT, R.string.TUIKitErrorSVRProfileInvalidValueFormat);
// 关系链错误码
// Relationship chain error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_INVALID_PARAMETERS, R.string.TUIKitErrorSVRFriendshipInvalidParameters);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_INVALID_SDKAPPID, R.string.TUIKitErrorSVRFriendshipInvalidSdkAppid);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_ACCOUNT_NOT_FOUND, R.string.TUIKitErrorSVRFriendshipAccountNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_ADMIN_REQUIRED, R.string.TUIKitErrorSVRFriendshipAdminRequired);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_SENSITIVE_TEXT, R.string.TUIKitErrorSVRFriendshipSensitiveText);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_INTERNAL_ERROR, R.string.TUIKitErrorSVRAccountInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_NET_TIMEOUT, R.string.TUIKitErrorSVRFriendshipNetTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_WRITE_CONFLICT, R.string.TUIKitErrorSVRFriendshipWriteConflict);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_ADD_FRIEND_DENY, R.string.TUIKitErrorSVRFriendshipAddFriendDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_COUNT_LIMIT, R.string.TUIkitErrorSVRFriendshipCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_GROUP_COUNT_LIMIT, R.string.TUIKitErrorSVRFriendshipGroupCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_PENDENCY_LIMIT, R.string.TUIKitErrorSVRFriendshipPendencyLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_BLACKLIST_LIMIT, R.string.TUIKitErrorSVRFriendshipBlacklistLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_PEER_FRIEND_LIMIT, R.string.TUIKitErrorSVRFriendshipPeerFriendLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_IN_SELF_BLACKLIST, R.string.TUIKitErrorSVRFriendshipInSelfBlacklist);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_ALLOW_TYPE_DENY_ANY, R.string.TUIKitErrorSVRFriendshipAllowTypeDenyAny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_IN_PEER_BLACKLIST, R.string.TUIKitErrorSVRFriendshipInPeerBlackList);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_ALLOW_TYPE_NEED_CONFIRM, R.string.TUIKitErrorSVRFriendshipAllowTypeNeedConfirm);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_ADD_FRIEND_SEC_RSTR, R.string.TUIKitErrorSVRFriendshipAddFriendSecRstr);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_PENDENCY_NOT_FOUND, R.string.TUIKitErrorSVRFriendshipPendencyNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_DEL_FRIEND_SEC_RSTR, R.string.TUIKitErrorSVRFriendshipDelFriendSecRstr);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_FRIENDSHIP_ACCOUNT_NOT_FOUND_EX, R.string.TUIKirErrorSVRFriendAccountNotFoundEx);
// 最近联系人错误码
// Error codes for recent contacts
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_CONV_ACCOUNT_NOT_FOUND, R.string.TUIKirErrorSVRFriendAccountNotFoundEx);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_CONV_INVALID_PARAMETERS, R.string.TUIKitErrorSVRFriendshipInvalidParameters);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_CONV_ADMIN_REQUIRED, R.string.TUIKitErrorSVRFriendshipAdminRequired);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_CONV_INTERNAL_ERROR, R.string.TUIKitErrorSVRAccountInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_CONV_NET_TIMEOUT, R.string.TUIKitErrorSVRFriendshipNetTimeout);
// 消息错误码
// Message error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_PKG_PARSE_FAILED, R.string.TUIKitErrorSVRMsgPkgParseFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INTERNAL_AUTH_FAILED, R.string.TUIKitErrorSVRMsgInternalAuthFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INVALID_ID, R.string.TUIKitErrorSVRMsgInvalidId);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_NET_ERROR, R.string.TUIKitErrorSVRMsgNetError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INTERNAL_ERROR1, R.string.TUIKitErrorSVRAccountInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_PUSH_DENY, R.string.TUIKitErrorSVRMsgPushDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_IN_PEER_BLACKLIST, R.string.TUIKitErrorSVRMsgInPeerBlackList);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_BOTH_NOT_FRIEND, R.string.TUIKitErrorSVRMsgBothNotFriend);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_NOT_PEER_FRIEND, R.string.TUIKitErrorSVRMsgNotPeerFriend);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_NOT_SELF_FRIEND, R.string.TUIkitErrorSVRMsgNotSelfFriend);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_SHUTUP_DENY, R.string.TUIKitErrorSVRMsgShutupDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_REVOKE_TIME_LIMIT, R.string.TUIKitErrorSVRMsgRevokeTimeLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_DEL_RAMBLE_INTERNAL_ERROR, R.string.TUIKitErrorSVRMsgDelRambleInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_JSON_PARSE_FAILED, R.string.TUIKitErrorSVRMsgJsonParseFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INVALID_JSON_BODY_FORMAT, R.string.TUIKitErrorSVRMsgInvalidJsonBodyFormat);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INVALID_TO_ACCOUNT, R.string.TUIKitErrorSVRMsgInvalidToAccount);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INVALID_RAND, R.string.TUIKitErrorSVRMsgInvalidRand);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INVALID_TIMESTAMP, R.string.TUIKitErrorSVRMsgInvalidTimestamp);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_BODY_NOT_ARRAY, R.string.TUIKitErrorSVRMsgBodyNotArray);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_ADMIN_REQUIRED, R.string.TUIKitErrorSVRAccountAdminRequired);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INVALID_JSON_FORMAT, R.string.TUIKitErrorSVRMsgInvalidJsonFormat);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_TO_ACCOUNT_COUNT_LIMIT, R.string.TUIKitErrorSVRMsgToAccountCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_TO_ACCOUNT_NOT_FOUND, R.string.TUIKitErrorSVRMsgToAccountNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_TIME_LIMIT, R.string.TUIKitErrorSVRMsgTimeLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INVALID_SYNCOTHERMACHINE, R.string.TUIKitErrorSVRMsgInvalidSyncOtherMachine);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INVALID_MSGLIFETIME, R.string.TUIkitErrorSVRMsgInvalidMsgLifeTime);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_ACCOUNT_NOT_FOUND, R.string.TUIKirErrorSVRFriendAccountNotFoundEx);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INTERNAL_ERROR2, R.string.TUIKitErrorSVRAccountInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INTERNAL_ERROR3, R.string.TUIKitErrorSVRAccountInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INTERNAL_ERROR4, R.string.TUIKitErrorSVRAccountInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_INTERNAL_ERROR5, R.string.TUIKitErrorSVRAccountInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_BODY_SIZE_LIMIT, R.string.TUIKitErrorSVRMsgBodySizeLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_MSG_LONGPOLLING_COUNT_LIMIT, R.string.TUIKitErrorSVRmsgLongPollingCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_INTERFACE_NOT_SUPPORT, R.string.TUIKitErrorUnsupporInterface);
// 群组错误码
// Group error codes
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_INTERNAL_ERROR, R.string.TUIKitErrorSVRAccountInternalError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_API_NAME_ERROR, R.string.TUIKitErrorSVRGroupApiNameError);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_INVALID_PARAMETERS, R.string.TUIKitErrorSVRResInvalidParameters);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_ACOUNT_COUNT_LIMIT, R.string.TUIKitErrorSVRGroupAccountCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_FREQ_LIMIT, R.string.TUIkitErrorSVRGroupFreqLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_PERMISSION_DENY, R.string.TUIKitErrorSVRGroupPermissionDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_INVALID_REQ, R.string.TUIKitErrorSVRGroupInvalidReq);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_SUPER_NOT_ALLOW_QUIT, R.string.TUIKitErrorSVRGroupSuperNotAllowQuit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_NOT_FOUND, R.string.TUIKitErrorSVRGroupNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_JSON_PARSE_FAILED, R.string.TUIKitErrorSVRGroupJsonParseFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_INVALID_ID, R.string.TUIKitErrorSVRGroupInvalidId);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_ALLREADY_MEMBER, R.string.TUIKitErrorSVRGroupAllreadyMember);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_FULL_MEMBER_COUNT, R.string.TUIKitErrorSVRGroupFullMemberCount);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_INVALID_GROUPID, R.string.TUIKitErrorSVRGroupInvalidGroupId);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY, R.string.TUIKitErrorSVRGroupRejectFromThirdParty);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_SHUTUP_DENY, R.string.TUIKitErrorSVRGroupShutDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_RSP_SIZE_LIMIT, R.string.TUIKitErrorSVRGroupRspSizeLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_ACCOUNT_NOT_FOUND, R.string.TUIKitErrorSVRGroupAccountNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_GROUPID_IN_USED, R.string.TUIKitErrorSVRGroupGroupIdInUse);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_SEND_MSG_FREQ_LIMIT, R.string.TUIKitErrorSVRGroupSendMsgFreqLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_REQ_ALLREADY_BEEN_PROCESSED, R.string.TUIKitErrorSVRGroupReqAllreadyBeenProcessed);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_GROUPID_IN_USED_FOR_SUPER, R.string.TUIKitErrorSVRGroupGroupIdUserdForSuper);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_SDKAPPID_DENY, R.string.TUIKitErrorSVRGroupSDkAppidDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_REVOKE_MSG_NOT_FOUND, R.string.TUIKitErrorSVRGroupRevokeMsgNotFound);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_REVOKE_MSG_TIME_LIMIT, R.string.TUIKitErrorSVRGroupRevokeMsgTimeLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_REVOKE_MSG_DENY, R.string.TUIKitErrorSVRGroupRevokeMsgDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_NOT_ALLOW_REVOKE_MSG, R.string.TUIKitErrorSVRGroupNotAllowRevokeMsg);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_REMOVE_MSG_DENY, R.string.TUIKitErrorSVRGroupRemoveMsgDeny);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_NOT_ALLOW_REMOVE_MSG, R.string.TUIKitErrorSVRGroupNotAllowRemoveMsg);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_AVCHATROOM_COUNT_LIMIT, R.string.TUIKitErrorSVRGroupAvchatRoomCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_COUNT_LIMIT, R.string.TUIKitErrorSVRGroupCountLimit);
ERROR_CODE_MAP.put(BaseConstants.ERR_SVR_GROUP_MEMBER_COUNT_LIMIT, R.string.TUIKitErrorSVRGroupMemberCountLimit);
/////////////////////////////////////////////////////////////////////////////////
//
// (三)V3版本错误码,待废弃
// IM SDK V3 error codes,to be abandoned
//
/////////////////////////////////////////////////////////////////////////////////
ERROR_CODE_MAP.put(BaseConstants.ERR_NO_SUCC_RESULT, R.string.TUIKitErrorSVRNoSuccessResult);
ERROR_CODE_MAP.put(BaseConstants.ERR_TO_USER_INVALID, R.string.TUIKitErrorSVRToUserInvalid);
ERROR_CODE_MAP.put(BaseConstants.ERR_INIT_CORE_FAIL, R.string.TUIKitErrorSVRInitCoreFail);
ERROR_CODE_MAP.put(BaseConstants.ERR_EXPIRED_SESSION_NODE, R.string.TUIKitErrorExpiredSessionNode);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOGGED_OUT_BEFORE_LOGIN_FINISHED, R.string.TUIKitErrorLoggedOutBeforeLoginFinished);
ERROR_CODE_MAP.put(BaseConstants.ERR_TLSSDK_NOT_INITIALIZED, R.string.TUIKitErrorTLSSDKNotInitialized);
ERROR_CODE_MAP.put(BaseConstants.ERR_TLSSDK_USER_NOT_FOUND, R.string.TUIKitErrorTLSSDKUserNotFound);
// errorCodeMap.put(BaseConstants.ERR_BIND_FAIL_UNKNOWN:
// return @"QALSDK未知原因BIND失败";
// errorCodeMap.put(BaseConstants.ERR_BIND_FAIL_NO_SSOTICKET:
// return @"缺少SSO票据";
// errorCodeMap.put(BaseConstants.ERR_BIND_FAIL_REPEATD_BIND:
// return @"重复BIND";
// errorCodeMap.put(BaseConstants.ERR_BIND_FAIL_TINYID_NULL:
// return @"tiny为空";
// errorCodeMap.put(BaseConstants.ERR_BIND_FAIL_GUID_NULL:
// return @"guid为空";
// errorCodeMap.put(BaseConstants.ERR_BIND_FAIL_UNPACK_REGPACK_FAILED:
// return @"解注册包失败";
ERROR_CODE_MAP.put(BaseConstants.ERR_BIND_FAIL_REG_TIMEOUT, R.string.TUIKitErrorBindFaildRegTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_BIND_FAIL_ISBINDING, R.string.TUIKitErrorBindFaildIsBinding);
ERROR_CODE_MAP.put(BaseConstants.ERR_PACKET_FAIL_UNKNOWN, R.string.TUIKitErrorPacketFailUnknown);
ERROR_CODE_MAP.put(BaseConstants.ERR_PACKET_FAIL_REQ_NO_NET, R.string.TUIKitErrorPacketFailReqNoNet);
ERROR_CODE_MAP.put(BaseConstants.ERR_PACKET_FAIL_RESP_NO_NET, R.string.TUIKitErrorPacketFailRespNoNet);
ERROR_CODE_MAP.put(BaseConstants.ERR_PACKET_FAIL_REQ_NO_AUTH, R.string.TUIKitErrorPacketFailReqNoAuth);
ERROR_CODE_MAP.put(BaseConstants.ERR_PACKET_FAIL_SSO_ERR, R.string.TUIKitErrorPacketFailSSOErr);
ERROR_CODE_MAP.put(BaseConstants.ERR_PACKET_FAIL_REQ_TIMEOUT, R.string.TUIKitErrorSVRRequestTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_PACKET_FAIL_RESP_TIMEOUT, R.string.TUIKitErrorPacketFailRespTimeout);
// errorCodeMap.put(BaseConstants.ERR_PACKET_FAIL_REQ_ON_RESEND:
// errorCodeMap.put(BaseConstants.ERR_PACKET_FAIL_RESP_NO_RESEND:
// errorCodeMap.put(BaseConstants.ERR_PACKET_FAIL_FLOW_SAVE_FILTERED:
// errorCodeMap.put(BaseConstants.ERR_PACKET_FAIL_REQ_OVER_LOAD:
// errorCodeMap.put(BaseConstants.ERR_PACKET_FAIL_LOGIC_ERR:
ERROR_CODE_MAP.put(BaseConstants.ERR_FRIENDSHIP_PROXY_NOT_SYNCED, R.string.TUIKitErrorFriendshipProxySyncing);
ERROR_CODE_MAP.put(BaseConstants.ERR_FRIENDSHIP_PROXY_SYNCING, R.string.TUIKitErrorFriendshipProxySyncing);
ERROR_CODE_MAP.put(BaseConstants.ERR_FRIENDSHIP_PROXY_SYNCED_FAIL, R.string.TUIKitErrorFriendshipProxySyncedFail);
ERROR_CODE_MAP.put(BaseConstants.ERR_FRIENDSHIP_PROXY_LOCAL_CHECK_ERR, R.string.TUIKitErrorFriendshipProxyLocalCheckErr);
ERROR_CODE_MAP.put(BaseConstants.ERR_GROUP_INVALID_FIELD, R.string.TUIKitErrorGroupInvalidField);
ERROR_CODE_MAP.put(BaseConstants.ERR_GROUP_STORAGE_DISABLED, R.string.TUIKitErrorGroupStoreageDisabled);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOADGRPINFO_FAILED, R.string.TUIKitErrorLoadGrpInfoFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_NO_NET_ON_REQ, R.string.TUIKitErrorReqNoNetOnReq);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_NO_NET_ON_RSP, R.string.TUIKitErrorReqNoNetOnResp);
ERROR_CODE_MAP.put(BaseConstants.ERR_SERIVCE_NOT_READY, R.string.TUIKitErrorServiceNotReady);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOGIN_AUTH_FAILED, R.string.TUIKitErrorLoginAuthFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_NEVER_CONNECT_AFTER_LAUNCH, R.string.TUIKitErrorNeverConnectAfterLaunch);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_FAILED, R.string.TUIKitErrorReqFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_INVALID_REQ, R.string.TUIKitErrorReqInvaidReq);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_OVERLOADED, R.string.TUIKitErrorReqOnverLoaded);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_KICK_OFF, R.string.TUIKitErrorReqKickOff);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_SERVICE_SUSPEND, R.string.TUIKitErrorReqServiceSuspend);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_INVALID_SIGN, R.string.TUIKitErrorReqInvalidSign);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_INVALID_COOKIE, R.string.TUIKitErrorReqInvalidCookie);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOGIN_TLS_RSP_PARSE_FAILED, R.string.TUIKitErrorLoginTlsRspParseFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOGIN_OPENMSG_TIMEOUT, R.string.TUIKitErrorLoginOpenMsgTimeout);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOGIN_OPENMSG_RSP_PARSE_FAILED, R.string.TUIKitErrorLoginOpenMsgRspParseFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOGIN_TLS_DECRYPT_FAILED, R.string.TUIKitErrorLoginTslDecryptFailed);
ERROR_CODE_MAP.put(BaseConstants.ERR_WIFI_NEED_AUTH, R.string.TUIKitErrorWifiNeedAuth);
ERROR_CODE_MAP.put(BaseConstants.ERR_USER_CANCELED, R.string.TUIKitErrorUserCanceled);
ERROR_CODE_MAP.put(BaseConstants.ERR_REVOKE_TIME_LIMIT_EXCEED, R.string.TUIkitErrorRevokeTimeLimitExceed);
ERROR_CODE_MAP.put(BaseConstants.ERR_LACK_UGC_EXT, R.string.TUIKitErrorLackUGExt);
ERROR_CODE_MAP.put(BaseConstants.ERR_AUTOLOGIN_NEED_USERSIG, R.string.TUIKitErrorAutoLoginNeedUserSig);
ERROR_CODE_MAP.put(BaseConstants.ERR_QAL_NO_SHORT_CONN_AVAILABLE, R.string.TUIKitErrorQALNoShortConneAvailable);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQ_CONTENT_ATTACK, R.string.TUIKitErrorReqContentAttach);
ERROR_CODE_MAP.put(BaseConstants.ERR_LOGIN_SIG_EXPIRE, R.string.TUIKitErrorLoginSigExpire);
ERROR_CODE_MAP.put(BaseConstants.ERR_SDK_HAD_INITIALIZED, R.string.TUIKitErrorSDKHadInit);
ERROR_CODE_MAP.put(BaseConstants.ERR_OPENBDH_BASE, R.string.TUIKitErrorOpenBDHBase);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQUEST_NO_NET_ONREQ, R.string.TUIKitErrorRequestNoNetOnReq);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQUEST_NO_NET_ONRSP, R.string.TUIKitErrorRequestNoNetOnRsp);
// errorCodeMap.put(BaseConstants.ERR_REQUEST_FAILED:
// return @"QAL执行失败";
// errorCodeMap.put(BaseConstants.ERR_REQUEST_INVALID_REQ:
// return @"请求非法,toMsgService非法";
ERROR_CODE_MAP.put(BaseConstants.ERR_REQUEST_OVERLOADED, R.string.TUIKitErrorRequestOnverLoaded);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQUEST_KICK_OFF, R.string.TUIKitErrorReqKickOff);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQUEST_SERVICE_SUSPEND, R.string.TUIKitErrorReqServiceSuspend);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQUEST_INVALID_SIGN, R.string.TUIKitErrorReqInvalidSign);
ERROR_CODE_MAP.put(BaseConstants.ERR_REQUEST_INVALID_COOKIE, R.string.TUIKitErrorReqInvalidCookie);
}
public static String convertIMError(int code, String msg) {
Integer errorStringId = ERROR_CODE_MAP.get(code);
if (errorStringId != null) {
return getLocalizedString(errorStringId);
}
return msg;
}
private static String getLocalizedString(int errStringId) {
return TUIConfig.getAppContext().getString(errStringId);
}
}
@@ -0,0 +1,611 @@
package com.tencent.qcloud.tuicore.util;
import android.Manifest;
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.StringDef;
import androidx.core.content.ContextCompat;
import com.tencent.qcloud.tuicore.R;
import com.tencent.qcloud.tuicore.TUIConfig;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public final class PermissionRequester {
private static final List<String> PERMISSIONS = getPermissions();
private static PermissionRequester instance;
private static Context applicationContext;
private SimpleCallback mSimpleCallback;
private FullCallback mFullCallback;
private PermissionDialogCallback mDialogCallback;
private Set<String> mPermissions;
private List<String> mPermissionsRequest;
private String mCurrentRequestPermission;
private List<String> mPermissionsGranted;
private List<String> mPermissionsDenied;
private static boolean isRequesting = false;
private String mReason;
private String mReasonTitle;
private String mDeniedAlert;
private int mIconId;
private static final Map<String, PermissionRequestContent> permissionRequestContentMap = new HashMap<>();
public static class PermissionRequestContent {
int iconResId;
String reasonTitle;
String reason;
String deniedAlert;
public void setReasonTitle(String reasonTitle) {
this.reasonTitle = reasonTitle;
}
public void setReason(String reason) {
this.reason = reason;
}
public void setIconResId(int iconResId) {
this.iconResId = iconResId;
}
public void setDeniedAlert(String deniedAlert) {
this.deniedAlert = deniedAlert;
}
}
public static void setPermissionRequestContent(String permission, PermissionRequestContent content) {
permissionRequestContentMap.put(permission, content);
}
/**
* Return the permissions used in application.
*
* @return the permissions used in application
*/
public static List<String> getPermissions() {
return getPermissions(getApplicationContext().getPackageName());
}
/**
* Return the permissions used in application.
*
* @param packageName The name of the package.
* @return the permissions used in application
*/
public static List<String> getPermissions(final String packageName) {
PackageManager pm = getApplicationContext().getPackageManager();
try {
String[] permissions = pm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS).requestedPermissions;
if (permissions == null) {
return Collections.emptyList();
}
return Arrays.asList(permissions);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return Collections.emptyList();
}
}
public static boolean isGranted(final String... permissions) {
for (String permission : permissions) {
if (!isGranted(permission)) {
return false;
}
}
return true;
}
private static boolean isGranted(final String permission) {
return TUIBuild.getVersionInt() < Build.VERSION_CODES.M
|| PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(getApplicationContext(), permission);
}
/**
* Launch the application's details settings.
*/
public static void launchAppDetailsSettings() {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.parse("package:" + getApplicationContext().getPackageName()));
if (!isIntentAvailable(intent)) {
return;
}
getApplicationContext().startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
/**
* Set the permissions.
*
* @param permission The permissions.
* @return the single {@link PermissionRequester} instance
*/
public static PermissionRequester permission(@PermissionConstants.Permission final String permission) {
return new PermissionRequester(permission);
}
private static boolean isIntentAvailable(final Intent intent) {
return getApplicationContext().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
}
private PermissionRequester(final String permission) {
mPermissions = new LinkedHashSet<>();
mCurrentRequestPermission = permission;
for (String aPermission : PermissionConstants.getPermissions(permission)) {
if (PERMISSIONS.contains(aPermission)) {
mPermissions.add(aPermission);
}
}
}
/**
* Set the simple call back.
*
* @param callback the simple call back
* @return the single {@link PermissionRequester} instance
*/
public PermissionRequester callback(final SimpleCallback callback) {
mSimpleCallback = callback;
return this;
}
/**
* Set the full call back.
*
* @param callback the full call back
* @return the single {@link PermissionRequester} instance
*/
public PermissionRequester callback(final FullCallback callback) {
mFullCallback = callback;
return this;
}
public PermissionRequester reason(String reason) {
mReason = reason;
return this;
}
public PermissionRequester reasonTitle(String reasonTitle) {
mReasonTitle = reasonTitle;
return this;
}
public PermissionRequester deniedAlert(String deniedAlert) {
mDeniedAlert = deniedAlert;
return this;
}
public PermissionRequester reasonIcon(int iconId) {
mIconId = iconId;
return this;
}
public PermissionRequester permissionDialogCallback(PermissionDialogCallback callback) {
mDialogCallback = callback;
return this;
}
public void request() {
if (isRequesting) {
return;
}
isRequesting = true;
instance = this;
mPermissionsGranted = new ArrayList<>();
mPermissionsRequest = new ArrayList<>();
if (TUIBuild.getVersionInt() < Build.VERSION_CODES.M) {
mPermissionsGranted.addAll(mPermissions);
isRequesting = false;
requestCallback();
mDialogCallback = null;
} else {
for (String permission : mPermissions) {
if (isGranted(permission)) {
mPermissionsGranted.add(permission);
} else {
mPermissionsRequest.add(permission);
}
}
if (mPermissionsRequest.isEmpty()) {
isRequesting = false;
requestCallback();
mDialogCallback = null;
} else {
startPermissionActivity();
}
}
}
@RequiresApi(api = Build.VERSION_CODES.M)
private void startPermissionActivity() {
mPermissionsDenied = new ArrayList<>();
Context context = getApplicationContext();
if (context == null) {
return;
}
Intent intent = new Intent(context, PermissionActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
private void getPermissionsStatus() {
for (String permission : mPermissionsRequest) {
if (isGranted(permission)) {
mPermissionsGranted.add(permission);
} else {
mPermissionsDenied.add(permission);
}
}
}
private void requestCallback() {
if (mSimpleCallback != null) {
if (mPermissionsRequest.size() == 0 || mPermissions.size() == mPermissionsGranted.size()) {
mSimpleCallback.onGranted();
} else {
if (!mPermissionsDenied.isEmpty()) {
mSimpleCallback.onDenied();
}
}
mSimpleCallback = null;
}
if (mFullCallback != null) {
if (mPermissionsRequest.size() == 0 || mPermissions.size() == mPermissionsGranted.size()) {
mFullCallback.onGranted(mPermissionsGranted);
} else {
if (!mPermissionsDenied.isEmpty()) {
mFullCallback.onDenied(mPermissionsDenied);
}
}
mFullCallback = null;
}
}
private void onRequestPermissionsResult(final Activity activity) {
getPermissionsStatus();
if (!mPermissionsDenied.isEmpty()) {
showPermissionDialog(activity, new PermissionDialogCallback() {
@Override
public void onApproved() {
if (mDialogCallback != null) {
mDialogCallback.onApproved();
}
mDialogCallback = null;
launchAppDetailsSettings();
}
@Override
public void onRefused() {
if (mDialogCallback != null) {
mDialogCallback.onRefused();
}
mDialogCallback = null;
}
});
} else {
isRequesting = false;
mDialogCallback = null;
activity.finish();
}
requestCallback();
}
@RequiresApi(api = Build.VERSION_CODES.M)
public static class PermissionActivity extends Activity {
private View mContentView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (TUIBuild.getVersionInt() >= Build.VERSION_CODES.LOLLIPOP) {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().setNavigationBarColor(Color.TRANSPARENT);
}
ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.hide();
}
requestPermission();
}
private void requestPermission() {
if (instance.mPermissionsRequest != null) {
int size = instance.mPermissionsRequest.size();
if (size <= 0) {
instance.onRequestPermissionsResult(this);
} else {
fillContentView();
requestPermissions(instance.mPermissionsRequest.toArray(new String[size]), 1);
}
}
}
private void fillContentView() {
PermissionRequestContent info = permissionRequestContentMap.get(instance.mCurrentRequestPermission);
int iconResId = instance.mIconId;
String reasonTitle = instance.mReasonTitle;
String reason = instance.mReason;
if (info != null) {
if (info.iconResId != 0) {
iconResId = info.iconResId;
}
if (!TextUtils.isEmpty(info.reasonTitle)) {
reasonTitle = info.reasonTitle;
}
if (!TextUtils.isEmpty(info.reason)) {
reason = info.reason;
}
}
if (TextUtils.isEmpty(reason)) {
return;
}
setContentView(R.layout.permission_activity_layout);
mContentView = findViewById(R.id.tuicore_permission_layout);
TextView permissionReasonTitle = findViewById(R.id.permission_reason_title);
TextView permissionReason = findViewById(R.id.permission_reason);
ImageView permissionIcon = findViewById(R.id.permission_icon);
permissionReasonTitle.setText(reasonTitle);
permissionReason.setText(reason);
if (iconResId != 0) {
permissionIcon.setBackgroundResource(iconResId);
}
}
private void hideContentView() {
if (mContentView != null) {
mContentView.setVisibility(View.INVISIBLE);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (instance.mPermissionsRequest != null) {
hideContentView();
instance.onRequestPermissionsResult(this);
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return true;
}
@Override
protected void onDestroy() {
super.onDestroy();
isRequesting = false;
}
}
///////////////////////////////////////////////////////////////////////////
// interface
///////////////////////////////////////////////////////////////////////////
public interface SimpleCallback {
void onGranted();
void onDenied();
}
public interface FullCallback {
void onGranted(List<String> permissionsGranted);
void onDenied(List<String> permissionsDenied);
}
public static final class PermissionConstants {
public static final String CALENDAR = Manifest.permission_group.CALENDAR;
public static final String CAMERA = Manifest.permission_group.CAMERA;
public static final String CONTACTS = Manifest.permission_group.CONTACTS;
public static final String LOCATION = Manifest.permission_group.LOCATION;
public static final String MICROPHONE = Manifest.permission_group.MICROPHONE;
public static final String PHONE = Manifest.permission_group.PHONE;
public static final String SENSORS = Manifest.permission_group.SENSORS;
public static final String SMS = Manifest.permission_group.SMS;
public static final String STORAGE = Manifest.permission_group.STORAGE;
private static final String[] GROUP_CALENDAR = {Manifest.permission.READ_CALENDAR, Manifest.permission.WRITE_CALENDAR};
private static final String[] GROUP_CAMERA = {Manifest.permission.CAMERA};
private static final String[] GROUP_CONTACTS = {
Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS, Manifest.permission.GET_ACCOUNTS};
private static final String[] GROUP_LOCATION = {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION};
private static final String[] GROUP_MICROPHONE = {Manifest.permission.RECORD_AUDIO};
private static final String[] GROUP_PHONE = {Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_PHONE_NUMBERS,
Manifest.permission.CALL_PHONE, Manifest.permission.READ_CALL_LOG, Manifest.permission.WRITE_CALL_LOG, Manifest.permission.ADD_VOICEMAIL,
Manifest.permission.USE_SIP, Manifest.permission.PROCESS_OUTGOING_CALLS, Manifest.permission.ANSWER_PHONE_CALLS};
private static final String[] GROUP_PHONE_BELOW_O = {Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_PHONE_NUMBERS,
Manifest.permission.CALL_PHONE, Manifest.permission.READ_CALL_LOG, Manifest.permission.WRITE_CALL_LOG, Manifest.permission.ADD_VOICEMAIL,
Manifest.permission.USE_SIP, Manifest.permission.PROCESS_OUTGOING_CALLS};
private static final String[] GROUP_SENSORS = {Manifest.permission.BODY_SENSORS};
private static final String[] GROUP_SMS = {
Manifest.permission.SEND_SMS,
Manifest.permission.RECEIVE_SMS,
Manifest.permission.READ_SMS,
Manifest.permission.RECEIVE_WAP_PUSH,
Manifest.permission.RECEIVE_MMS,
};
private static final String[] GROUP_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
};
@StringDef({
CALENDAR,
CAMERA,
CONTACTS,
LOCATION,
MICROPHONE,
PHONE,
SENSORS,
SMS,
STORAGE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface Permission {}
public static String[] getPermissions(@Permission final String permission) {
switch (permission) {
case CALENDAR:
return GROUP_CALENDAR;
case CAMERA:
return GROUP_CAMERA;
case CONTACTS:
return GROUP_CONTACTS;
case LOCATION:
return GROUP_LOCATION;
case MICROPHONE:
return GROUP_MICROPHONE;
case PHONE:
if (TUIBuild.getVersionInt() < Build.VERSION_CODES.O) {
return GROUP_PHONE_BELOW_O;
} else {
return GROUP_PHONE;
}
case SENSORS:
return GROUP_SENSORS;
case SMS:
return GROUP_SMS;
case STORAGE:
return GROUP_STORAGE;
default:
break;
}
return new String[] {permission};
}
}
private static Context getApplicationContext() {
if (applicationContext == null) {
applicationContext = TUIConfig.getAppContext();
}
return applicationContext;
}
public void showPermissionDialog(Activity activity, PermissionDialogCallback callback) {
PermissionRequestContent info = permissionRequestContentMap.get(instance.mCurrentRequestPermission);
String deniedAlert = mDeniedAlert;
if (info != null) {
if (!TextUtils.isEmpty(info.deniedAlert)) {
deniedAlert = info.deniedAlert;
}
}
if (TextUtils.isEmpty(deniedAlert)) {
deniedAlert = mReason;
}
if (TextUtils.isEmpty(deniedAlert)) {
isRequesting = false;
activity.finish();
callback.onRefused();
return;
}
activity.setContentView(R.layout.permission_activity_layout);
View itemPop = LayoutInflater.from(activity).inflate(R.layout.permission_tip_layout, null);
TextView tipsTv = itemPop.findViewById(R.id.tips);
TextView positiveBtn = itemPop.findViewById(R.id.positive_btn);
TextView negativeBtn = itemPop.findViewById(R.id.negative_btn);
tipsTv.setText(deniedAlert);
Dialog permissionTipDialog = new AlertDialog.Builder(activity)
.setView(itemPop)
.setCancelable(false)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
isRequesting = false;
}
})
.create();
positiveBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isRequesting = false;
permissionTipDialog.cancel();
activity.finish();
callback.onApproved();
}
});
negativeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isRequesting = false;
permissionTipDialog.cancel();
activity.finish();
callback.onRefused();
}
});
permissionTipDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
isRequesting = false;
permissionTipDialog.cancel();
activity.finish();
callback.onRefused();
}
return false;
}
});
permissionTipDialog.show();
Window dialogWindow = permissionTipDialog.getWindow();
dialogWindow.setBackgroundDrawable(new ColorDrawable());
WindowManager.LayoutParams layoutParams = dialogWindow.getAttributes();
layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
dialogWindow.setAttributes(layoutParams);
}
public interface PermissionDialogCallback {
void onApproved();
void onRefused();
}
}
@@ -0,0 +1,197 @@
package com.tencent.qcloud.tuicore.util;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import com.tencent.qcloud.tuicore.ServiceInitializer;
import java.util.HashMap;
import java.util.Map;
public class SPUtils {
public static final String DEFAULT_DATABASE = "tuikit";
private static final Map<String, SPUtils> SP_UTILS_MAP = new HashMap<>();
private final SharedPreferences mSharedPreferences;
public static SPUtils getInstance() {
return getInstance(DEFAULT_DATABASE, Context.MODE_PRIVATE);
}
public static SPUtils getInstance(final int mode) {
return getInstance(DEFAULT_DATABASE, mode);
}
public static SPUtils getInstance(String spName) {
return getInstance(spName, Context.MODE_PRIVATE);
}
public static SPUtils getInstance(String spName, final int mode) {
if (isSpace(spName)) {
spName = DEFAULT_DATABASE;
}
SPUtils spUtils = SP_UTILS_MAP.get(spName);
if (spUtils == null) {
synchronized (SPUtils.class) {
spUtils = SP_UTILS_MAP.get(spName);
if (spUtils == null) {
spUtils = new SPUtils(spName, mode);
SP_UTILS_MAP.put(spName, spUtils);
}
}
}
return spUtils;
}
private SPUtils(final String spName, final int mode) {
mSharedPreferences = getApplicationContext().getSharedPreferences(spName, mode);
}
private Context getApplicationContext() {
return ServiceInitializer.getAppContext();
}
public String getString(@NonNull final String key) {
return getString(key, "");
}
public String getString(@NonNull final String key, final String defaultValue) {
return mSharedPreferences.getString(key, defaultValue);
}
// String
public void put(@NonNull final String key, final String value) {
put(key, value, false);
}
public void put(@NonNull final String key, final String value, final boolean isCommit) {
if (isCommit) {
mSharedPreferences.edit().putString(key, value).commit();
} else {
mSharedPreferences.edit().putString(key, value).apply();
}
}
// boolean
public void put(@NonNull final String key, final boolean value) {
put(key, value, false);
}
public void put(@NonNull final String key, final boolean value, final boolean isCommit) {
if (isCommit) {
mSharedPreferences.edit().putBoolean(key, value).commit();
} else {
mSharedPreferences.edit().putBoolean(key, value).apply();
}
}
// int
public void put(@NonNull final String key, final int value) {
put(key, value, false);
}
public void put(@NonNull final String key, final int value, final boolean isCommit) {
if (isCommit) {
mSharedPreferences.edit().putInt(key, value).commit();
} else {
mSharedPreferences.edit().putInt(key, value).apply();
}
}
// float
public void put(@NonNull final String key, final float value) {
put(key, value, false);
}
public void put(@NonNull final String key, final float value, final boolean isCommit) {
if (isCommit) {
mSharedPreferences.edit().putFloat(key, value).commit();
} else {
mSharedPreferences.edit().putFloat(key, value).apply();
}
}
// long
public void put(@NonNull final String key, final long value) {
put(key, value, false);
}
public void put(@NonNull final String key, final long value, final boolean isCommit) {
if (isCommit) {
mSharedPreferences.edit().putLong(key, value).commit();
} else {
mSharedPreferences.edit().putLong(key, value).apply();
}
}
public boolean getBoolean(@NonNull final String key) {
return getBoolean(key, false);
}
public boolean getBoolean(@NonNull final String key, final boolean defaultValue) {
return mSharedPreferences.getBoolean(key, defaultValue);
}
public int getInt(@NonNull final String key) {
return getInt(key, -1);
}
public int getInt(@NonNull final String key, final int defaultValue) {
return mSharedPreferences.getInt(key, defaultValue);
}
public float getFloat(@NonNull final String key) {
return getFloat(key, -1f);
}
public float getFloat(@NonNull final String key, final float defaultValue) {
return mSharedPreferences.getFloat(key, defaultValue);
}
public long getLong(@NonNull final String key) {
return getLong(key, -1L);
}
public long getLong(@NonNull final String key, final long defaultValue) {
return mSharedPreferences.getLong(key, defaultValue);
}
public boolean contains(@NonNull final String key) {
return mSharedPreferences.contains(key);
}
public void remove(@NonNull final String key) {
remove(key, false);
}
public void remove(@NonNull final String key, final boolean isCommit) {
if (isCommit) {
mSharedPreferences.edit().remove(key).commit();
} else {
mSharedPreferences.edit().remove(key).apply();
}
}
public void clear() {
clear(false);
}
public void clear(final boolean isCommit) {
if (isCommit) {
mSharedPreferences.edit().clear().commit();
} else {
mSharedPreferences.edit().clear().apply();
}
}
private static boolean isSpace(final String s) {
if (s == null) {
return true;
}
for (int i = 0, len = s.length(); i < len; ++i) {
if (!Character.isWhitespace(s.charAt(i))) {
return false;
}
}
return true;
}
}
@@ -0,0 +1,83 @@
package com.tencent.qcloud.tuicore.util;
import android.content.Context;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Display;
import android.view.WindowManager;
import com.tencent.qcloud.tuicore.TUIConfig;
public class ScreenUtil {
private static final String TAG = ScreenUtil.class.getSimpleName();
public static int getScreenHeight(Context context) {
DisplayMetrics metric = new DisplayMetrics();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(metric);
return metric.heightPixels;
}
public static int getScreenWidth(Context context) {
DisplayMetrics metric = new DisplayMetrics();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(metric);
return metric.widthPixels;
}
public static int getPxByDp(float dp) {
float scale = TUIConfig.getAppContext().getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}
public static int getRealScreenHeight(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics dm = new DisplayMetrics();
display.getRealMetrics(dm);
return dm.heightPixels;
}
public static int getRealScreenWidth(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics dm = new DisplayMetrics();
display.getRealMetrics(dm);
return dm.widthPixels;
}
public static int getNavigationBarHeight(Context context) {
int resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
return context.getResources().getDimensionPixelSize(resourceId);
}
return 0;
}
public static int[] scaledSize(int containerWidth, int containerHeight, int realWidth, int realHeight) {
Log.i(TAG,
"scaledSize containerWidth: " + containerWidth + " containerHeight: " + containerHeight + " realWidth: " + realWidth
+ " realHeight: " + realHeight);
float deviceRate = (float) containerWidth / (float) containerHeight;
float rate = (float) realWidth / (float) realHeight;
int width = 0;
int height = 0;
if (rate < deviceRate) {
height = containerHeight;
width = (int) (containerHeight * rate);
} else {
width = containerWidth;
height = (int) (containerWidth / rate);
}
return new int[] {width, height};
}
public static int dip2px(float dpValue) {
final float scale = TUIConfig.getAppContext().getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
public static float dp2px(float dpValue, DisplayMetrics displayMetrics) {
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpValue, displayMetrics);
}
}
@@ -0,0 +1,187 @@
package com.tencent.qcloud.tuicore.util;
import android.os.Build;
import android.util.Log;
public final class TUIBuild {
private static final String TAG = "TUIBuild";
private static String MODEL = ""; // Build.MODEL;
private static String BRAND = ""; // Build.BRAND;
private static String DEVICE = ""; // Build.DEVICE;
private static String MANUFACTURER = ""; // Build.MANUFACTURER;
private static String HARDWARE = ""; // Build.HARDWARE;
private static String VERSION = ""; // Build.VERSION.RELEASE;
private static String BOARD = ""; // Build.BOARD;
private static String VERSION_INCREMENTAL = ""; // Build.VERSION.INCREMENTAL
private static int VERSION_INT = 0; // Build.VERSION.SDK_INT;
public static void setModel(final String model) {
synchronized (TUIBuild.class) {
MODEL = model;
}
}
public static String getModel() {
if (MODEL == null || MODEL.isEmpty()) {
synchronized (TUIBuild.class) {
if (MODEL == null || MODEL.isEmpty()) {
MODEL = Build.MODEL;
Log.i(TAG, "get MODEL by Build.MODEL :" + MODEL);
}
}
}
return MODEL;
}
public static void setBrand(final String brand) {
synchronized (TUIBuild.class) {
BRAND = brand;
}
}
public static String getBrand() {
if (BRAND == null || BRAND.isEmpty()) {
synchronized (TUIBuild.class) {
if (BRAND == null || BRAND.isEmpty()) {
BRAND = Build.BRAND;
Log.i(TAG, "get BRAND by Build.BRAND :" + BRAND);
}
}
}
return BRAND;
}
public static void setDevice(final String device) {
synchronized (TUIBuild.class) {
DEVICE = device;
}
}
public static String getDevice() {
if (DEVICE == null || DEVICE.isEmpty()) {
synchronized (TUIBuild.class) {
if (DEVICE == null || DEVICE.isEmpty()) {
DEVICE = Build.DEVICE;
Log.i(TAG, "get DEVICE by Build.DEVICE :" + DEVICE);
}
}
}
return DEVICE;
}
public static void setManufacturer(final String manufacturer) {
synchronized (TUIBuild.class) {
MANUFACTURER = manufacturer;
}
}
public static String getManufacturer() {
if (MANUFACTURER == null || MANUFACTURER.isEmpty()) {
synchronized (TUIBuild.class) {
if (MANUFACTURER == null || MANUFACTURER.isEmpty()) {
MANUFACTURER = Build.MANUFACTURER;
Log.i(TAG, "get MANUFACTURER by Build.MANUFACTURER :" + MANUFACTURER);
}
}
}
return MANUFACTURER;
}
public static void setHardware(final String hardware) {
synchronized (TUIBuild.class) {
HARDWARE = hardware;
}
}
public static String getHardware() {
if (HARDWARE == null || HARDWARE.isEmpty()) {
synchronized (TUIBuild.class) {
if (HARDWARE == null || HARDWARE.isEmpty()) {
HARDWARE = Build.HARDWARE;
Log.i(TAG, "get HARDWARE by Build.HARDWARE :" + HARDWARE);
}
}
}
return HARDWARE;
}
public static void setVersion(final String version) {
synchronized (TUIBuild.class) {
VERSION = version;
}
}
public static String getVersion() {
if (VERSION == null || VERSION.isEmpty()) {
synchronized (TUIBuild.class) {
if (VERSION == null || VERSION.isEmpty()) {
VERSION = Build.VERSION.RELEASE;
Log.i(TAG, "get VERSION by Build.VERSION.RELEASE :" + VERSION);
}
}
}
return VERSION;
}
public static void setVersionInt(final int versionInt) {
synchronized (TUIBuild.class) {
VERSION_INT = versionInt;
}
}
public static int getVersionInt() {
if (VERSION_INT == 0) {
synchronized (TUIBuild.class) {
if (VERSION_INT == 0) {
VERSION_INT = Build.VERSION.SDK_INT;
Log.i(TAG, "get VERSION_INT by Build.VERSION.SDK_INT :" + VERSION_INT);
}
}
}
return VERSION_INT;
}
public static void setVersionIncremental(final String versionIncremental) {
synchronized (TUIBuild.class) {
VERSION_INCREMENTAL = versionIncremental;
}
}
public static String getVersionIncremental() {
if (VERSION_INCREMENTAL == null || VERSION_INCREMENTAL.isEmpty()) {
synchronized (TUIBuild.class) {
if (VERSION_INCREMENTAL == null || VERSION_INCREMENTAL.isEmpty()) {
VERSION_INCREMENTAL = Build.VERSION.INCREMENTAL;
Log.i(TAG, "get VERSION_INCREMENTAL by Build.VERSION.INCREMENTAL :" + VERSION_INCREMENTAL);
}
}
}
return VERSION_INCREMENTAL;
}
public static void setBoard(final String board) {
synchronized (TUIBuild.class) {
BOARD = board;
}
}
public static String getBoard() {
if (BOARD == null || BOARD.isEmpty()) {
synchronized (TUIBuild.class) {
if (BOARD == null || BOARD.isEmpty()) {
BOARD = Build.BOARD;
Log.i(TAG, "get BOARD by Build.BOARD :" + BOARD);
}
}
}
return BOARD;
}
}
@@ -0,0 +1,48 @@
package com.tencent.qcloud.tuicore.util;
import android.os.Handler;
import android.os.Looper;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.qcloud.tuicore.ServiceInitializer;
public class ToastUtil {
private static final Handler handler = new Handler(Looper.getMainLooper());
private static Toast toast;
public static void toastLongMessage(final String message) {
toastMessage(message, true, Gravity.BOTTOM);
}
public static void toastShortMessage(final String message) {
toastMessage(message, false, Gravity.BOTTOM);
}
public static void show(final String message, boolean isLong, int gravity) {
toastMessage(message, isLong, gravity);
}
private static void toastMessage(final String message, boolean isLong, int gravity) {
handler.post(new Runnable() {
@Override
public void run() {
if (toast != null) {
toast.cancel();
toast = null;
}
toast = Toast.makeText(ServiceInitializer.getAppContext(), message, isLong ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
toast.setGravity(gravity, 0, 0);
View view = toast.getView();
if (view != null) {
TextView textView = view.findViewById(android.R.id.message);
if (textView != null) {
textView.setGravity(Gravity.CENTER);
}
}
toast.show();
}
});
}
}
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 颜色规范 start -->
<color name="core_light_bg_title_text_color_light">#FF000000</color>
<color name="core_light_bg_primary_text_color_light">#FF444444</color>
<color name="core_light_bg_secondary_text_color_light">#FF888888</color>
<color name="core_light_bg_secondary2_text_color_light">#FF999999</color>
<color name="core_light_bg_disable_text_color_light">#FFBBBBBB</color>
<color name="core_dark_bg_primary_text_color_light">#FFFFFFFF</color>
<color name="core_primary_bg_color_light">#FFFFFFFF</color>
<color name="core_bg_color_light">#FFF2F3F5</color>
<color name="core_primary_color_light">#FF147AFF</color>
<color name="core_error_tip_color_light">#FFFF584C</color>
<color name="core_success_tip_color_light">#FF26CB3E</color>
<color name="core_bubble_bg_color_light">#FFDCEAFD</color>
<color name="core_divide_color_light">#FFE5E5E5</color>
<color name="core_border_color_light">#FFDDDDDD</color>
<color name="core_header_start_color_light">#FFEBF0F6</color>
<color name="core_header_end_color_light">#FFEBF0F6</color>
<color name="core_header_text_color_light">#FF000000</color>
<color name="core_btn_normal_color_light">#FF147AFF</color>
<color name="core_btn_pressed_color_light">#FF0064E7</color>
<color name="core_btn_disable_color_light">#4D147AFF</color>
<!-- 颜色规范 end -->
</resources>
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TUIBaseLightTheme" parent="@style/TUIBaseTheme">
<!-- 颜色规范 start -->
<item name="core_light_bg_title_text_color">@color/core_light_bg_title_text_color_light</item>
<item name="core_light_bg_primary_text_color">@color/core_light_bg_primary_text_color_light</item>
<item name="core_light_bg_secondary_text_color">@color/core_light_bg_secondary_text_color_light</item>
<item name="core_light_bg_secondary2_text_color">@color/core_light_bg_secondary2_text_color_light</item>
<item name="core_light_bg_disable_text_color">@color/core_light_bg_disable_text_color_light</item>
<item name="core_dark_bg_primary_text_color">@color/core_dark_bg_primary_text_color_light</item>
<item name="core_primary_bg_color">@color/core_primary_bg_color_light</item>
<item name="core_bg_color">@color/core_bg_color_light</item>
<item name="core_primary_color">@color/core_primary_color_light</item>
<item name="core_error_tip_color">@color/core_error_tip_color_light</item>
<item name="core_success_tip_color">@color/core_success_tip_color_light</item>
<item name="core_bubble_bg_color">@color/core_bubble_bg_color_light</item>
<item name="core_divide_color">@color/core_divide_color_light</item>
<item name="core_border_color">@color/core_border_color_light</item>
<item name="core_header_start_color">@color/core_header_start_color_light</item>
<item name="core_header_end_color">@color/core_header_end_color_light</item>
<item name="core_header_text_color">@color/core_header_text_color_light</item>
<item name="core_btn_normal_color">@color/core_btn_normal_color_light</item>
<item name="core_btn_pressed_color">@color/core_btn_pressed_color_light</item>
<item name="core_btn_disable_color">@color/core_btn_disable_color_light</item>
<!-- 颜色规范 end -->
</style>
</resources>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 颜色规范 start -->
<color name="core_light_bg_title_text_color_lively">#FF000000</color>
<color name="core_light_bg_primary_text_color_lively">#FF444444</color>
<color name="core_light_bg_secondary_text_color_lively">#FF888888</color>
<color name="core_light_bg_secondary2_text_color_lively">#FF999999</color>
<color name="core_light_bg_disable_text_color_lively">#FFBBBBBB</color>
<color name="core_dark_bg_primary_text_color_lively">#FFFFFFFF</color>
<color name="core_primary_bg_color_lively">#FFFFFFFF</color>
<color name="core_bg_color_lively">#FFF2F3F5</color>
<color name="core_primary_color_lively">#FFFF8E82</color>
<color name="core_error_tip_color_lively">#FFFF584C</color>
<color name="core_success_tip_color_lively">#FF26CB3E</color>
<color name="core_bubble_bg_color_lively">#FF9D85</color>
<color name="core_divide_color_lively">#FFE5E5E5</color>
<color name="core_border_color_lively">#FFDDDDDD</color>
<color name="core_header_start_color_lively">#FFFF7B7B</color>
<color name="core_header_end_color_lively">#FFFFA88B</color>
<color name="core_header_text_color_lively">#FFFFFFFF</color>
<color name="core_btn_normal_color_lively">#FFFF8E82</color>
<color name="core_btn_pressed_color_lively">#FFF86657</color>
<color name="core_btn_disable_color_lively">#4DFF8E82</color>
<!-- 颜色规范 end -->
</resources>
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TUIBaseLivelyTheme" parent="@style/TUIBaseTheme">
<!-- 颜色规范 start -->
<item name="core_light_bg_title_text_color">@color/core_light_bg_title_text_color_lively</item>
<item name="core_light_bg_primary_text_color">@color/core_light_bg_primary_text_color_lively</item>
<item name="core_light_bg_secondary_text_color">@color/core_light_bg_secondary_text_color_lively</item>
<item name="core_light_bg_secondary2_text_color">@color/core_light_bg_secondary2_text_color_lively</item>
<item name="core_light_bg_disable_text_color">@color/core_light_bg_disable_text_color_lively</item>
<item name="core_dark_bg_primary_text_color">@color/core_dark_bg_primary_text_color_lively</item>
<item name="core_primary_bg_color">@color/core_primary_bg_color_lively</item>
<item name="core_bg_color">@color/core_bg_color_lively</item>
<item name="core_primary_color">@color/core_primary_color_lively</item>
<item name="core_error_tip_color">@color/core_error_tip_color_lively</item>
<item name="core_success_tip_color">@color/core_success_tip_color_lively</item>
<item name="core_bubble_bg_color">@color/core_bubble_bg_color_lively</item>
<item name="core_divide_color">@color/core_divide_color_lively</item>
<item name="core_border_color">@color/core_border_color_lively</item>
<item name="core_header_start_color">@color/core_header_start_color_lively</item>
<item name="core_header_end_color">@color/core_header_end_color_lively</item>
<item name="core_header_text_color">@color/core_header_text_color_lively</item>
<item name="core_btn_normal_color">@color/core_btn_normal_color_lively</item>
<item name="core_btn_pressed_color">@color/core_btn_pressed_color_lively</item>
<item name="core_btn_disable_color">@color/core_btn_disable_color_lively</item>
<!-- 颜色规范 end -->
</style>
</resources>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 颜色规范 start -->
<color name="core_light_bg_title_text_color_serious">#FF000000</color>
<color name="core_light_bg_primary_text_color_serious">#FF444444</color>
<color name="core_light_bg_secondary_text_color_serious">#FF888888</color>
<color name="core_light_bg_secondary2_text_color_serious">#FF999999</color>
<color name="core_light_bg_disable_text_color_serious">#FFBBBBBB</color>
<color name="core_dark_bg_primary_text_color_serious">#FFFFFFFF</color>
<color name="core_primary_bg_color_serious">#FFFFFFFF</color>
<color name="core_bg_color_serious">#FFF2F3F5</color>
<color name="core_primary_color_serious">#FF0052FF</color>
<color name="core_error_tip_color_serious">#FFFF584C</color>
<color name="core_success_tip_color_serious">#FF26CB3E</color>
<color name="core_bubble_bg_color_serious">#FF4F87FF</color>
<color name="core_divide_color_serious">#FFE5E5E5</color>
<color name="core_border_color_serious">#FFDDDDDD</color>
<color name="core_header_start_color_serious">#FF6395FF</color>
<color name="core_header_end_color_serious">#FF0052FF</color>
<color name="core_header_text_color_serious">#FFFFFFFF</color>
<color name="core_btn_normal_color_serious">#FF0052FF</color>
<color name="core_btn_pressed_color_serious">#FF0049E4</color>
<color name="core_btn_disable_color_serious">#4D0052FF</color>
<!-- 颜色规范 end -->
</resources>
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TUIBaseSeriousTheme" parent="@style/TUIBaseTheme">
<!-- 颜色规范 start -->
<item name="core_light_bg_title_text_color">@color/core_light_bg_title_text_color_serious</item>
<item name="core_light_bg_primary_text_color">@color/core_light_bg_primary_text_color_serious</item>
<item name="core_light_bg_secondary_text_color">@color/core_light_bg_secondary_text_color_serious</item>
<item name="core_light_bg_secondary2_text_color">@color/core_light_bg_secondary2_text_color_serious</item>
<item name="core_light_bg_disable_text_color">@color/core_light_bg_disable_text_color_serious</item>
<item name="core_dark_bg_primary_text_color">@color/core_dark_bg_primary_text_color_serious</item>
<item name="core_primary_bg_color">@color/core_primary_bg_color_serious</item>
<item name="core_bg_color">@color/core_bg_color_serious</item>
<item name="core_primary_color">@color/core_primary_color_serious</item>
<item name="core_error_tip_color">@color/core_error_tip_color_serious</item>
<item name="core_success_tip_color">@color/core_success_tip_color_serious</item>
<item name="core_bubble_bg_color">@color/core_bubble_bg_color_serious</item>
<item name="core_divide_color">@color/core_divide_color_serious</item>
<item name="core_border_color">@color/core_border_color_serious</item>
<item name="core_header_start_color">@color/core_header_start_color_serious</item>
<item name="core_header_end_color">@color/core_header_end_color_serious</item>
<item name="core_header_text_color">@color/core_header_text_color_serious</item>
<item name="core_btn_normal_color">@color/core_btn_normal_color_serious</item>
<item name="core_btn_pressed_color">@color/core_btn_pressed_color_serious</item>
<item name="core_btn_disable_color">@color/core_btn_disable_color_serious</item>
<!-- 颜色规范 end -->
</style>
</resources>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#E5E5E5"/>
<size
android:height="0.5dp"/>
</shape>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white"/>
<corners android:radius="7.68dp"/>
</shape>
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tuicore_permission_layout"
android:orientation="vertical"
android:background="#BF000000"
android:gravity="center_horizontal"
android:paddingTop="60dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/permission_icon"
android:scaleType="fitCenter"
android:layout_gravity="center"
android:layout_width="32dp"
android:layout_height="32dp"/>
<TextView
android:id="@+id/permission_reason_title"
android:textSize="17.28sp"
android:textColor="@color/white"
android:textStyle="bold"
android:layout_marginTop="8dp"
android:gravity="center"
android:layout_width="240dp"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/permission_reason"
android:layout_marginTop="8dp"
android:textSize="17sp"
android:gravity="center"
android:textColor="#BFFFFFFF"
android:layout_width="240dp"
android:layout_height="wrap_content" />
</LinearLayout>
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/core_permission_dialog_bg"
android:clickable="true"
android:orientation="vertical">
<TextView
android:id="@+id/tips_title"
android:textSize="15sp"
android:textStyle="bold"
android:gravity="center"
android:textColor="@color/black"
android:text="@string/core_permission_dialog_title"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/tips"
android:layout_marginTop="12dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="20dp"
android:textSize="15sp"
android:gravity="center"
android:textColor="#888888"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:background="#EEEEEE"
android:layout_width="match_parent"
android:layout_height="0.5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/negative_btn"
android:layout_marginTop="15dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="15dp"
android:gravity="center"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="15.55sp"
android:text="@string/cancel"
android:layout_weight="0.5"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:background="#EEEEEE"
android:layout_width="0.5dp"
android:layout_height="match_parent"/>
<TextView
android:id="@+id/positive_btn"
android:layout_marginTop="15dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="15dp"
android:text="@string/core_permission_dialog_positive_setting_text"
android:textSize="15.55sp"
android:textStyle="bold"
android:layout_weight="0.5"
android:textColor="?attr/core_primary_color"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
@@ -0,0 +1,292 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="TUIKitErrorInProcess">执行中</string>
<string name="TUIKitErrorInvalidParameters">参数无效</string>
<string name="TUIKitErrorIOOperateFaild">操作本地 IO 错误</string>
<string name="TUIKitErrorInvalidJson">错误的 JSON 格式</string>
<string name="TUIKitErrorOutOfMemory">内存不足</string>
<string name="TUIKitErrorParseResponseFaild">PB 解析失败</string>
<string name="TUIKitErrorSerializeReqFaild">PB 序列化失败</string>
<string name="TUIKitErrorSDKNotInit">IM SDK 未初始化</string>
<string name="TUIKitErrorLoadMsgFailed">加载本地数据库操作失败</string>
<string name="TUIKitErrorDatabaseOperateFailed">本地数据库操作失败</string>
<string name="TUIKitErrorCrossThread">跨线程错误</string>
<string name="TUIKitErrorTinyIdEmpty">用户信息为空</string>
<string name="TUIKitErrorInvalidIdentifier">Identifier 非法</string>
<string name="TUIKitErrorFileNotFound">文件不存在</string>
<string name="TUIKitErrorFileTooLarge">文件大小超出了限制</string>
<string name="TUIKitErrorEmptyFile">空文件</string>
<string name="TUIKitErrorFileOpenFailed">文件打开失败</string>
<string name="TUIKitErrorNotLogin">IM SDK 未登陆</string>
<string name="TUIKitErrorNoPreviousLogin">并没有登录过该用户</string>
<string name="TUIKitErrorUserSigExpired">UserSig 过期</string>
<string name="TUIKitErrorLoginKickedOffByOther">其他终端登录同一账号</string>
<string name="TUIKitErrorTLSSDKInit">TLS SDK 初始化失败</string>
<string name="TUIKitErrorTLSSDKUninit">TLS SDK 未初始化</string>
<string name="TUIKitErrorTLSSDKTRANSPackageFormat">TLS SDK TRANS 包格式错误</string>
<string name="TUIKitErrorTLSDecrypt">TLS SDK 解密失败</string>
<string name="TUIKitErrorTLSSDKRequest">TLS SDK 请求失败</string>
<string name="TUIKitErrorTLSSDKRequestTimeout">TLS SDK 请求超时</string>
<string name="TUIKitErrorInvalidConveration">会话无效</string>
<string name="TUIKitErrorFileTransAuthFailed">文件传输鉴权失败</string>
<string name="TUIKitErrorFileTransNoServer">文件传输获取 Server 列表失败</string>
<string name="TUIKitErrorFileTransUploadFailed">文件传输上传失败,请检查网络是否连接</string>
<string name="TUIKitErrorFileTransUploadFailedNotImage">文件传输上传失败,请检查上传的图片是否能够正常打开</string>
<string name="TUIKitErrorFileTransDownloadFailed">文件传输下载失败,请检查网络,或者文件、语音是否已经过期</string>
<string name="TUIKitErrorHTTPRequestFailed">HTTP 请求失败</string>
<string name="TUIKitErrorInvalidMsgElem">IM SDK 无效消息 elem</string>
<string name="TUIKitErrorInvalidSDKObject">无效的对象</string>
<string name="TUIKitSDKMsgBodySizeLimit">消息长度超出限制</string>
<string name="TUIKitErrorSDKMsgKeyReqDifferRsp">消息 KEY 错误</string>
<string name="TUIKitErrorSDKGroupInvalidID">群组 ID 非法,自定义群组 ID 必须为可打印 ASCII 字符(0x20-0x7e),最长48个字节,且前缀不能为 @TGS#</string>
<string name="TUIKitErrorSDKGroupInvalidName">群名称非法,群名称最长30字节</string>
<string name="TUIKitErrorSDKGroupInvalidIntroduction">群简介非法,群简介最长240字节</string>
<string name="TUIKitErrorSDKGroupInvalidNotification">群公告非法,群公告最长300字节</string>
<string name="TUIKitErrorSDKGroupInvalidFaceURL">群头像 URL 非法,群头像 URL 最长100字节</string>
<string name="TUIKitErrorSDKGroupInvalidNameCard">群名片非法,群名片最长50字节</string>
<string name="TUIKitErrorSDKGroupMemberCountLimit">超过群组成员数的限制</string>
<string name="TUIKitErrorSDKGroupJoinPrivateGroupDeny">不允许申请加入 Private 群组</string>
<string name="TUIKitErrorSDKGroupInviteSuperDeny">不允许邀请角色为群主的成员</string>
<string name="TUIKitErrorSDKGroupInviteNoMember">不允许邀请0个成员</string>
<string name="TUIKitErrorSDKFriendShipInvalidProfileKey">资料字段非法</string>
<string name="TUIKitErrorSDKFriendshipInvalidAddRemark">备注字段非法,最大96字节</string>
<string name="TUIKitErrorSDKFriendshipInvalidAddWording">请求添加好友的请求说明字段非法,最大120字节</string>
<string name="TUIKitErrorSDKFriendshipInvalidAddSource">请求添加好友的添加来源字段非法,来源需要添加“AddSource_Type_”前缀。</string>
<string name="TUIKitErrorSDKFriendshipFriendGroupEmpty">好友分组字段非法,必须不为空,每个分组的名称最长30字节</string>
<string name="TUIKitErrorSDKNetEncodeFailed">网络链接加密失败</string>
<string name="TUIKitErrorSDKNetDecodeFailed">网络链接解密失败</string>
<string name="TUIKitErrorSDKNetAuthInvalid">网络链接未完成鉴权</string>
<string name="TUIKitErrorSDKNetCompressFailed">数据包压缩失败</string>
<string name="TUIKitErrorSDKNetUncompressFaile">数据包解压失败</string>
<string name="TUIKitErrorSDKNetFreqLimit">调用频率限制,最大每秒发起 5 次请求</string>
<string name="TUIKitErrorSDKnetReqCountLimit">请求队列満,超过同时请求的数量限制,最大同时发起1000个请求。</string>
<string name="TUIKitErrorSDKNetDisconnect">网络已断开,未建立连接,或者建立 socket 连接时,检测到无网络。</string>
<string name="TUIKitErrorSDKNetAllreadyConn">网络连接已建立,重复创建连接</string>
<string name="TUIKitErrorSDKNetConnTimeout">建立网络连接超时,请等网络恢复后重试。</string>
<string name="TUIKitErrorSDKNetConnRefuse">网络连接已被拒绝,请求过于频繁,服务端拒绝服务。</string>
<string name="TUIKitErrorSDKNetNetUnreach">没有到达网络的可用路由,请等网络恢复后重试。</string>
<string name="TUIKitErrorSDKNetSocketNoBuff">系统中没有足够的缓冲区空间资源可用来完成调用,系统过于繁忙,内部错误。</string>
<string name="TUIKitERRORSDKNetResetByPeer">对端重置了连接</string>
<string name="TUIKitErrorSDKNetSOcketInvalid">socket 套接字无效</string>
<string name="TUIKitErrorSDKNetHostGetAddressFailed">IP 地址解析失败</string>
<string name="TUIKitErrorSDKNetConnectReset">网络连接到中间节点或服务端重置</string>
<string name="TUIKitErrorSDKNetWaitInQueueTimeout">请求包等待进入待发送队列超时</string>
<string name="TUIKitErrorSDKNetWaitSendTimeout">请求包已进入待发送队列,等待进入系统的网络 buffer 超时</string>
<string name="TUIKitErrorSDKNetWaitAckTimeut">请求包已进入系统的网络 buffer ,等待服务端回包超时</string>
<string name="TUIKitErrorSDKSVRSSOConnectLimit">Server 的连接数量超出限制,服务端拒绝服务。</string>
<string name="TUIKitErrorSDKSVRSSOVCode">验证码下发超时。</string>
<string name="TUIKitErrorSVRSSOD2Expired">Key 过期。Key 是根据 UserSig 生成的内部票据,Key 的有效期小于或等于 UserSig 的有效期。请重新调用 TIMManager.getInstance().login 登录接口生成新的 Key。</string>
<string name="TUIKitErrorSVRA2UpInvalid">Ticket 过期。Ticket 是根据 UserSig 生成的内部票据,Ticket 的有效期小于或等于 UserSig 的有效期。请重新调用 TIMManager.getInstance().login 登录接口生成新的 Ticket。</string>
<string name="TUIKitErrorSVRA2DownInvalid">票据验证没通过或者被安全打击。请重新调用 TIMManager.getInstance().login 登录接口生成新的票据。</string>
<string name="TUIKitErrorSVRSSOEmpeyKey">不允许空 Key。</string>
<string name="TUIKitErrorSVRSSOUinInvalid">Key 中的帐号和请求包头的帐号不匹配。</string>
<string name="TUIKitErrorSVRSSOVCodeTimeout">验证码下发超时。</string>
<string name="TUIKitErrorSVRSSONoImeiAndA2">需要带上 Key 和 Ticket。</string>
<string name="TUIKitErrorSVRSSOCookieInvalid">Cookie 检查不匹配。</string>
<string name="TUIKitErrorSVRSSODownTips">下发提示语,Key 过期。</string>
<string name="TUIKitErrorSVRSSODisconnect">断链锁屏。</string>
<string name="TUIKitErrorSVRSSOIdentifierInvalid">失效身份。</string>
<string name="TUIKitErrorSVRSSOClientClose">终端自动退出。</string>
<string name="TUIKitErrorSVRSSOMSFSDKQuit">MSFSDK 自动退出。</string>
<string name="TUIKitErrorSVRSSOD2KeyWrong">解密失败次数超过阈值,通知终端需要重置,请重新调用 TIMManager.getInstance().login 登录接口生成新的 Key。</string>
<string name="TUIKitErrorSVRSSOUnsupport">不支持聚合,给终端返回统一的错误码。终端在该 TCP 长连接上停止聚合。</string>
<string name="TUIKitErrorSVRSSOPrepaidArrears">预付费欠费。</string>
<string name="TUIKitErrorSVRSSOPacketWrong">请求包格式错误。</string>
<string name="TUIKitErrorSVRSSOAppidBlackList">SDKAppID 黑名单。</string>
<string name="TUIKitErrorSVRSSOCmdBlackList">SDKAppID 设置 service cmd 黑名单。</string>
<string name="TUIKitErrorSVRSSOAppidWithoutUsing">SDKAppID 停用。</string>
<string name="TUIKitErrorSVRSSOFreqLimit">频率限制(用户),频率限制是设置针对某一个协议的每秒请求数的限制。</string>
<string name="TUIKitErrorSVRSSOOverload">过载丢包(系统),连接的服务端处理过多请求,处理不过来,拒绝服务。</string>
<string name="TUIKitErrorSVRResNotFound">要发送的资源文件不存在。</string>
<string name="TUIKitErrorSVRResAccessDeny">要发送的资源文件不允许访问。</string>
<string name="TUIKitErrorSVRResSizeLimit">文件大小超过限制。</string>
<string name="TUIKitErrorSVRResSendCancel">用户取消发送,如发送过程中登出等原因。</string>
<string name="TUIKitErrorSVRResReadFailed">读取文件内容失败。</string>
<string name="TUIKitErrorSVRResTransferTimeout">资源文件传输超时</string>
<string name="TUIKitErrorSVRResInvalidParameters">参数非法。</string>
<string name="TUIKitErrorSVRResInvalidFileMd5">文件 MD5 校验失败。</string>
<string name="TUIKitErrorSVRResInvalidPartMd5">分片 MD5 校验失败。</string>
<string name="TUIKitErrorSVRCommonInvalidHttpUrl">HTTP 解析错误 ,请检查 HTTP 请求 URL 格式。</string>
<string name="TUIKitErrorSVRCommomReqJsonParseFailed">HTTP 请求 JSON 解析错误,请检查 JSON 格式。</string>
<string name="TUIKitErrorSVRCommonInvalidAccount">请求 URI 或 JSON 包体中 Identifier 或 UserSig 错误。</string>
<string name="TUIKitErrorSVRCommonInvalidSdkappid">SDKAppID 失效,请核对 SDKAppID 有效性。</string>
<string name="TUIKitErrorSVRCommonRestFreqLimit">REST 接口调用频率超过限制,请降低请求频率。</string>
<string name="TUIKitErrorSVRCommonRequestTimeout">服务请求超时或 HTTP 请求格式错误,请检查并重试。</string>
<string name="TUIKitErrorSVRCommonInvalidRes">请求资源错误,请检查请求 URL。</string>
<string name="TUIKitErrorSVRCommonIDNotAdmin">REST API 请求的 Identifier 字段请填写 App 管理员帐号。</string>
<string name="TUIKitErrorSVRCommonSdkappidFreqLimit">SDKAppID 请求频率超限,请降低请求频率。</string>
<string name="TUIKitErrorSVRCommonSdkappidMiss">REST 接口需要带 SDKAppID,请检查请求 URL 中的 SDKAppID。</string>
<string name="TUIKitErrorSVRCommonRspJsonParseFailed">HTTP 响应包 JSON 解析错误。</string>
<string name="TUIKitErrorSVRCommonExchangeAccountTimeout">置换帐号超时。</string>
<string name="TUIKitErrorSVRCommonInvalidIdFormat">请求包体 Identifier 类型错误,请确认 Identifier 为字符串格式。</string>
<string name="TUIKitErrorSVRCommonSDkappidForbidden">SDKAppID 被禁用</string>
<string name="TUIKitErrorSVRCommonReqForbidden">请求被禁用</string>
<string name="TUIKitErrorSVRCommonReqFreqLimit">请求过于频繁,请稍后重试。</string>
<string name="TUIKitErrorSVRCommonInvalidService">未购买套餐包,或套餐包已过期,或购买的套餐包正在配置中暂未生效。请登录 即时通信 IM 购买页面 重新购买套餐包。购买后,将在5分钟后生效。</string>
<string name="TUIKitErrorSVRCommonSensitiveText">文本安全打击,文本中可能包含敏感词汇。</string>
<string name="TUIKitErrorSVRCommonBodySizeLimit">发消息包体过长,目前支持最大12k消息包体长度,请减少包体大小重试。</string>
<string name="TUIKitErrorSVRAccountUserSigExpired">UserSig 已过期,请重新生成 UserSig</string>
<string name="TUIKitErrorSVRAccountUserSigEmpty">UserSig 长度为0</string>
<string name="TUIKitErrorSVRAccountUserSigCheckFailed">UserSig 校验失败</string>
<string name="TUIKitErrorSVRAccountUserSigMismatchPublicKey">用公钥验证 UserSig 失败</string>
<string name="TUIKitErrorSVRAccountUserSigMismatchId">请求的 Identifier 与生成 UserSig 的 Identifier 不匹配。</string>
<string name="TUIKitErrorSVRAccountUserSigMismatchSdkAppid">请求的 SDKAppID 与生成 UserSig 的 SDKAppID 不匹配。</string>
<string name="TUIKitErrorSVRAccountUserSigPublicKeyNotFound">验证 UserSig 时公钥不存在</string>
<string name="TUIKitErrorSVRAccountUserSigSdkAppidNotFount">SDKAppID 未找到,请在云通信 IM 控制台确认应用信息。</string>
<string name="TUIKitErrorSVRAccountInvalidUserSig">UserSig 已经失效,请重新生成,再次尝试。</string>
<string name="TUIKitErrorSVRAccountNotFound">请求的用户帐号不存在。</string>
<string name="TUIKitErrorSVRAccountSecRstr">安全原因被限制。</string>
<string name="TUIKitErrorSVRAccountInternalTimeout">服务端内部超时,请重试。</string>
<string name="TUIKitErrorSVRAccountInvalidCount">请求中批量数量不合法。</string>
<string name="TUIkitErrorSVRAccountINvalidParameters">参数非法,请检查必填字段是否填充,或者字段的填充是否满足协议要求。</string>
<string name="TUIKitErrorSVRAccountAdminRequired">请求需要 App 管理员权限。</string>
<string name="TUIKitErrorSVRAccountLowSDKVersion">您的SDK版本过低,请升级到最新版本。</string>
<string name="TUIKitErrorSVRAccountFreqLimit">因失败且重试次数过多导致被限制,请检查 UserSig 是否正确,一分钟之后再试。</string>
<string name="TUIKitErrorSVRAccountBlackList">帐号被拉入黑名单。</string>
<string name="TUIKitErrorSVRAccountCountLimit">创建帐号数量超过免费体验版数量限制,请升级为专业版。</string>
<string name="TUIKitErrorSVRAccountInternalError">服务端内部错误,请重试。</string>
<string name="TUIKitErrorSVRProfileInvalidParameters">请求参数错误,请根据错误描述检查请求是否正确。</string>
<string name="TUIKitErrorSVRProfileAccountMiss">请求参数错误,没有指定需要拉取资料的用户帐号。</string>
<string name="TUIKitErrorSVRProfileAccountNotFound">请求的用户帐号不存在。</string>
<string name="TUIKitErrorSVRProfileAdminRequired">请求需要 App 管理员权限。</string>
<string name="TUIKitErrorSVRProfileSensitiveText">资料字段中包含敏感词。</string>
<string name="TUIKitErrorSVRProfileInternalError">服务端内部错误,请稍后重试。</string>
<string name="TUIKitErrorSVRProfileReadWritePermissionRequired">没有资料字段的读权限,详情可参见 资料字段。</string>
<string name="TUIKitErrorSVRProfileTagNotFound">资料字段的 Tag 不存在。</string>
<string name="TUIKitErrorSVRProfileSizeLimit">资料字段的 Value 长度超过500字节。</string>
<string name="TUIKitErrorSVRProfileValueError">标配资料字段的 Value 错误,详情可参见 标配资料字段。</string>
<string name="TUIKitErrorSVRProfileInvalidValueFormat">资料字段的 Value 类型不匹配,详情可参见 标配资料字段。</string>
<string name="TUIKitErrorSVRFriendshipInvalidParameters">请求参数错误,请根据错误描述检查请求是否正确。</string>
<string name="TUIKitErrorSVRFriendshipInvalidSdkAppid">SDKAppID 不匹配。</string>
<string name="TUIKitErrorSVRFriendshipAccountNotFound">请求的用户帐号不存在。</string>
<string name="TUIKitErrorSVRFriendshipAdminRequired">请求需要 App 管理员权限。</string>
<string name="TUIKitErrorSVRFriendshipSensitiveText">关系链字段中包含敏感词。</string>
<string name="TUIKitErrorSVRFriendshipNetTimeout">网络超时,请稍后重试。</string>
<string name="TUIKitErrorSVRFriendshipWriteConflict">并发写导致写冲突,建议使用批量方式。</string>
<string name="TUIKitErrorSVRFriendshipAddFriendDeny">后台禁止该用户发起加好友请求。</string>
<string name="TUIkitErrorSVRFriendshipCountLimit">自己的好友数已达系统上限。</string>
<string name="TUIKitErrorSVRFriendshipGroupCountLimit">分组已达系统上限。</string>
<string name="TUIKitErrorSVRFriendshipPendencyLimit">未决数已达系统上限。</string>
<string name="TUIKitErrorSVRFriendshipBlacklistLimit">黑名单数已达系统上限。</string>
<string name="TUIKitErrorSVRFriendshipPeerFriendLimit">对方的好友数已达系统上限。</string>
<string name="TUIKitErrorSVRFriendshipInSelfBlacklist">对方在自己的黑名单中,不允许加好友。</string>
<string name="TUIKitErrorSVRFriendshipAllowTypeDenyAny">对方的加好友验证方式是不允许任何人添加自己为好友。</string>
<string name="TUIKitErrorSVRFriendshipInPeerBlackList">自己在对方的黑名单中,不允许加好友。</string>
<string name="TUIKitErrorSVRFriendshipAllowTypeNeedConfirm">请求已发送,等待对方同意</string>
<string name="TUIKitErrorSVRFriendshipAddFriendSecRstr">添加好友请求被安全策略打击,请勿频繁发起添加好友请求。</string>
<string name="TUIKitErrorSVRFriendshipPendencyNotFound">请求的未决不存在。</string>
<string name="TUIKitErrorSVRFriendshipDelFriendSecRstr">删除好友请求被安全策略打击,请勿频繁发起删除好友请求。</string>
<string name="TUIKirErrorSVRFriendAccountNotFoundEx">请求的用户帐号不存在。</string>
<string name="TUIKitErrorSVRMsgPkgParseFailed">解析请求包失败。</string>
<string name="TUIKitErrorSVRMsgInternalAuthFailed">内部鉴权失败。</string>
<string name="TUIKitErrorSVRMsgInvalidId">Identifier 无效</string>
<string name="TUIKitErrorSVRMsgNetError">网络异常,请重试。</string>
<string name="TUIKitErrorSVRMsgPushDeny">触发发送单聊消息之前回调,App 后台返回禁止下发该消息。</string>
<string name="TUIKitErrorSVRMsgInPeerBlackList">发送单聊消息,被对方拉黑,禁止发送。</string>
<string name="TUIKitErrorSVRMsgBothNotFriend">消息发送双方互相不是好友,禁止发送。</string>
<string name="TUIKitErrorSVRMsgNotPeerFriend">发送单聊消息,自己不是对方的好友(单向关系),禁止发送。</string>
<string name="TUIkitErrorSVRMsgNotSelfFriend">发送单聊消息,对方不是自己的好友(单向关系),禁止发送。</string>
<string name="TUIKitErrorSVRMsgShutupDeny">因禁言,禁止发送消息。</string>
<string name="TUIKitErrorSVRMsgRevokeTimeLimit">消息撤回超过了时间限制(默认2分钟)。</string>
<string name="TUIKitErrorSVRMsgDelRambleInternalError">删除漫游内部错误。</string>
<string name="TUIKitErrorSVRMsgJsonParseFailed">JSON 格式解析失败,请检查请求包是否符合 JSON 规范。</string>
<string name="TUIKitErrorSVRMsgInvalidJsonBodyFormat">JSON 格式请求包中 MsgBody 不符合消息格式描述</string>
<string name="TUIKitErrorSVRMsgInvalidToAccount">JSON 格式请求包体中缺少 To_Account 字段或者 To_Account 字段不是 Integer 类型</string>
<string name="TUIKitErrorSVRMsgInvalidRand">JSON 格式请求包体中缺少 MsgRandom 字段或者 MsgRandom 字段不是 Integer 类型</string>
<string name="TUIKitErrorSVRMsgInvalidTimestamp">JSON 格式请求包体中缺少 MsgTimeStamp 字段或者 MsgTimeStamp 字段不是 Integer 类型</string>
<string name="TUIKitErrorSVRMsgBodyNotArray">JSON 格式请求包体中 MsgBody 类型不是 Array 类型</string>
<string name="TUIKitErrorSVRMsgInvalidJsonFormat">JSON 格式请求包不符合消息格式描述</string>
<string name="TUIKitErrorSVRMsgToAccountCountLimit">批量发消息目标帐号超过500</string>
<string name="TUIKitErrorSVRMsgToAccountNotFound">To_Account 没有注册或不存在</string>
<string name="TUIKitErrorSVRMsgTimeLimit">消息离线存储时间错误(最多不能超过7天)。</string>
<string name="TUIKitErrorSVRMsgInvalidSyncOtherMachine">JSON 格式请求包体中 SyncOtherMachine 字段不是 Integer 类型</string>
<string name="TUIkitErrorSVRMsgInvalidMsgLifeTime">JSON 格式请求包体中 MsgLifeTime 字段不是 Integer 类型</string>
<string name="TUIKitErrorSVRMsgBodySizeLimit">JSON 数据包超长,消息包体请不要超过12k。</string>
<string name="TUIKitErrorSVRmsgLongPollingCountLimit">Web 端长轮询被踢(Web 端同时在线实例个数超出限制)。</string>
<string name="TUIKitErrorUnsupporInterface">该功能仅限旗舰版使用,请升级至旗舰版。</string>
<string name="TUIKitErrorUnsupporInterfaceSuffix">功能仅限旗舰版使用,请升级至旗舰版。</string>
<string name="TUIKitErrorSVRGroupApiNameError">请求中的接口名称错误</string>
<string name="TUIKitErrorSVRGroupAccountCountLimit">请求包体中携带的帐号数量过多。</string>
<string name="TUIkitErrorSVRGroupFreqLimit">操作频率限制,请尝试降低调用的频率。</string>
<string name="TUIKitErrorSVRGroupPermissionDeny">操作权限不足</string>
<string name="TUIKitErrorSVRGroupInvalidReq">请求非法</string>
<string name="TUIKitErrorSVRGroupSuperNotAllowQuit">该群不允许群主主动退出。</string>
<string name="TUIKitErrorSVRGroupNotFound">群组不存在</string>
<string name="TUIKitErrorSVRGroupJsonParseFailed">解析 JSON 包体失败,请检查包体的格式是否符合 JSON 格式。</string>
<string name="TUIKitErrorSVRGroupInvalidId">发起操作的 Identifier 非法,请检查发起操作的用户 Identifier 是否填写正确。</string>
<string name="TUIKitErrorSVRGroupAllreadyMember">被邀请加入的用户已经是群成员。</string>
<string name="TUIKitErrorSVRGroupFullMemberCount">群已满员,无法将请求中的用户加入群组</string>
<string name="TUIKitErrorSVRGroupInvalidGroupId">群组 ID 非法,请检查群组 ID 是否填写正确。</string>
<string name="TUIKitErrorSVRGroupRejectFromThirdParty">App 后台通过第三方回调拒绝本次操作。</string>
<string name="TUIKitErrorSVRGroupShutDeny">因被禁言而不能发送消息,请检查发送者是否被设置禁言。</string>
<string name="TUIKitErrorSVRGroupRspSizeLimit">应答包长度超过最大包长</string>
<string name="TUIKitErrorSVRGroupAccountNotFound">请求的用户帐号不存在。</string>
<string name="TUIKitErrorSVRGroupGroupIdInUse">群组 ID 已被使用,请选择其他的群组 ID。</string>
<string name="TUIKitErrorSVRGroupSendMsgFreqLimit">发消息的频率超限,请延长两次发消息时间的间隔。</string>
<string name="TUIKitErrorSVRGroupReqAllreadyBeenProcessed">此邀请或者申请请求已经被处理。</string>
<string name="TUIKitErrorSVRGroupGroupIdUserdForSuper">群组 ID 已被使用,并且操作者为群主,可以直接使用。</string>
<string name="TUIKitErrorSVRGroupSDkAppidDeny">该 SDKAppID 请求的命令字已被禁用</string>
<string name="TUIKitErrorSVRGroupRevokeMsgNotFound">请求撤回的消息不存在。</string>
<string name="TUIKitErrorSVRGroupRevokeMsgTimeLimit">消息撤回超过了时间限制(默认2分钟)。</string>
<string name="TUIKitErrorSVRGroupRevokeMsgDeny">请求撤回的消息不支持撤回操作。</string>
<string name="TUIKitErrorSVRGroupNotAllowRevokeMsg">群组类型不支持消息撤回操作。</string>
<string name="TUIKitErrorSVRGroupRemoveMsgDeny">该消息类型不支持删除操作。</string>
<string name="TUIKitErrorSVRGroupNotAllowRemoveMsg">音视频聊天室和在线成员广播大群不支持删除消息。</string>
<string name="TUIKitErrorSVRGroupAvchatRoomCountLimit">音视频聊天室创建数量超过了限制</string>
<string name="TUIKitErrorSVRGroupCountLimit">单个用户可创建和加入的群组数量超过了限制”。</string>
<string name="TUIKitErrorSVRGroupMemberCountLimit">群成员数量超过限制</string>
<string name="TUIKitErrorSVRNoSuccessResult">批量操作无成功结果</string>
<string name="TUIKitErrorSVRToUserInvalid">IM: 无效接收方</string>
<string name="TUIKitErrorSVRRequestTimeout">请求超时</string>
<string name="TUIKitErrorSVRInitCoreFail">INIT CORE模块失败</string>
<string name="TUIKitErrorExpiredSessionNode">SessionNode为null</string>
<string name="TUIKitErrorLoggedOutBeforeLoginFinished">在登录完成前进行了登出(在登录时返回)</string>
<string name="TUIKitErrorTLSSDKNotInitialized">tlssdk未初始化</string>
<string name="TUIKitErrorTLSSDKUserNotFound">TLSSDK没有找到相应的用户信息</string>
<string name="TUIKitErrorBindFaildRegTimeout">注册超时</string>
<string name="TUIKitErrorBindFaildIsBinding">正在bind操作中</string>
<string name="TUIKitErrorPacketFailUnknown">发包未知错误</string>
<string name="TUIKitErrorPacketFailReqNoNet">发送请求包时没有网络,处理时转换成case ERR_REQ_NO_NET_ON_REQ:</string>
<string name="TUIKitErrorPacketFailRespNoNet">发送回复包时没有网络,处理时转换成case ERR_REQ_NO_NET_ON_RSP:</string>
<string name="TUIKitErrorPacketFailReqNoAuth">发送请求包时没有权限</string>
<string name="TUIKitErrorPacketFailSSOErr">SSO错误</string>
<string name="TUIKitErrorPacketFailRespTimeout">回复超时</string>
<string name="TUIKitErrorFriendshipProxySyncing">proxy_manager没有完成svr数据同步</string>
<string name="TUIKitErrorFriendshipProxySyncedFail">proxy_manager同步失败</string>
<string name="TUIKitErrorFriendshipProxyLocalCheckErr">proxy_manager请求参数,在本地检查不合法</string>
<string name="TUIKitErrorGroupInvalidField">group assistant请求字段中包含非预设字段</string>
<string name="TUIKitErrorGroupStoreageDisabled">group assistant群资料本地存储没有开启</string>
<string name="TUIKitErrorLoadGrpInfoFailed">无法从存储中加载groupinfo</string>
<string name="TUIKitErrorReqNoNetOnReq">请求的时候没有网络</string>
<string name="TUIKitErrorReqNoNetOnResp">响应的时候没有网络</string>
<string name="TUIKitErrorServiceNotReady">QALSDK服务未就绪</string>
<string name="TUIKitErrorLoginAuthFailed">账号认证失败(用户信息获取失败)</string>
<string name="TUIKitErrorNeverConnectAfterLaunch">在应用启动后没有尝试联网</string>
<string name="TUIKitErrorReqFailed">QAL执行失败</string>
<string name="TUIKitErrorReqInvaidReq">请求非法,toMsgService非法</string>
<string name="TUIKitErrorReqOnverLoaded">请求队列满</string>
<string name="TUIKitErrorReqKickOff">已经被其他终端踢了</string>
<string name="TUIKitErrorReqServiceSuspend">服务被暂停</string>
<string name="TUIKitErrorReqInvalidSign">SSO签名错误</string>
<string name="TUIKitErrorReqInvalidCookie">SSO cookie无效</string>
<string name="TUIKitErrorLoginTlsRspParseFailed">登录时TLS回包校验,包体长度错误</string>
<string name="TUIKitErrorLoginOpenMsgTimeout">登录时OPENSTATSVC向OPENMSG上报状态超时</string>
<string name="TUIKitErrorLoginOpenMsgRspParseFailed">登录时OPENSTATSVC向OPENMSG上报状态时解析回包失败</string>
<string name="TUIKitErrorLoginTslDecryptFailed">登录时TLS解密失败</string>
<string name="TUIKitErrorWifiNeedAuth">wifi需要认证</string>
<string name="TUIKitErrorUserCanceled">用户已取消</string>
<string name="TUIkitErrorRevokeTimeLimitExceed">消息撤回超过了时间限制(默认2分钟)</string>
<string name="TUIKitErrorLackUGExt">缺少UGC扩展包</string>
<string name="TUIKitErrorAutoLoginNeedUserSig">自动登录,本地票据过期,需要userSig手动登录</string>
<string name="TUIKitErrorQALNoShortConneAvailable">没有可用的短连接sso</string>
<string name="TUIKitErrorReqContentAttach">消息内容安全打击</string>
<string name="TUIKitErrorLoginSigExpire">登录返回,票据过期</string>
<string name="TUIKitErrorSDKHadInit">SDK 已经初始化无需重复初始化</string>
<string name="TUIKitErrorOpenBDHBase">openbdh 错误码</string>
<string name="TUIKitErrorRequestNoNetOnReq">请求时没有网络,请等网络恢复后重试</string>
<string name="TUIKitErrorRequestNoNetOnRsp">响应时没有网络,请等网络恢复后重试</string>
<string name="TUIKitErrorRequestOnverLoaded">请求队列満</string>
<string name="TUIKitErrorEnableUserStatusOnConsole">您未开启用户状态功能,请先登录控制台开启</string>
</resources>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="open_file_tips">选择要打开此文件的应用</string>
<string name="sure">确定</string>
<string name="cancel">取消</string>
<string name="core_permission_dialog_title">权限申请</string>
<string name="core_permission_dialog_positive_setting_text">去设置</string>
<string name="date_year_short"></string>
<string name="date_month_short"></string>
<string name="date_day_short"></string>
<string name="date_hour_short"></string>
<string name="date_minute_short"></string>
<string name="date_second_short"></string>
<string name="date_yesterday">昨天</string>
</resources>
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="UserIconView">
<!--默认头像-->
<attr name="default_image" format="reference" />
<attr name="image_radius" format="dimension" />
</declare-styleable>
<declare-styleable name="SynthesizedImageView">
<!--合成图片的背景-->
<attr name="synthesized_image_bg" format="color" />
<!--合成图片的默认图片-->
<attr name="synthesized_default_image" format="reference" />
<!--合成图片的尺寸-->
<attr name="synthesized_image_size" format="dimension" />
<!--多图片之间的空隙间隔-->
<attr name="synthesized_image_gap" format="dimension" />
</declare-styleable>
<declare-styleable name="LineControllerView">
<!-- 名称 -->
<attr name="name" format="string"/>
<!-- 内容或当前状态 -->
<attr name="subject" format="string"/>
<!-- 是否是列表中最后一个 -->
<attr name="isBottom" format="boolean"/>
<!-- 是否是列表中第一个 -->
<attr name="isTop" format="boolean"/>
<!-- 是否可以跳转 -->
<attr name="canNav" format="boolean"/>
<!-- 是否是开关 -->
<attr name="isSwitch" format="boolean"/>
</declare-styleable>
<declare-styleable name="IndexBar">
<attr name="indexBarTextSize" format="dimension"/>
<attr name="indexBarPressBackground" format="color" />
</declare-styleable>
<declare-styleable name="core_round_rect_image_style">
<attr name="round_radius" format="dimension" />
</declare-styleable>
<declare-styleable name="TitleBarLayout">
<attr name="title_bar_middle_title" format="string" />
<attr name="title_bar_can_return" format="boolean" />
</declare-styleable>
<declare-styleable name="RoundFrameLayout">
<attr name="corner_radius" format="dimension" />
<attr name="left_top_corner_radius" format="dimension" />
<attr name="right_top_corner_radius" format="dimension" />
<attr name="right_bottom_corner_radius" format="dimension" />
<attr name="left_bottom_corner_radius" format="dimension" />
</declare-styleable>
<declare-styleable name="RoundCornerImageView" parent="RoundFrameLayout">
<attr name="corner_radius"/>
<attr name="left_top_corner_radius"/>
<attr name="right_top_corner_radius" />
<attr name="right_bottom_corner_radius" />
<attr name="left_bottom_corner_radius" />
</declare-styleable>
<declare-styleable name="UnreadCountTextView">
<attr name="paint_color" format="color|reference"/>
</declare-styleable>
<declare-styleable name="CustomWidthSwitch">
<attr name="custom_width" format="dimension|reference"/>
</declare-styleable>
<declare-styleable name="SwipeLayout">
<attr name="drag_edge">
<flag name="left" value="1" />
<flag name="right" value="2" />
<flag name="top" value="4" />
<flag name="bottom" value="8" />
</attr>
<attr name="leftEdgeSwipeOffset" format="dimension" />
<attr name="rightEdgeSwipeOffset" format="dimension" />
<attr name="topEdgeSwipeOffset" format="dimension" />
<attr name="bottomEdgeSwipeOffset" format="dimension" />
<attr name="show_mode" format="enum">
<enum name="lay_down" value="0" />
<enum name="pull_out" value="1" />
</attr>
<attr name="clickToClose" format="boolean" />
</declare-styleable>
</resources>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#000000</color>
<color name="white">#FFFFFF</color>
<color name="read_dot_bg">#f74c31</color>
<color name="font_blue">#066fff</color>
</resources>
@@ -0,0 +1,291 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="TUIKitErrorInProcess">Executing</string>
<string name="TUIKitErrorInvalidParameters">Invalid parameter</string>
<string name="TUIKitErrorIOOperateFaild">Local IO operation error</string>
<string name="TUIKitErrorInvalidJson">Invalid JSON format</string>
<string name="TUIKitErrorOutOfMemory">Out of storage</string>
<string name="TUIKitErrorParseResponseFaild">PB parsing failed</string>
<string name="TUIKitErrorSerializeReqFaild">PB serialization failed</string>
<string name="TUIKitErrorSDKNotInit">IM SDK is not initialized.</string>
<string name="TUIKitErrorLoadMsgFailed">Failed to load local database</string>
<string name="TUIKitErrorDatabaseOperateFailed">Local database operation failed</string>
<string name="TUIKitErrorCrossThread">Cross-thread error</string>
<string name="TUIKitErrorTinyIdEmpty">User info is empty.</string>
<string name="TUIKitErrorInvalidIdentifier">Invalid identifier</string>
<string name="TUIKitErrorFileNotFound">File not found</string>
<string name="TUIKitErrorFileTooLarge">File size exceeds the limit.</string>
<string name="TUIKitErrorEmptyFile">Empty file</string>
<string name="TUIKitErrorFileOpenFailed">Failed to open file</string>
<string name="TUIKitErrorNotLogin">Not logged in to IM SDK</string>
<string name="TUIKitErrorNoPreviousLogin">Not logged in to the user\'s account.</string>
<string name="TUIKitErrorUserSigExpired">UserSig expired</string>
<string name="TUIKitErrorLoginKickedOffByOther">Log in to the same account on other devices</string>
<string name="TUIKitErrorTLSSDKInit">TLS SDK initialization failed</string>
<string name="TUIKitErrorTLSSDKUninit">TLS SDK is not initialized.</string>
<string name="TUIKitErrorTLSSDKTRANSPackageFormat">Invalid TLS SDK TRANS packet format</string>
<string name="TUIKitErrorTLSDecrypt">TLS SDK decryption failed</string>
<string name="TUIKitErrorTLSSDKRequest">TLS SDK request failed</string>
<string name="TUIKitErrorTLSSDKRequestTimeout">TLS SDK request timed out</string>
<string name="TUIKitErrorInvalidConveration">Invalid session</string>
<string name="TUIKitErrorFileTransAuthFailed">Authentication failed during file transfer.</string>
<string name="TUIKitErrorFileTransNoServer">Failed to get the server list via FTP.</string>
<string name="TUIKitErrorFileTransUploadFailed">Failed to upload the file via FTP. Check your network connection.</string>
<string name="TUIKitErrorFileTransUploadFailedNotImage">Failed to upload the file via FTP. Check if the uploaded image can be opened normally.</string>
<string name="TUIKitErrorFileTransDownloadFailed">Failed to download the file via FTP. Check whether your network is connected or the file or audio has expired.</string>
<string name="TUIKitErrorHTTPRequestFailed">HTTP request failed</string>
<string name="TUIKitErrorInvalidMsgElem">Invalid IM SDK message elem</string>
<string name="TUIKitErrorInvalidSDKObject">Invalid object</string>
<string name="TUIKitSDKMsgBodySizeLimit">Message length exceeds the limit.</string>
<string name="TUIKitErrorSDKMsgKeyReqDifferRsp">Message key error</string>
<string name="TUIKitErrorSDKGroupInvalidID">Invalid group ID. Custom group ID must be printable ASCII characters (0x20-0x7e), with maximum length of 48 bytes, and cannot be prefixed with @TGS#.</string>
<string name="TUIKitErrorSDKGroupInvalidName">Group name is invalid, which cannot exceed 30 bytes.</string>
<string name="TUIKitErrorSDKGroupInvalidIntroduction">Group description is invalid, which cannot exceed 240 bytes.</string>
<string name="TUIKitErrorSDKGroupInvalidNotification">Group notice is invalid, which cannot exceed 300 bytes.</string>
<string name="TUIKitErrorSDKGroupInvalidFaceURL">Group profile photo URL is invalid, which should not exceed 100 bytes.</string>
<string name="TUIKitErrorSDKGroupInvalidNameCard">Group card is invalid, which cannot exceed 50 bytes.</string>
<string name="TUIKitErrorSDKGroupMemberCountLimit">The maximum number of group members is exceeded.</string>
<string name="TUIKitErrorSDKGroupJoinPrivateGroupDeny">Request to join private groups is not allowed.</string>
<string name="TUIKitErrorSDKGroupInviteSuperDeny">Group owners cannot be invited.</string>
<string name="TUIKitErrorSDKGroupInviteNoMember">The number of members to be invited cannot be 0.</string>
<string name="TUIKitErrorSDKFriendShipInvalidProfileKey">Invalid data field</string>
<string name="TUIKitErrorSDKFriendshipInvalidAddRemark">The remark field exceeds the limit of 96 bytes.</string>
<string name="TUIKitErrorSDKFriendshipInvalidAddWording">The description field in the friend request is invalid, which should not exceed 120 bytes.</string>
<string name="TUIKitErrorSDKFriendshipInvalidAddSource">The source field in the friend request is invalid, which should be prefixed with \"AddSource_Type_\".</string>
<string name="TUIKitErrorSDKFriendshipFriendGroupEmpty">The friend list field is invalid. It is required with each list name of 30 bytes at most.</string>
<string name="TUIKitErrorSDKNetEncodeFailed">Network link encryption failed</string>
<string name="TUIKitErrorSDKNetDecodeFailed">Network link decryption failed</string>
<string name="TUIKitErrorSDKNetAuthInvalid">Network link authentication not completed</string>
<string name="TUIKitErrorSDKNetCompressFailed">Unable to compress data packet</string>
<string name="TUIKitErrorSDKNetUncompressFaile">Packet decompression failed</string>
<string name="TUIKitErrorSDKNetFreqLimit">Call frequency is limited, with up to 5 requests per second.</string>
<string name="TUIKitErrorSDKnetReqCountLimit">Request queue is full. The number of concurrent requests exceeds the limit of 1000.</string>
<string name="TUIKitErrorSDKNetDisconnect">Network disconnected. No connection is established, or no network is detected when a socket connection is established.</string>
<string name="TUIKitErrorSDKNetAllreadyConn">Network connection has been established.</string>
<string name="TUIKitErrorSDKNetConnTimeout">Network connection timed out. Try again once network connection is restored.</string>
<string name="TUIKitErrorSDKNetConnRefuse">Network connection denied. Too many attempts. Service denied by the server.</string>
<string name="TUIKitErrorSDKNetNetUnreach">No available route to the network. Try again once network connection is restored.</string>
<string name="TUIKitErrorSDKNetSocketNoBuff">Call failed to due to insufficient buffer resources in the system. System busy. Internal error.</string>
<string name="TUIKitERRORSDKNetResetByPeer">The peer resets the connection.</string>
<string name="TUIKitErrorSDKNetSOcketInvalid">Invalid socket</string>
<string name="TUIKitErrorSDKNetHostGetAddressFailed">IP address resolution failed</string>
<string name="TUIKitErrorSDKNetConnectReset">Network is connected to an intermediate node or connection to the server is reset.</string>
<string name="TUIKitErrorSDKNetWaitInQueueTimeout">Timed out waiting for request packet to enter the to-be-sent queue.</string>
<string name="TUIKitErrorSDKNetWaitSendTimeout">Request packet has entered the to-be-sent queue. Timed out waiting to enter the network buffer of the system.</string>
<string name="TUIKitErrorSDKNetWaitAckTimeut">Request packet has entered the network buffer of the system. Timed out waiting for response from server.</string>
<string name="TUIKitErrorSDKSVRSSOConnectLimit">The number of Server connections exceeds the limit. Service denied by the server.</string>
<string name="TUIKitErrorSDKSVRSSOVCode">Sending verification code timeout.</string>
<string name="TUIKitErrorSVRSSOD2Expired">Key expired. Key is an internal bill generated according to usersig. The validity period of the key is less than or equal to the validity period of usersig. Please call timmanager again getInstance(). The login interface generates a new key.</string>
<string name="TUIKitErrorSVRA2UpInvalid">Ticket expired. Ticket is an internal bill generated according to usersig. The validity period of ticket is less than or equal to that of usersig. Please call timmanager again getInstance(). The login interface generates a new ticket.</string>
<string name="TUIKitErrorSVRA2DownInvalid">The bill failed verification or was hit by security. Please call timmanager again getInstance(). The login interface generates a new ticket.</string>
<string name="TUIKitErrorSVRSSOEmpeyKey">Empty key is not allowed.</string>
<string name="TUIKitErrorSVRSSOUinInvalid">The account in the key does not match the account in the request header.</string>
<string name="TUIKitErrorSVRSSOVCodeTimeout">Timed out sending verification code.</string>
<string name="TUIKitErrorSVRSSONoImeiAndA2">You need to bring your key and ticket.</string>
<string name="TUIKitErrorSVRSSOCookieInvalid">Cookie check mismatch.</string>
<string name="TUIKitErrorSVRSSODownTips">Send a prompt: Key expired.</string>
<string name="TUIKitErrorSVRSSODisconnect">Link disconnected and screen locked.</string>
<string name="TUIKitErrorSVRSSOIdentifierInvalid">Invalid identity.</string>
<string name="TUIKitErrorSVRSSOClientClose">The device automatically logs out.</string>
<string name="TUIKitErrorSVRSSOMSFSDKQuit">MSFSDK automatically logs out.</string>
<string name="TUIKitErrorSVRSSOD2KeyWrong">the number of decryption failures exceeds the threshold, notify the terminal that it needs to be reset, please call timmanager again getInstance(). The login interface generates a new key.</string>
<string name="TUIKitErrorSVRSSOUnsupport">Aggregation is not supported. A unified error code is returned to devices. The device stops aggregation on the persistent TCP connection.</string>
<string name="TUIKitErrorSVRSSOPrepaidArrears">Prepaid service is in arrears.</string>
<string name="TUIKitErrorSVRSSOPacketWrong">Invalid request packet format.</string>
<string name="TUIKitErrorSVRSSOAppidBlackList">SDKAppID blocked list.</string>
<string name="TUIKitErrorSVRSSOCmdBlackList">SDKAppID sets the service cmd blocked list.</string>
<string name="TUIKitErrorSVRSSOAppidWithoutUsing">SDKAppID is disabled.</string>
<string name="TUIKitErrorSVRSSOFreqLimit">Frequency limit (user), which is to limit the number of requests per second of a protocol.</string>
<string name="TUIKitErrorSVRSSOOverload">Packet loss due to overload (system). Service denied by the connected server that failed to process too many requests.</string>
<string name="TUIKitErrorSVRResNotFound">The resource file to be sent does not exist.</string>
<string name="TUIKitErrorSVRResAccessDeny">Unable to access the resource file to be sent.</string>
<string name="TUIKitErrorSVRResSizeLimit">File size exceeds the limit.</string>
<string name="TUIKitErrorSVRResSendCancel">Sending is canceled by the user due to reasons like logging out when sending a message.</string>
<string name="TUIKitErrorSVRResReadFailed">Failed to access the file content.</string>
<string name="TUIKitErrorSVRResTransferTimeout">Timed out transferring the resource file.</string>
<string name="TUIKitErrorSVRResInvalidParameters">Invalid parameter.</string>
<string name="TUIKitErrorSVRResInvalidFileMd5">File MD5 verification failed.</string>
<string name="TUIKitErrorSVRResInvalidPartMd5">Sharding MD5 verification failed.</string>
<string name="TUIKitErrorSVRCommonInvalidHttpUrl">HTTP parsing error. Check the HTTP request URL format.</string>
<string name="TUIKitErrorSVRCommomReqJsonParseFailed">JSON parsing error in the HTTP request. Check the JSON format.</string>
<string name="TUIKitErrorSVRCommonInvalidAccount">The Identifier or UserSig in the request URI or JSON packet is incorrect.</string>
<string name="TUIKitErrorSVRCommonInvalidSdkappid">Invalid SDKAppID. Check the SDKAppID validity.</string>
<string name="TUIKitErrorSVRCommonRestFreqLimit">The REST API call frequency exceeds the limit. Reduce the request rate.</string>
<string name="TUIKitErrorSVRCommonRequestTimeout">The service request timed out or the HTTP request format is incorrect. Check the error and try again.</string>
<string name="TUIKitErrorSVRCommonInvalidRes">Requested resource error. Check the request URL.</string>
<string name="TUIKitErrorSVRCommonIDNotAdmin">Fill in the Identifier field of the REST API request with the app admin\'s account.</string>
<string name="TUIKitErrorSVRCommonSdkappidFreqLimit">SDKAppID request rate exceeds the limit. Reduce the request rate.</string>
<string name="TUIKitErrorSVRCommonSdkappidMiss">SDKAppID is required for the REST API. Check the SDKAppID in the request URL.</string>
<string name="TUIKitErrorSVRCommonRspJsonParseFailed">JSON parsing error in the HTTP response packet.</string>
<string name="TUIKitErrorSVRCommonExchangeAccountTimeout">Account switching timed out.</string>
<string name="TUIKitErrorSVRCommonInvalidIdFormat">The Identifier type of the request packet body is incorrect. Confirm that the Identifier is a string.</string>
<string name="TUIKitErrorSVRCommonSDkappidForbidden">SDKAppID is disabled.</string>
<string name="TUIKitErrorSVRCommonReqForbidden">Request is disabled.</string>
<string name="TUIKitErrorSVRCommonReqFreqLimit">Too many requests. Try again later.</string>
<string name="TUIKitErrorSVRCommonInvalidService">The package has not been purchased, or the package has expired, or the purchased package is being configured and has not yet taken effect. Please log in to the im purchase page to re purchase the package. After purchase, it will take effect in 5 minutes.</string>
<string name="TUIKitErrorSVRCommonSensitiveText">Text is filtered due to security reasons, which may contain sensitive words.</string>
<string name="TUIKitErrorSVRCommonBodySizeLimit">The sending message package is too long. Currently, the maximum 12K message package length is supported. Please reduce the package size and try again.</string>
<string name="TUIKitErrorSVRAccountUserSigExpired">UserSig has expired. Generate a new one.</string>
<string name="TUIKitErrorSVRAccountUserSigEmpty">UserSig length is 0.</string>
<string name="TUIKitErrorSVRAccountUserSigCheckFailed">UserSig verification failed.</string>
<string name="TUIKitErrorSVRAccountUserSigMismatchPublicKey">Failed to verify UserSig with public key</string>
<string name="TUIKitErrorSVRAccountUserSigMismatchId">The requested Identifier does not match the Identifier that is used to generate the UserSig.</string>
<string name="TUIKitErrorSVRAccountUserSigMismatchSdkAppid">The requested SDKAppID does not match the SDKAppID of the generated UserSig.</string>
<string name="TUIKitErrorSVRAccountUserSigPublicKeyNotFound">Public key does not exist when verifying UserSig.</string>
<string name="TUIKitErrorSVRAccountUserSigSdkAppidNotFount">SDKAppID not found. Check the app information in the IM console.</string>
<string name="TUIKitErrorSVRAccountInvalidUserSig">UserSig has expired. Generate a new one and try again.</string>
<string name="TUIKitErrorSVRAccountNotFound">Requested user account not found.</string>
<string name="TUIKitErrorSVRAccountSecRstr">Restricted for security reasons.</string>
<string name="TUIKitErrorSVRAccountInternalTimeout">Internal server timeout. Try again.</string>
<string name="TUIKitErrorSVRAccountInvalidCount">Invalid batch quantity in the request.</string>
<string name="TUIkitErrorSVRAccountINvalidParameters">Invalid parameter. Check whether the fields are entered as required in the protocol.</string>
<string name="TUIKitErrorSVRAccountAdminRequired">The request requires app admin permissions.</string>
<string name="TUIKitErrorSVRAccountLowSDKVersion">Your sdk version is too low, Please upgrade to the latest version.</string>
<string name="TUIKitErrorSVRAccountFreqLimit">Restricted due to too many failures and retries. Check if the UserSig is correct and try again after one minute.</string>
<string name="TUIKitErrorSVRAccountBlackList">The account is added to the blocked list.</string>
<string name="TUIKitErrorSVRAccountCountLimit">The number of accounts created exceeds that allowed in the free trial version. Upgrade to the professional version.</string>
<string name="TUIKitErrorSVRAccountInternalError">Internal server error. Try again.</string>
<string name="TUIKitErrorSVRProfileInvalidParameters">Request parameter error. Check if the request is correct according to the error message.</string>
<string name="TUIKitErrorSVRProfileAccountMiss">Request parameter error. No user account specified to pull data.</string>
<string name="TUIKitErrorSVRProfileAccountNotFound">Requested user account not found.</string>
<string name="TUIKitErrorSVRProfileAdminRequired">The request requires app admin permissions.</string>
<string name="TUIKitErrorSVRProfileSensitiveText">The data field contains sensitive words.</string>
<string name="TUIKitErrorSVRProfileInternalError">Server internal error. Try again later.</string>
<string name="TUIKitErrorSVRProfileReadWritePermissionRequired">You have no permission to read the data field. See the data field for details.</string>
<string name="TUIKitErrorSVRProfileTagNotFound">The tag of the data field does not exist.</string>
<string name="TUIKitErrorSVRProfileSizeLimit">The value of the data field exceeds 500 bytes.</string>
<string name="TUIKitErrorSVRProfileValueError">The value of the standard data field is incorrect. See the standard data field for details.</string>
<string name="TUIKitErrorSVRProfileInvalidValueFormat">The value type of the data field does not match. See the standard data field for details.</string>
<string name="TUIKitErrorSVRFriendshipInvalidParameters">Request parameter error. Check if the request is correct according to the error message.</string>
<string name="TUIKitErrorSVRFriendshipInvalidSdkAppid">SDKAppID does not match.</string>
<string name="TUIKitErrorSVRFriendshipAccountNotFound">Requested user account not found.</string>
<string name="TUIKitErrorSVRFriendshipAdminRequired">The request requires app admin permissions.</string>
<string name="TUIKitErrorSVRFriendshipSensitiveText">The relation chain field contains sensitive words.</string>
<string name="TUIKitErrorSVRFriendshipNetTimeout">Network timed out. Try again later.</string>
<string name="TUIKitErrorSVRFriendshipWriteConflict">A write conflict occurred due to concurrent writes. The batch mode is recommended.</string>
<string name="TUIKitErrorSVRFriendshipAddFriendDeny">The backend blocks the user from initiating friend requests.</string>
<string name="TUIkitErrorSVRFriendshipCountLimit">The number of your friends exceeds the limit.</string>
<string name="TUIKitErrorSVRFriendshipGroupCountLimit">The number of lists exceeds the limit.</string>
<string name="TUIKitErrorSVRFriendshipPendencyLimit">You have reached the limit of pending friend requests.</string>
<string name="TUIKitErrorSVRFriendshipBlacklistLimit">The number of accounts in the blocked list exceeds the limit.</string>
<string name="TUIKitErrorSVRFriendshipPeerFriendLimit">The number of the other user\'s friends exceeds the limit.</string>
<string name="TUIKitErrorSVRFriendshipInSelfBlacklist">You have blocked the other user. Unable to send friend request.</string>
<string name="TUIKitErrorSVRFriendshipAllowTypeDenyAny">The other user\'s friend request verification mode is \"Decline friend request from any user\".</string>
<string name="TUIKitErrorSVRFriendshipInPeerBlackList">You are blocked by the other user. Unable to send friend request.</string>
<string name="TUIKitErrorSVRFriendshipAllowTypeNeedConfirm">Request sent. Wait for acceptance.</string>
<string name="TUIKitErrorSVRFriendshipAddFriendSecRstr">The friend request was filtered by the security policy. Do not initiate friend requests too frequently.</string>
<string name="TUIKitErrorSVRFriendshipPendencyNotFound">The pending friend request does not exist.</string>
<string name="TUIKitErrorSVRFriendshipDelFriendSecRstr">The friend deletion request was filtered by the security policy. Do not initiate friend deletion requests too frequently.</string>
<string name="TUIKirErrorSVRFriendAccountNotFoundEx">Requested user account not found.</string>
<string name="TUIKitErrorSVRMsgPkgParseFailed">Failed to parse the request packet.</string>
<string name="TUIKitErrorSVRMsgInternalAuthFailed">Internal authentication failed.</string>
<string name="TUIKitErrorSVRMsgInvalidId">Invalid identifier</string>
<string name="TUIKitErrorSVRMsgNetError">Network error. Try again.</string>
<string name="TUIKitErrorSVRMsgPushDeny">A callback is triggered before sending a message in the private chat, and the App backend returns \"The message is prohibited from sending\".</string>
<string name="TUIKitErrorSVRMsgInPeerBlackList">Unable to send messages in the private chat as you are blocked by the other user.</string>
<string name="TUIKitErrorSVRMsgBothNotFriend">You are not a friend of this user. Unable to send messages.</string>
<string name="TUIKitErrorSVRMsgNotPeerFriend">Unable to send messages in the private chat as you are not the other user\'s friend (one-way friend).</string>
<string name="TUIkitErrorSVRMsgNotSelfFriend">Unable to send messages in the private chat as the other user is not your friend (one-way friend).</string>
<string name="TUIKitErrorSVRMsgShutupDeny">Blocked from posting. Unable to send messages.</string>
<string name="TUIKitErrorSVRMsgRevokeTimeLimit">Timed out recalling the message (default is 2 min).</string>
<string name="TUIKitErrorSVRMsgDelRambleInternalError">An internal error occurred while deleting roaming messages.</string>
<string name="TUIKitErrorSVRMsgJsonParseFailed">Failed to parse the JSON packet. Check whether the request packet meets the JSON specifications.</string>
<string name="TUIKitErrorSVRMsgInvalidJsonBodyFormat">MsgBody in the JSON request packet does not conform to the message format description.</string>
<string name="TUIKitErrorSVRMsgInvalidToAccount">The To_Account field is missing from the JSON request packet body or the type of the To_Account field is not Integer.</string>
<string name="TUIKitErrorSVRMsgInvalidRand">The MsgRandom field is missing from the JSON request packet body or the type of the MsgRandom field is not Integer.</string>
<string name="TUIKitErrorSVRMsgInvalidTimestamp">The MsgTimeStamp field is missing from the JSON request packet body or the type of the MsgTimeStamp field is not Integer.</string>
<string name="TUIKitErrorSVRMsgBodyNotArray">The MsgBody type in the JSON request packet body is not Array.</string>
<string name="TUIKitErrorSVRMsgInvalidJsonFormat">The JSON request packet does not conform to the message format description.</string>
<string name="TUIKitErrorSVRMsgToAccountCountLimit">The number of accounts to which messages are sent in batch exceeds 500.</string>
<string name="TUIKitErrorSVRMsgToAccountNotFound">To_Account is not registered or does not exist.</string>
<string name="TUIKitErrorSVRMsgTimeLimit">Invalid offline message storage time (up to 7 days).</string>
<string name="TUIKitErrorSVRMsgInvalidSyncOtherMachine">The type of the SyncOtherMachine field in the JSON request packet body is not Integer.</string>
<string name="TUIkitErrorSVRMsgInvalidMsgLifeTime">The type of the MsgLifeTime field in the JSON request packet body is not Integer.</string>
<string name="TUIKitErrorSVRMsgBodySizeLimit">The length of JSON data packet exceeds the limit. The message packet body shall not exceed 12 KB.</string>
<string name="TUIKitErrorSVRmsgLongPollingCountLimit">Forced logout on the Web page during long polling (the number of online instances on the Web page exceeds the limit).</string>
<string name="TUIKitErrorUnsupporInterface">This feature is available only to the Ultimate edition. Please upgrade.</string>
<string name="TUIKitErrorUnsupporInterfaceSuffix"> feature is available only to the Ultimate edition. Please upgrade.</string>
<string name="TUIKitErrorSVRGroupApiNameError">The API name in the request is incorrect.</string>
<string name="TUIKitErrorSVRGroupAccountCountLimit">The number of accounts in the request packet body exceeds the limit.</string>
<string name="TUIkitErrorSVRGroupFreqLimit">Call frequency is limited. Reduce the call frequency.</string>
<string name="TUIKitErrorSVRGroupPermissionDeny">Insufficient operation permissions</string>
<string name="TUIKitErrorSVRGroupInvalidReq">Invalid request</string>
<string name="TUIKitErrorSVRGroupSuperNotAllowQuit">Group owner is not allowed to leave this group.</string>
<string name="TUIKitErrorSVRGroupNotFound">The group does not exist.</string>
<string name="TUIKitErrorSVRGroupJsonParseFailed">Failed to parse the JSON packet. Check whether the packet body conforms to the JSON format.</string>
<string name="TUIKitErrorSVRGroupInvalidId">The identifier that is used to initiated the operation is invalid. Check whether the identifier of the user who initiated the operation is correct.</string>
<string name="TUIKitErrorSVRGroupAllreadyMember">The invited user is a group member.</string>
<string name="TUIKitErrorSVRGroupFullMemberCount">The number of group members has reached the limit. Unable to add the user in the request to the group.</string>
<string name="TUIKitErrorSVRGroupInvalidGroupId">Invalid group ID. Check whether the group ID is correct.</string>
<string name="TUIKitErrorSVRGroupRejectFromThirdParty">The app backend rejected this operation via a third-party callback.</string>
<string name="TUIKitErrorSVRGroupShutDeny">This user is blocked from posting and thus cannot send messages. Check whether the sender is blocked from posting.</string>
<string name="TUIKitErrorSVRGroupRspSizeLimit">The response packet length exceeds the limit.</string>
<string name="TUIKitErrorSVRGroupAccountNotFound">Requested user account not found.</string>
<string name="TUIKitErrorSVRGroupGroupIdInUse">The group ID has been used. Select another one.</string>
<string name="TUIKitErrorSVRGroupSendMsgFreqLimit">The frequency of sending messages exceeds the limit. Extend the interval between sending messages.</string>
<string name="TUIKitErrorSVRGroupReqAllreadyBeenProcessed">This invitation or request has been processed.</string>
<string name="TUIKitErrorSVRGroupGroupIdUserdForSuper">The group ID has been used by the group owner. It can be used directly.</string>
<string name="TUIKitErrorSVRGroupSDkAppidDeny">The command word used in the SDKAppID request has been disabled.</string>
<string name="TUIKitErrorSVRGroupRevokeMsgNotFound">This message does not exist.</string>
<string name="TUIKitErrorSVRGroupRevokeMsgTimeLimit">Timed out recalling the message (default is 2 min).</string>
<string name="TUIKitErrorSVRGroupRevokeMsgDeny">Unable to recall this message.</string>
<string name="TUIKitErrorSVRGroupNotAllowRevokeMsg">Unable to recall messages in groups of this type.</string>
<string name="TUIKitErrorSVRGroupRemoveMsgDeny">Unable to delete messages of this type.</string>
<string name="TUIKitErrorSVRGroupNotAllowRemoveMsg">Unable to delete messages in the voice/video chat room and the broadcast group of online members.</string>
<string name="TUIKitErrorSVRGroupAvchatRoomCountLimit">The number of created voice/video chat rooms exceeds the limit.</string>
<string name="TUIKitErrorSVRGroupCountLimit">The number of groups that a single user can create and join exceeds the limit.</string>
<string name="TUIKitErrorSVRGroupMemberCountLimit">The number of group members exceeds the limit.</string>
<string name="TUIKitErrorSVRNoSuccessResult">No success result returned for the batch operation.</string>
<string name="TUIKitErrorSVRToUserInvalid">IM: Invalid recipient</string>
<string name="TUIKitErrorSVRRequestTimeout">Request timeout</string>
<string name="TUIKitErrorSVRInitCoreFail">INIT CORE module failed</string>
<string name="TUIKitErrorExpiredSessionNode">SessionNode is null.</string>
<string name="TUIKitErrorLoggedOutBeforeLoginFinished">Logged out before login (returned at login time)</string>
<string name="TUIKitErrorTLSSDKNotInitialized">tlssdk is not initialized.</string>
<string name="TUIKitErrorTLSSDKUserNotFound">The user information for TLSSDK was not found.</string>
<string name="TUIKitErrorBindFaildRegTimeout">Registration timed out</string>
<string name="TUIKitErrorBindFaildIsBinding">The bind operation in progress.</string>
<string name="TUIKitErrorPacketFailUnknown">Unknown error occurred while sending packet</string>
<string name="TUIKitErrorPacketFailReqNoNet">No network connection when sending request packet, which is converted to case ERR_REQ_NO_NET_ON_REQ:</string>
<string name="TUIKitErrorPacketFailRespNoNet">No network connection when sending response packet, which is converted to case ERR_REQ_NO_NET_ON_RSP:</string>
<string name="TUIKitErrorPacketFailReqNoAuth">No permission when sending request packet</string>
<string name="TUIKitErrorPacketFailSSOErr">SSO error</string>
<string name="TUIKitErrorPacketFailRespTimeout">Response timed out</string>
<string name="TUIKitErrorFriendshipProxySyncing">proxy_manager failed to sync SVR data</string>
<string name="TUIKitErrorFriendshipProxySyncedFail">proxy_manager sync failed</string>
<string name="TUIKitErrorFriendshipProxyLocalCheckErr">proxy_manager request parameter is invalid in local check.</string>
<string name="TUIKitErrorGroupInvalidField">group assistant request field contains non-preset fields.</string>
<string name="TUIKitErrorGroupStoreageDisabled">Local storage of group assistant group data is disabled.</string>
<string name="TUIKitErrorLoadGrpInfoFailed">Failed to load groupinfo from storage</string>
<string name="TUIKitErrorReqNoNetOnReq">No network connection when sending request</string>
<string name="TUIKitErrorReqNoNetOnResp">No network connection when sending response</string>
<string name="TUIKitErrorServiceNotReady">QALSDK service is not ready.</string>
<string name="TUIKitErrorLoginAuthFailed">Account verification failed (user info get failed)</string>
<string name="TUIKitErrorNeverConnectAfterLaunch">Failed to connect network when the app is lunched.</string>
<string name="TUIKitErrorReqFailed">QAL execution failed</string>
<string name="TUIKitErrorReqInvaidReq">Invalid request. Invalid toMsgService.</string>
<string name="TUIKitErrorReqOnverLoaded">Request queue is full.</string>
<string name="TUIKitErrorReqKickOff">Forced logout on another device</string>
<string name="TUIKitErrorReqServiceSuspend">Service suspended</string>
<string name="TUIKitErrorReqInvalidSign">SSO signature error</string>
<string name="TUIKitErrorReqInvalidCookie">Invalid SSO cookie</string>
<string name="TUIKitErrorLoginTlsRspParseFailed">TSL response packet is verified at login time. Packet length error.</string>
<string name="TUIKitErrorLoginOpenMsgTimeout">Timeout occurred when OPENSTATSVC attempted to report status to OPENMSG during login.</string>
<string name="TUIKitErrorLoginOpenMsgRspParseFailed">Response parsing failed when OPENSTATSVC reports status to OPENMSG during login.</string>
<string name="TUIKitErrorLoginTslDecryptFailed">TLS decryption failed at login time.</string>
<string name="TUIKitErrorWifiNeedAuth">Verification is required for Wi-Fi connection.</string>
<string name="TUIKitErrorUserCanceled">Canceled by user</string>
<string name="TUIkitErrorRevokeTimeLimitExceed">Timed out recalling the message (default is 2 min).</string>
<string name="TUIKitErrorLackUGExt">Missing UGC extension pack</string>
<string name="TUIKitErrorAutoLoginNeedUserSig">Local ticket for auto login expired. userSig is required for manual login.</string>
<string name="TUIKitErrorQALNoShortConneAvailable">No available SSO for short connections.</string>
<string name="TUIKitErrorReqContentAttach">Message content is filtered due to security reasons.</string>
<string name="TUIKitErrorLoginSigExpire">Returned at login time. Ticket expired.</string>
<string name="TUIKitErrorSDKHadInit">SDK has been initialized. Do not initialize again.</string>
<string name="TUIKitErrorOpenBDHBase">Openbdh error</string>
<string name="TUIKitErrorRequestNoNetOnReq">No network connection when sending request. Try again once network connection is restored.</string>
<string name="TUIKitErrorRequestNoNetOnRsp">No network connection when sending response. Try again once network connection is restored.</string>
<string name="TUIKitErrorRequestOnverLoaded">Request queue is full.</string>
<string name="TUIKitErrorEnableUserStatusOnConsole">The user status not supported. Please enable the ability in the console first.</string>
</resources>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="open_file_tips">Select an app to open the file</string>
<string name="cancel">Cancel</string>
<string name="sure">Confirm</string>
<string name="core_permission_dialog_title">Authorization Request</string>
<string name="core_permission_dialog_positive_setting_text">Settings</string>
<string name="date_yesterday">Yesterday</string>
<string name="date_year_short">YYYY</string>
<string name="date_month_short">MM</string>
<string name="date_day_short">DD</string>
<string name="date_hour_short">HH</string>
<string name="date_minute_short">MM</string>
<string name="date_second_short">SS</string>
</resources>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CoreActivityTranslucent">
<item name="android:background">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowDisablePreview">true</item>
</style>
<style name="TUIBaseTheme">
</style>
</resources>
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 颜色规范 start -->
<attr name="core_light_bg_title_text_color" format="reference|color"/>
<attr name="core_light_bg_primary_text_color" format="reference|color"/>
<attr name="core_light_bg_secondary_text_color" format="reference|color"/>
<attr name="core_light_bg_secondary2_text_color" format="reference|color"/>
<attr name="core_light_bg_disable_text_color" format="reference|color"/>
<attr name="core_dark_bg_primary_text_color" format="reference|color"/>
<attr name="core_primary_bg_color" format="reference|color"/>
<attr name="core_bg_color" format="reference|color"/>
<attr name="core_primary_color" format="reference|color"/>
<attr name="core_error_tip_color" format="reference|color"/>
<attr name="core_success_tip_color" format="reference|color"/>
<attr name="core_bubble_bg_color" format="reference|color"/>
<attr name="core_divide_color" format="reference|color"/>
<attr name="core_border_color" format="reference|color"/>
<attr name="core_header_start_color" format="reference|color"/>
<attr name="core_header_end_color" format="reference|color"/>
<attr name="core_header_text_color" format="reference|color"/>
<attr name="core_btn_normal_color" format="reference|color"/>
<attr name="core_btn_pressed_color" format="reference|color"/>
<attr name="core_btn_disable_color" format="reference|color"/>
<!-- 颜色规范 end -->
</resources>