@asteriskzuo/react-native-easemob
Version:
easemob chat sdk of react-native.
156 lines (128 loc) • 5.71 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ChatContactGroupEvent = void 0;
exports.ChatContactGroupEventFromNumber = ChatContactGroupEventFromNumber;
let ChatContactGroupEvent;
exports.ChatContactGroupEvent = ChatContactGroupEvent;
(function (ChatContactGroupEvent) {
ChatContactGroupEvent[ChatContactGroupEvent["CONTACT_REMOVE"] = 0] = "CONTACT_REMOVE";
ChatContactGroupEvent[ChatContactGroupEvent["CONTACT_ACCEPT"] = 1] = "CONTACT_ACCEPT";
ChatContactGroupEvent[ChatContactGroupEvent["CONTACT_DECLINE"] = 2] = "CONTACT_DECLINE";
ChatContactGroupEvent[ChatContactGroupEvent["CONTACT_BAN"] = 3] = "CONTACT_BAN";
ChatContactGroupEvent[ChatContactGroupEvent["CONTACT_ALLOW"] = 4] = "CONTACT_ALLOW";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_CREATE"] = 5] = "GROUP_CREATE";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_DESTROY"] = 6] = "GROUP_DESTROY";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_JOIN"] = 7] = "GROUP_JOIN";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_LEAVE"] = 8] = "GROUP_LEAVE";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_APPLY"] = 9] = "GROUP_APPLY";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_APPLY_ACCEPT"] = 10] = "GROUP_APPLY_ACCEPT";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_APPLY_DECLINE"] = 11] = "GROUP_APPLY_DECLINE";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_INVITE"] = 12] = "GROUP_INVITE";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_INVITE_ACCEPT"] = 13] = "GROUP_INVITE_ACCEPT";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_INVITE_DECLINE"] = 14] = "GROUP_INVITE_DECLINE";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_KICK"] = 15] = "GROUP_KICK";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_BAN"] = 16] = "GROUP_BAN";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_ALLOW"] = 17] = "GROUP_ALLOW";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_BLOCK"] = 18] = "GROUP_BLOCK";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_UNBLOCK"] = 19] = "GROUP_UNBLOCK";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_ASSIGN_OWNER"] = 20] = "GROUP_ASSIGN_OWNER";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_ADD_ADMIN"] = 21] = "GROUP_ADD_ADMIN";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_REMOVE_ADMIN"] = 22] = "GROUP_REMOVE_ADMIN";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_ADD_MUTE"] = 23] = "GROUP_ADD_MUTE";
ChatContactGroupEvent[ChatContactGroupEvent["GROUP_REMOVE_MUTE"] = 24] = "GROUP_REMOVE_MUTE";
})(ChatContactGroupEvent || (exports.ChatContactGroupEvent = ChatContactGroupEvent = {}));
function ChatContactGroupEventFromNumber(params) {
switch (params) {
case 2:
return ChatContactGroupEvent.CONTACT_REMOVE;
case 3:
return ChatContactGroupEvent.CONTACT_ACCEPT;
case 4:
return ChatContactGroupEvent.CONTACT_DECLINE;
case 5:
return ChatContactGroupEvent.CONTACT_BAN;
case 6:
return ChatContactGroupEvent.CONTACT_ALLOW;
case 10:
return ChatContactGroupEvent.GROUP_CREATE;
case 11:
return ChatContactGroupEvent.GROUP_DESTROY;
case 12:
return ChatContactGroupEvent.GROUP_JOIN;
case 13:
return ChatContactGroupEvent.GROUP_LEAVE;
case 14:
return ChatContactGroupEvent.GROUP_APPLY;
case 15:
return ChatContactGroupEvent.GROUP_APPLY_ACCEPT;
case 16:
return ChatContactGroupEvent.GROUP_APPLY_DECLINE;
case 17:
return ChatContactGroupEvent.GROUP_INVITE;
case 18:
return ChatContactGroupEvent.GROUP_INVITE_ACCEPT;
case 19:
return ChatContactGroupEvent.GROUP_INVITE_DECLINE;
case 20:
return ChatContactGroupEvent.GROUP_KICK;
case 21:
return ChatContactGroupEvent.GROUP_BAN;
case 22:
return ChatContactGroupEvent.GROUP_ALLOW;
case 23:
return ChatContactGroupEvent.GROUP_BLOCK;
case 24:
return ChatContactGroupEvent.GROUP_UNBLOCK;
case 25:
return ChatContactGroupEvent.GROUP_ASSIGN_OWNER;
case 26:
return ChatContactGroupEvent.GROUP_ADD_ADMIN;
case 27:
return ChatContactGroupEvent.GROUP_REMOVE_ADMIN;
case 28:
return ChatContactGroupEvent.GROUP_ADD_MUTE;
case 29:
return ChatContactGroupEvent.GROUP_REMOVE_MUTE;
default:
throw new Error(`not exist this type: ${params}`);
}
}
/**
* The chat connection listener.
*
* For the occasion of onDisconnected during unstable network condition, you
* don't need to reconnect manually, the chat SDK will handle it automatically.
*
* There are only two states: onConnected, onDisconnected.
*
* Note: We recommend not to update UI based on those methods, because this
* method is called on worker thread. If you update UI in those methods, other
* UI errors might be invoked. Also do not insert heavy computation work here,
* which might invoke other listeners to handle this connection event.
*
* Register:
* ```typescript
* let listener = new (class s implements ChatConnectionListener {
* onTokenWillExpire(): void {
* console.log('ConnectScreen.onTokenWillExpire');
* }
* onTokenDidExpire(): void {
* console.log('ConnectScreen.onTokenDidExpire');
* }
* onConnected(): void {
* console.log('ConnectScreen.onConnected');
* }
* onDisconnected(errorCode?: number): void {
* console.log('ConnectScreen.onDisconnected', errorCode);
* }
* })();
* ChatClient.getInstance().addConnectionListener(listener);
* ```
* Unregister:
* ```typescript
* ChatClient.getInstance().removeConnectionListener(listener);
* ```
*/
//# sourceMappingURL=ChatEvents.js.map