@ethora/chat-component-rn 26.10.1 → 26.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/MainComponents/ChatHeader.js +11 -10
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js +10 -2
- package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +8 -18
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +17 -14
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +131 -17
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +6 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/CallButtons.js +3 -1
- package/lib/commonjs/components/VideoCalls/CallButtons.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js +123 -111
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js +207 -346
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/callActions.js +61 -0
- package/lib/commonjs/components/VideoCalls/callActions.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/callSessionController.js +431 -0
- package/lib/commonjs/components/VideoCalls/callSessionController.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/useDraggable.js +59 -0
- package/lib/commonjs/components/VideoCalls/useDraggable.js.map +1 -0
- package/lib/commonjs/helpers/createRoomFromApi.js +4 -0
- package/lib/commonjs/helpers/createRoomFromApi.js.map +1 -1
- package/lib/commonjs/helpers/incomingCallFromPush.js +1 -1
- package/lib/commonjs/helpers/incomingCallFromPush.js.map +1 -1
- package/lib/commonjs/helpers/roomUserCount.js +7 -1
- package/lib/commonjs/helpers/roomUserCount.js.map +1 -1
- package/lib/commonjs/helpers/uniqueMembers.js +36 -0
- package/lib/commonjs/helpers/uniqueMembers.js.map +1 -0
- package/lib/commonjs/hooks/useLeaveRoom.js +52 -0
- package/lib/commonjs/hooks/useLeaveRoom.js.map +1 -0
- package/lib/commonjs/hooks/useLogout.js +15 -10
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +18 -0
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +36 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/callTokenStanza.js +47 -3
- package/lib/commonjs/networking/callTokenStanza.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +9 -2
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +13 -12
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/MessageContainer.js +10 -2
- package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +8 -18
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +18 -15
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +132 -18
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +6 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/VideoCalls/CallButtons.js +3 -1
- package/lib/module/components/VideoCalls/CallButtons.js.map +1 -1
- package/lib/module/components/VideoCalls/VideoCallOverlay.js +125 -113
- package/lib/module/components/VideoCalls/VideoCallOverlay.js.map +1 -1
- package/lib/module/components/VideoCalls/VideoCallSession.js +208 -348
- package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/module/components/VideoCalls/callActions.js +55 -0
- package/lib/module/components/VideoCalls/callActions.js.map +1 -0
- package/lib/module/components/VideoCalls/callSessionController.js +420 -0
- package/lib/module/components/VideoCalls/callSessionController.js.map +1 -0
- package/lib/module/components/VideoCalls/useDraggable.js +55 -0
- package/lib/module/components/VideoCalls/useDraggable.js.map +1 -0
- package/lib/module/helpers/createRoomFromApi.js +4 -0
- package/lib/module/helpers/createRoomFromApi.js.map +1 -1
- package/lib/module/helpers/incomingCallFromPush.js +1 -1
- package/lib/module/helpers/incomingCallFromPush.js.map +1 -1
- package/lib/module/helpers/roomUserCount.js +7 -1
- package/lib/module/helpers/roomUserCount.js.map +1 -1
- package/lib/module/helpers/uniqueMembers.js +31 -0
- package/lib/module/helpers/uniqueMembers.js.map +1 -0
- package/lib/module/hooks/useLeaveRoom.js +48 -0
- package/lib/module/hooks/useLeaveRoom.js.map +1 -0
- package/lib/module/hooks/useLogout.js +15 -10
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/i18n/strings.js +18 -0
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +35 -1
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/callTokenStanza.js +47 -3
- package/lib/module/networking/callTokenStanza.js.map +1 -1
- package/lib/module/networking/xmppClient.js +8 -1
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/CallButtons.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts +0 -6
- package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts +9 -20
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/callActions.d.ts +15 -0
- package/lib/typescript/components/VideoCalls/callActions.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/callSessionController.d.ts +61 -0
- package/lib/typescript/components/VideoCalls/callSessionController.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/useDraggable.d.ts +19 -0
- package/lib/typescript/components/VideoCalls/useDraggable.d.ts.map +1 -0
- package/lib/typescript/helpers/createRoomFromApi.d.ts.map +1 -1
- package/lib/typescript/helpers/roomUserCount.d.ts +1 -0
- package/lib/typescript/helpers/roomUserCount.d.ts.map +1 -1
- package/lib/typescript/helpers/uniqueMembers.d.ts +11 -0
- package/lib/typescript/helpers/uniqueMembers.d.ts.map +1 -0
- package/lib/typescript/hooks/useLeaveRoom.d.ts +9 -0
- package/lib/typescript/hooks/useLeaveRoom.d.ts.map +1 -0
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts +8 -0
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/callTokenStanza.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/MainComponents/ChatHeader.tsx +10 -8
- package/src/components/MainComponents/MessageContainer.tsx +14 -1
- package/src/components/MainComponents/RoomList.tsx +8 -14
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +16 -13
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +167 -36
- package/src/components/RoomComponents/ChatRoomItem.tsx +8 -1
- package/src/components/VideoCalls/CallButtons.tsx +5 -1
- package/src/components/VideoCalls/VideoCallOverlay.tsx +156 -163
- package/src/components/VideoCalls/VideoCallSession.tsx +207 -378
- package/src/components/VideoCalls/callActions.ts +63 -0
- package/src/components/VideoCalls/callSessionController.ts +421 -0
- package/src/components/VideoCalls/useDraggable.ts +46 -0
- package/src/helpers/createRoomFromApi.tsx +2 -0
- package/src/helpers/incomingCallFromPush.ts +2 -2
- package/src/helpers/roomUserCount.ts +6 -2
- package/src/helpers/uniqueMembers.ts +26 -0
- package/src/hooks/useLeaveRoom.ts +42 -0
- package/src/hooks/useLogout.tsx +15 -10
- package/src/i18n/strings.ts +18 -0
- package/src/networking/api-requests/rooms.api.ts +28 -1
- package/src/networking/callTokenStanza.ts +46 -6
- package/src/networking/xmppClient.ts +10 -1
- package/src/version.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniqueMembers.d.ts","sourceRoot":"","sources":["../../../src/helpers/uniqueMembers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAG,SAAS,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,KAAG,CAAC,EAgBpE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Leave a chat, shared by the room-list swipe, the chat header and the chat
|
|
3
|
+
* profile. The server goes first: if it refuses, the chat stays where it is
|
|
4
|
+
* (dropping it locally would only have it come back on the next /chats/my).
|
|
5
|
+
* Then the unavailable presence to the MUC and the room out of the store.
|
|
6
|
+
* Resolves false on failure, so the caller can say so in its own way.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useLeaveRoom: () => (jid: string) => Promise<boolean>;
|
|
9
|
+
//# sourceMappingURL=useLeaveRoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLeaveRoom.d.ts","sourceRoot":"","sources":["../../../src/hooks/useLeaveRoom.ts"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,cAIT,MAAM,KAAG,OAAO,CAAC,OAAO,CAqBvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogout.d.ts","sourceRoot":"","sources":["../../../src/hooks/useLogout.tsx"],"names":[],"mappings":"AA6BA,QAAA,MAAM,aAAa;IACjB;;;;;;;;;;;;;;;;;;;;OAoBG;yBACsB,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"useLogout.d.ts","sourceRoot":"","sources":["../../../src/hooks/useLogout.tsx"],"names":[],"mappings":"AA6BA,QAAA,MAAM,aAAa;IACjB;;;;;;;;;;;;;;;;;;;;OAoBG;yBACsB,OAAO,CAAC,IAAI,CAAC;CA4HvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,SAAS,QAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAahD,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../../src/i18n/strings.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../../src/i18n/strings.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AA4uEnD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAOzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,gFAAgF;AAChF,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,GAAG,IAAI,KAAG,MAIf,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,MAAM,GAAG,IAAI,EACtB,YAAY,aAAa,GAAG,IAAI,KAC/B,aAQF,CAAC;AAEF,6DAA6D;AAC7D,eAAO,MAAM,WAAW,GACtB,UAAU,MAAM,EAChB,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAKF,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,YAAY,GACvB,KAAK,MAAM,EACX,SAAS,MAAM,GAAG,IAAI,EACtB,YAAY,aAAa,GAAG,IAAI,EAChC,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAGF,CAAC"}
|
|
@@ -45,6 +45,14 @@ export declare function setRoomMuted(chatName: string, muted: boolean): Promise<
|
|
|
45
45
|
export declare function postReportRoom(data: PostReportRoom): Promise<any>;
|
|
46
46
|
export declare function postAddRoomMember(data: PostAddRoomMember): Promise<RoomMember[]>;
|
|
47
47
|
export declare function deleteRoomMember(data: DeleteRoomMember): Promise<any>;
|
|
48
|
+
/**
|
|
49
|
+
* Take the signed-in user out of a chat on the server (self-removal via the
|
|
50
|
+
* same endpoint that removes other members). The unavailable presence alone
|
|
51
|
+
* only leaves the MUC for this session: the backend keeps the user in
|
|
52
|
+
* `members` and the next /chats/my brings the chat back. A 404 means the
|
|
53
|
+
* server already has us out, which is what we wanted.
|
|
54
|
+
*/
|
|
55
|
+
export declare function leaveRoom(chatName: string): Promise<void>;
|
|
48
56
|
export declare function deleteRoom(name: string): Promise<any>;
|
|
49
57
|
export declare function createChatCall(chatName: string, options?: {
|
|
50
58
|
kind?: 'audio' | 'video';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rooms.api.d.ts","sourceRoot":"","sources":["../../../../src/networking/api-requests/rooms.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"rooms.api.d.ts","sourceRoot":"","sources":["../../../../src/networking/api-requests/rooms.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAwFnI;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED,wBAAgB,QAAQ,IAAI,MAAM,CAKjC;AAqHD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,OAAO,CAAC,OAAO,CAAC,CAuDlB;AAmBD;;;;GAIG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC,CA2C9D;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAatE;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,QAAQ,gBAa5C;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,OAAe,GACpB,OAAO,CAAC,OAAO,CAAC,CAiBlB;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAarF;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,gBAkBxD;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,UAAU,EAAE,CAAC,CAkBvB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,gBAkB5D;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB/D;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,gBAc5C;AAqBD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAAE,GACrC,OAAO,CAAC,IAAI,CAAC,CAyBf;AAED,wBAAgB,mBAAmB,SAGlC;AAED,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callTokenStanza.d.ts","sourceRoot":"","sources":["../../../src/networking/callTokenStanza.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"callTokenStanza.d.ts","sourceRoot":"","sources":["../../../src/networking/callTokenStanza.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAyU9B,eAAO,MAAM,kBAAkB,GAAI,QAAQ,OAAO,KAAG,OA6OpD,CAAC;AAYF,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAE9E,eAAO,MAAM,mBAAmB,GAC9B,OAAO,eAAe,EACtB,UAAU;IACR,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,KACA,IA0CF,CAAC;AAUF,eAAO,MAAM,oBAAoB,GAC/B,MAAM,OAAO,GAAG,OAAO,EACvB,SAAS;IACP,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,KACA,IA6BF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xmppClient.d.ts","sourceRoot":"","sources":["../../../src/networking/xmppClient.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"xmppClient.d.ts","sourceRoot":"","sources":["../../../src/networking/xmppClient.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,MAAM,EAAO,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAQjE,OAAO,EAIL,WAAW,EACX,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA+EvD,KAAK,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,CAAC;AAEtE,UAAU,cAAc;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;wEAEoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAkBD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,wEAAwE;AACxE,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,EAAE,EAAE,OAAO,CAAC;IACZ,uEAAuE;IACvE,QAAQ,EAAE,Q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AI,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM;IA+BpE,cAAc,CAAC,aAAa,EAAE,MAAM;IAI9B,uBAAuB,CAC3B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,MAAM,CAAC;IAMlB,yBAAyB,CACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EAAE,EACvB,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAkBlD,qCAAqC,CACnC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,iBAAiB,CAAC,EAAE,MAAM,EAC1B,OAAO,CAAC,EAAE,OAAO,EACjB,aAAa,CAAC,EAAE,OAAO,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO;CA6CX;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ETHORA_CHAT_COMPONENT_VERSION = "26.10.
|
|
1
|
+
export declare const ETHORA_CHAT_COMPONENT_VERSION = "26.10.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -21,18 +21,17 @@ import { useDispatch, useSelector, useStore } from 'react-redux';
|
|
|
21
21
|
import type { RootState } from '../../roomStore';
|
|
22
22
|
import Composing from '../styled/StyledInputComponents/Composing';
|
|
23
23
|
import {
|
|
24
|
-
deleteRoom,
|
|
25
24
|
setCurrentRoom,
|
|
26
25
|
setIsLoading,
|
|
27
26
|
} from '../../roomStore/roomsSlice';
|
|
28
|
-
import {
|
|
27
|
+
import { useLeaveRoom } from '../../hooks/useLeaveRoom';
|
|
29
28
|
import { setActiveModal } from '../../roomStore/chatSettingsSlice';
|
|
30
29
|
import { MODAL_TYPES } from '../../helpers/constants/MODAL_TYPES';
|
|
31
30
|
import { RoomMenu } from '../MenuRoom/MenuRoom';
|
|
32
31
|
import { useChatSettingState } from '../../hooks/useChatSettingState';
|
|
33
32
|
import { useFileToken } from '../../hooks/useFileToken';
|
|
34
33
|
import { appendFileToken } from '../../helpers/secureFileUrl';
|
|
35
|
-
import { View, StyleSheet, Text, Keyboard } from 'react-native';
|
|
34
|
+
import { Alert, View, StyleSheet, Text, Keyboard } from 'react-native';
|
|
36
35
|
import { getIconColor } from '../../helpers/getIconColor';
|
|
37
36
|
import { useTheme } from '../../hooks/useTheme';
|
|
38
37
|
import { resolveHeaderHeight } from '../../helpers/headerLayout';
|
|
@@ -52,7 +51,7 @@ const ChatHeader: React.FC<ChatHeaderProps> = ({
|
|
|
52
51
|
}) => {
|
|
53
52
|
const fileToken = useFileToken();
|
|
54
53
|
const dispatch = useDispatch();
|
|
55
|
-
const
|
|
54
|
+
const leaveRoom = useLeaveRoom();
|
|
56
55
|
|
|
57
56
|
const reduxStore = useStore<RootState>();
|
|
58
57
|
const activeRoomJID = useSelector(
|
|
@@ -79,16 +78,19 @@ const ChatHeader: React.FC<ChatHeaderProps> = ({
|
|
|
79
78
|
dispatch(setIsLoading({ chatJID: chat.jid, loading: true }));
|
|
80
79
|
};
|
|
81
80
|
|
|
82
|
-
const handleLeaveClick = useCallback(() => {
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
const handleLeaveClick = useCallback(async () => {
|
|
82
|
+
if (!activeRoomJID) {return;}
|
|
83
|
+
if (!(await leaveRoom(activeRoomJID))) {
|
|
84
|
+
Alert.alert(t('toast.error'), t('toast.leaveFailed'));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
85
87
|
|
|
86
88
|
const nextRoomJID =
|
|
87
89
|
Object.keys(reduxStore.getState().rooms.rooms || {})[0] || null;
|
|
88
90
|
if (nextRoomJID) {
|
|
89
91
|
dispatch(setCurrentRoom({ roomJID: nextRoomJID }));
|
|
90
92
|
}
|
|
91
|
-
}, [activeRoomJID, reduxStore, dispatch,
|
|
93
|
+
}, [activeRoomJID, reduxStore, dispatch, leaveRoom, t]);
|
|
92
94
|
|
|
93
95
|
const handleHeaderChatMenu = () => {
|
|
94
96
|
Keyboard.dismiss();
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
Message,
|
|
9
9
|
} from '../styled/StyledComponents';
|
|
10
10
|
import { View } from 'react-native';
|
|
11
|
+
import { useT } from '../../i18n/useT';
|
|
12
|
+
import { formatCallLogLabel } from '../../helpers/callLogMessage';
|
|
11
13
|
|
|
12
14
|
interface MessageContainerProps {
|
|
13
15
|
CustomMessage?: React.ComponentType<{
|
|
@@ -48,6 +50,7 @@ const MessageContainerImpl: FC<MessageContainerProps> = ({
|
|
|
48
50
|
// empty/undefined ids as a match, briefly rendering catch-up messages
|
|
49
51
|
// from other users as our own. isOwnMessage() never does that.
|
|
50
52
|
const isUser = isOwnMessage(message, walletAddress);
|
|
53
|
+
const t = useT();
|
|
51
54
|
|
|
52
55
|
const messageDate = new Date(message.date);
|
|
53
56
|
|
|
@@ -68,7 +71,17 @@ const MessageContainerImpl: FC<MessageContainerProps> = ({
|
|
|
68
71
|
{SystemMessageComponent ? (
|
|
69
72
|
<SystemMessageComponent message={message} isUser={false} isReply={false} />
|
|
70
73
|
) : (
|
|
71
|
-
|
|
74
|
+
// A call-log entry is labelled from its callLog meta at render
|
|
75
|
+
// time so it follows the current language instead of being
|
|
76
|
+
// frozen in whatever was active when the stanza landed.
|
|
77
|
+
<SystemMessage
|
|
78
|
+
messageText={
|
|
79
|
+
message.callLog
|
|
80
|
+
? formatCallLogLabel(message.callLog, t, message.body)
|
|
81
|
+
: message.body
|
|
82
|
+
}
|
|
83
|
+
colors={config?.colors}
|
|
84
|
+
/>
|
|
72
85
|
)}
|
|
73
86
|
</Fragment>
|
|
74
87
|
);
|
|
@@ -18,9 +18,6 @@ import {
|
|
|
18
18
|
NativeScrollEvent,
|
|
19
19
|
NativeSyntheticEvent,
|
|
20
20
|
} from 'react-native';
|
|
21
|
-
import { useDispatch } from 'react-redux';
|
|
22
|
-
import { deleteRoom } from '../../roomStore/roomsSlice';
|
|
23
|
-
import { useXmppClient } from '../../context/xmppProvider';
|
|
24
21
|
import SwipeableRoomRow, { closeOpenRoomRow } from '../RoomComponents/SwipeableRoomRow';
|
|
25
22
|
import ReportChatModal from '../Modals/ChatProfileModal/ReportChatModal';
|
|
26
23
|
import { IRoom } from '../../types/types';
|
|
@@ -35,6 +32,7 @@ import { getIconColor } from '../../helpers/getIconColor';
|
|
|
35
32
|
import { useT } from '../../i18n/useT';
|
|
36
33
|
import { useTheme } from '../../hooks/useTheme';
|
|
37
34
|
import { useRoomMute } from '../../hooks/useRoomMute';
|
|
35
|
+
import { useLeaveRoom } from '../../hooks/useLeaveRoom';
|
|
38
36
|
import { isMessageSearchEnabled } from '../../helpers/isMessageSearchEnabled';
|
|
39
37
|
import { useMessageSearch } from '../Modals/MessageSearchModal/useMessageSearch';
|
|
40
38
|
import type { MessageSearchHit } from '../../networking/api-requests/messageSearch.api';
|
|
@@ -95,8 +93,6 @@ const RoomList: React.FC<RoomListProps> = ({
|
|
|
95
93
|
const { config } = useChatSettingState();
|
|
96
94
|
const t = useT();
|
|
97
95
|
const theme = useTheme();
|
|
98
|
-
const dispatch = useDispatch();
|
|
99
|
-
const { client } = useXmppClient();
|
|
100
96
|
|
|
101
97
|
const [open, setOpen] = useState(false);
|
|
102
98
|
// The room a swiped row's Report opened the form for.
|
|
@@ -141,9 +137,10 @@ const RoomList: React.FC<RoomListProps> = ({
|
|
|
141
137
|
setSearchTerm(text);
|
|
142
138
|
}, []);
|
|
143
139
|
|
|
144
|
-
// Behind a row swiped left. Leaving is the chat profile's flow:
|
|
145
|
-
//
|
|
140
|
+
// Behind a row swiped left. Leaving is the chat profile's flow: the
|
|
141
|
+
// server takes us out of the members, then the MUC and the store.
|
|
146
142
|
const swipeActions = !config?.disableRoomSwipeActions;
|
|
143
|
+
const leaveRoom = useLeaveRoom();
|
|
147
144
|
const handleLeaveRoom = useCallback(
|
|
148
145
|
(jid: string) => {
|
|
149
146
|
Alert.alert(t('modal.leaveChat.title'), t('modal.leaveChat.description'), [
|
|
@@ -151,18 +148,15 @@ const RoomList: React.FC<RoomListProps> = ({
|
|
|
151
148
|
{
|
|
152
149
|
text: t('action.leave'),
|
|
153
150
|
style: 'destructive',
|
|
154
|
-
onPress: () => {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
} catch (error) {
|
|
158
|
-
console.error('Failed to leave the room:', error);
|
|
151
|
+
onPress: async () => {
|
|
152
|
+
if (!(await leaveRoom(jid))) {
|
|
153
|
+
Alert.alert(t('toast.error'), t('toast.leaveFailed'));
|
|
159
154
|
}
|
|
160
|
-
dispatch(deleteRoom({ jid }));
|
|
161
155
|
},
|
|
162
156
|
},
|
|
163
157
|
]);
|
|
164
158
|
},
|
|
165
|
-
[
|
|
159
|
+
[leaveRoom, t]
|
|
166
160
|
);
|
|
167
161
|
const handleReportRoom = useCallback((jid: string) => setReportJid(jid), []);
|
|
168
162
|
const toggleRoomMuted = useRoomMute();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
|
|
3
3
|
import { composeName } from '../../../helpers/displayName';
|
|
4
|
+
import { uniqueMembers } from '../../../helpers/uniqueMembers';
|
|
4
5
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
6
|
import {
|
|
6
7
|
Alert,
|
|
@@ -23,7 +24,7 @@ import { ProfileImagePlaceholder } from '../../MainComponents/ProfileImagePlaceh
|
|
|
23
24
|
import { RootState, getActiveRoom } from '../../../roomStore';
|
|
24
25
|
import { uploadFile } from '../../../networking/api-requests/auth.api';
|
|
25
26
|
import { useXmppClient } from '../../../context/xmppProvider';
|
|
26
|
-
import {
|
|
27
|
+
import { updateRoom } from '../../../roomStore/roomsSlice';
|
|
27
28
|
import Loader from '../../styled/Loader';
|
|
28
29
|
import {
|
|
29
30
|
AddNewIcon,
|
|
@@ -48,6 +49,7 @@ import { MODAL_TYPES } from '../../../helpers/constants/MODAL_TYPES';
|
|
|
48
49
|
import SelectUsersModal from '../SelectUsersModal/SelectUsersModal';
|
|
49
50
|
import { useToast } from '../../../context/ToastContext';
|
|
50
51
|
import { useRoomMute } from '../../../hooks/useRoomMute';
|
|
52
|
+
import { useLeaveRoom } from '../../../hooks/useLeaveRoom';
|
|
51
53
|
import { useT } from '../../../i18n/useT';
|
|
52
54
|
import DeleteChatModal from './DeleteChatModal';
|
|
53
55
|
import { isMessageSearchEnabled } from '../../../helpers/isMessageSearchEnabled';
|
|
@@ -111,6 +113,7 @@ const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
|
|
|
111
113
|
const { showToast } = useToast();
|
|
112
114
|
const dispatch = useDispatch();
|
|
113
115
|
const { client } = useXmppClient();
|
|
116
|
+
const leaveRoom = useLeaveRoom();
|
|
114
117
|
const { user: stateUser, config } = useChatSettingState();
|
|
115
118
|
const theme = useTheme();
|
|
116
119
|
const styles = useMemo(() => createStyles(theme), [theme]);
|
|
@@ -155,12 +158,14 @@ const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
|
|
|
155
158
|
// true total). Opening the profile loads the whole room directory (once per
|
|
156
159
|
// room, deduplicated, paged) and lists it after the known members.
|
|
157
160
|
const knownMembers = useMemo<RoomMember[]>(
|
|
158
|
-
|
|
161
|
+
// Deduped at display too: a list already cached with repeats (a 1:1
|
|
162
|
+
// chat showing four rows) cleans up without waiting for a refetch.
|
|
163
|
+
() => uniqueMembers(activeRoom?.roomMembers ?? activeRoom?.members ?? []),
|
|
159
164
|
[activeRoom?.roomMembers, activeRoom?.members]
|
|
160
165
|
);
|
|
161
166
|
const countSource = useMemo(
|
|
162
|
-
() => ({ members: knownMembers, usersCnt: activeRoom?.usersCnt }),
|
|
163
|
-
[knownMembers, activeRoom?.usersCnt]
|
|
167
|
+
() => ({ members: knownMembers, usersCnt: activeRoom?.usersCnt, type: activeRoom?.type }),
|
|
168
|
+
[knownMembers, activeRoom?.usersCnt, activeRoom?.type]
|
|
164
169
|
);
|
|
165
170
|
const membersTruncated = isRoomMembersTruncated(countSource);
|
|
166
171
|
const { members: directoryMembers, state: directoryState } =
|
|
@@ -335,22 +340,20 @@ const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
|
|
|
335
340
|
);
|
|
336
341
|
};
|
|
337
342
|
|
|
338
|
-
// Leaving
|
|
339
|
-
// room from the store is what
|
|
340
|
-
// the UI, and the `!activeRoom` effect above then closes this modal.
|
|
343
|
+
// Leaving takes us out of the members on the server, then out of the MUC;
|
|
344
|
+
// dropping the room from the store is what takes the user out of the chat
|
|
345
|
+
// in the UI, and the `!activeRoom` effect above then closes this modal.
|
|
341
346
|
const handleLeave = () => {
|
|
342
347
|
Alert.alert(t('modal.leaveChat.title'), t('modal.leaveChat.description'), [
|
|
343
348
|
{ text: t('action.cancel'), style: 'cancel' },
|
|
344
349
|
{
|
|
345
350
|
text: t('action.leave'),
|
|
346
351
|
style: 'destructive',
|
|
347
|
-
onPress: () => {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
console.error('Failed to leave the room:', error);
|
|
352
|
+
onPress: async () => {
|
|
353
|
+
if (!(await leaveRoom(activeRoom?.jid || ''))) {
|
|
354
|
+
Alert.alert(t('toast.error'), t('toast.leaveFailed'));
|
|
355
|
+
return;
|
|
352
356
|
}
|
|
353
|
-
dispatch(deleteRoom({ jid: activeRoom?.jid || '' }));
|
|
354
357
|
handleCloseModal?.();
|
|
355
358
|
},
|
|
356
359
|
},
|
|
@@ -44,15 +44,25 @@ import { runLogoutFlow } from '../../Menu/HeaderRoomListMenu';
|
|
|
44
44
|
import { useLogout } from '../../../hooks/useLogout';
|
|
45
45
|
import {
|
|
46
46
|
ApiRoom,
|
|
47
|
+
createChatCall,
|
|
47
48
|
ownAppId,
|
|
48
49
|
postPrivateRoom,
|
|
49
50
|
} from '../../../networking/api-requests/rooms.api';
|
|
50
51
|
import EncryptionCard from '../../MainComponents/EncryptionCard';
|
|
52
|
+
import { useSelector } from 'react-redux';
|
|
53
|
+
import { store, type RootState } from '../../../roomStore';
|
|
54
|
+
import { setCallError, startOutgoingCall } from '../../../roomStore/callSlice';
|
|
55
|
+
import { sendCallInviteSignal } from '../../../networking/callTokenStanza';
|
|
56
|
+
import { AudioCallIcon, VideoCallIcon } from '../../VideoCalls/CallIcons';
|
|
51
57
|
import { accountNameOf } from '../../../helpers/accountName';
|
|
52
58
|
import { setChatLanguage } from '../../../services/languageSettings';
|
|
53
59
|
import { composeName } from '../../../helpers/displayName';
|
|
54
60
|
import { isUnresolvedSenderId } from '../../../helpers/isUnresolvedSenderId';
|
|
55
61
|
|
|
62
|
+
/** The user id part of `${appId}_${userId}[@host]` (or a bare id). */
|
|
63
|
+
const userIdOf = (value?: string | null): string =>
|
|
64
|
+
String(value || '').split('@')[0].split('_').pop() || '';
|
|
65
|
+
|
|
56
66
|
/** A name, unless it is only the account's id standing in for one. */
|
|
57
67
|
const nameOrNothing = (name?: string | null): string => {
|
|
58
68
|
const trimmed = String(name ?? '').trim();
|
|
@@ -239,7 +249,7 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
|
239
249
|
usersArrayLength
|
|
240
250
|
);
|
|
241
251
|
|
|
242
|
-
if (!normalizedChat || !client) {return;}
|
|
252
|
+
if (!normalizedChat || !client) {return null;}
|
|
243
253
|
|
|
244
254
|
dispatch(addRoomViaApi({ room: normalizedChat, xmpp: client }));
|
|
245
255
|
dispatch(setCurrentRoom({ roomJID: normalizedChat?.jid || '' }));
|
|
@@ -251,11 +261,93 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
|
251
261
|
type: 'success',
|
|
252
262
|
duration: 3000,
|
|
253
263
|
});
|
|
264
|
+
return normalizedChat;
|
|
254
265
|
} catch (error) {
|
|
255
266
|
console.error('Error handling room creation:', error);
|
|
267
|
+
return null;
|
|
256
268
|
}
|
|
257
269
|
};
|
|
258
270
|
|
|
271
|
+
// Open (or create) the 1:1 room with the profile's user. Shared by
|
|
272
|
+
// "Message" and the call buttons, which need the room's JID to dial.
|
|
273
|
+
const ensurePrivateRoom = useCallback(async (
|
|
274
|
+
e2ee = false
|
|
275
|
+
): Promise<{
|
|
276
|
+
jid: string;
|
|
277
|
+
bareName: string;
|
|
278
|
+
peerXmppUsername: string | null;
|
|
279
|
+
peerDisplay: string;
|
|
280
|
+
} | null> => {
|
|
281
|
+
const peerDisplay = nameOrNothing(selectedUser?.name);
|
|
282
|
+
if (config?.newArch) {
|
|
283
|
+
const target = selectedUser?.userJID ?? (selectedUser?.id || '');
|
|
284
|
+
// Reuse the 1:1 room we already have with this user instead of
|
|
285
|
+
// POSTing /chats/private again: repeating it for an existing room
|
|
286
|
+
// has been seen to inflate the server's usersCnt and member list.
|
|
287
|
+
const peerLocal = String(target).split('@')[0];
|
|
288
|
+
const existing = Object.values(store.getState().rooms.rooms || {}).find(
|
|
289
|
+
(room: any) =>
|
|
290
|
+
room?.type === 'private' &&
|
|
291
|
+
!!peerLocal &&
|
|
292
|
+
[...(room.roomMembers || []), ...(room.members || [])].some(
|
|
293
|
+
// REST rows carry the bare user id, stanza rows `${appId}_${id}`:
|
|
294
|
+
// compare on the user id part.
|
|
295
|
+
(m: any) => userIdOf(m?.xmppUsername || m?._id) === userIdOf(peerLocal)
|
|
296
|
+
)
|
|
297
|
+
) as any;
|
|
298
|
+
if (existing?.jid && !e2ee) {
|
|
299
|
+
dispatch(setCurrentRoom({ roomJID: existing.jid }));
|
|
300
|
+
return {
|
|
301
|
+
jid: existing.jid,
|
|
302
|
+
bareName: existing.jid.split('@')[0],
|
|
303
|
+
peerXmppUsername: peerLocal || null,
|
|
304
|
+
peerDisplay: peerDisplay || nameOrNothing(existing.title),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
const newRoom = await postPrivateRoom(target, e2ee);
|
|
308
|
+
const created = await handleRoomCreation(newRoom, 2);
|
|
309
|
+
if (!created?.jid) {return null;}
|
|
310
|
+
return {
|
|
311
|
+
jid: created.jid,
|
|
312
|
+
bareName: created.jid.split('@')[0],
|
|
313
|
+
peerXmppUsername: String(target).split('@')[0] || null,
|
|
314
|
+
peerDisplay: peerDisplay || nameOrNothing((created as any).title),
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const selectedUserUsername = walletToUsername(selectedUser?.id || '');
|
|
319
|
+
const myUsername = walletToUsername(user.defaultWallet.walletAddress);
|
|
320
|
+
|
|
321
|
+
const roomJid = [myUsername, selectedUserUsername]
|
|
322
|
+
.sort()
|
|
323
|
+
.join('.')
|
|
324
|
+
.toLowerCase();
|
|
325
|
+
|
|
326
|
+
const combinedUsersName = [
|
|
327
|
+
user.firstName,
|
|
328
|
+
selectedUser?.name?.split(' ')?.[0] || '',
|
|
329
|
+
]
|
|
330
|
+
.sort()
|
|
331
|
+
.join(' and ');
|
|
332
|
+
|
|
333
|
+
const newRoomJid =
|
|
334
|
+
(await client?.createPrivateRoomStanza(
|
|
335
|
+
combinedUsersName,
|
|
336
|
+
`Private chat ${combinedUsersName}`,
|
|
337
|
+
roomJid
|
|
338
|
+
)) || '';
|
|
339
|
+
|
|
340
|
+
if (!newRoomJid) {return null;}
|
|
341
|
+
await client?.inviteRoomRequestStanza(selectedUserUsername, newRoomJid);
|
|
342
|
+
await client?.getRoomsStanza();
|
|
343
|
+
return {
|
|
344
|
+
jid: newRoomJid,
|
|
345
|
+
bareName: newRoomJid.split('@')[0],
|
|
346
|
+
peerXmppUsername: selectedUserUsername || null,
|
|
347
|
+
peerDisplay,
|
|
348
|
+
};
|
|
349
|
+
}, [selectedUser, config?.newArch, client, user]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
350
|
+
|
|
259
351
|
const openPrivateRoom = useCallback(async (e2ee: boolean) => {
|
|
260
352
|
showToast({
|
|
261
353
|
id: Date.now().toString(),
|
|
@@ -264,43 +356,62 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
|
264
356
|
type: 'info',
|
|
265
357
|
duration: 3000,
|
|
266
358
|
});
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
359
|
+
await ensurePrivateRoom(e2ee);
|
|
360
|
+
dispatch(setActiveModal(undefined));
|
|
361
|
+
}, [ensurePrivateRoom, t]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
362
|
+
|
|
363
|
+
// Calls from the profile, as on web: open the 1:1 room, then dial it the
|
|
364
|
+
// same way the chat header does.
|
|
365
|
+
const videoCallsConfig = config?.videoCalls;
|
|
366
|
+
const canCall =
|
|
367
|
+
videoCallsConfig?.enabled === true &&
|
|
368
|
+
Boolean(videoCallsConfig?.livekitUrl?.trim()) &&
|
|
369
|
+
(videoCallsConfig?.allowedRoomTypes || ['private']).includes('private');
|
|
370
|
+
const isAudioCallsEnabled = canCall && videoCallsConfig?.enableAudioCalls === true;
|
|
371
|
+
const isCallBusy = useSelector((state: RootState) => state.call.phase !== 'idle');
|
|
372
|
+
|
|
373
|
+
const handleCall = useCallback(async (kind: 'audio' | 'video') => {
|
|
374
|
+
if (isCallBusy) {return;}
|
|
375
|
+
let room: Awaited<ReturnType<typeof ensurePrivateRoom>> = null;
|
|
376
|
+
try {
|
|
377
|
+
room = await ensurePrivateRoom();
|
|
378
|
+
} catch (error) {
|
|
379
|
+
console.warn('Could not open the private chat for a call:', error);
|
|
380
|
+
}
|
|
381
|
+
if (!room) {return;}
|
|
382
|
+
|
|
383
|
+
dispatch(
|
|
384
|
+
startOutgoingCall({
|
|
385
|
+
roomJid: room.jid,
|
|
386
|
+
roomName: room.peerDisplay || room.bareName,
|
|
387
|
+
roomBareName: room.bareName,
|
|
388
|
+
kind,
|
|
389
|
+
peerXmppUsername: room.peerXmppUsername,
|
|
390
|
+
})
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
// The server drops `kind` on the relayed call-token, so signal the peer
|
|
394
|
+
// directly first, as CallButtons does.
|
|
395
|
+
if (room.peerXmppUsername) {
|
|
396
|
+
sendCallInviteSignal(kind, {
|
|
397
|
+
peerXmppUsername: room.peerXmppUsername,
|
|
398
|
+
roomBareName: room.bareName,
|
|
399
|
+
});
|
|
300
400
|
}
|
|
301
401
|
|
|
402
|
+
// Close the profile so the call screen isn't behind it.
|
|
302
403
|
dispatch(setActiveModal(undefined));
|
|
303
|
-
|
|
404
|
+
|
|
405
|
+
try {
|
|
406
|
+
await createChatCall(room.bareName, { kind });
|
|
407
|
+
} catch (error) {
|
|
408
|
+
dispatch(
|
|
409
|
+
setCallError(
|
|
410
|
+
error instanceof Error ? error.message : t('call.error.connectFailed')
|
|
411
|
+
)
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
}, [ensurePrivateRoom, isCallBusy, t]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
304
415
|
|
|
305
416
|
const handlePrivateMessage = useCallback(
|
|
306
417
|
() => openPrivateRoom(false),
|
|
@@ -374,6 +485,26 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
|
374
485
|
]
|
|
375
486
|
: []),
|
|
376
487
|
]),
|
|
488
|
+
...(canCall && !isCallBusy
|
|
489
|
+
? [
|
|
490
|
+
{
|
|
491
|
+
key: 'video-call',
|
|
492
|
+
label: isAudioCallsEnabled ? t('action.videoCall') : t('action.call'),
|
|
493
|
+
icon: (color: string) => <VideoCallIcon color={color} />,
|
|
494
|
+
onPress: () => void handleCall('video'),
|
|
495
|
+
},
|
|
496
|
+
...(isAudioCallsEnabled
|
|
497
|
+
? [
|
|
498
|
+
{
|
|
499
|
+
key: 'audio-call',
|
|
500
|
+
label: t('action.audioCall'),
|
|
501
|
+
icon: (color: string) => <AudioCallIcon color={color} />,
|
|
502
|
+
onPress: () => void handleCall('audio'),
|
|
503
|
+
},
|
|
504
|
+
]
|
|
505
|
+
: []),
|
|
506
|
+
]
|
|
507
|
+
: []),
|
|
377
508
|
{
|
|
378
509
|
key: 'share',
|
|
379
510
|
label: t('action.share'),
|
|
@@ -381,7 +512,7 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
|
381
512
|
onPress: handleShare,
|
|
382
513
|
},
|
|
383
514
|
],
|
|
384
|
-
[isOwnProfile, t, handleShare, handlePrivateMessage, handleEncryptedPrivateMessage, canStartEncrypted, handleLogout] // eslint-disable-line react-hooks/exhaustive-deps
|
|
515
|
+
[isOwnProfile, t, handleShare, handlePrivateMessage, handleEncryptedPrivateMessage, canStartEncrypted, handleLogout, canCall, isCallBusy, isAudioCallsEnabled, handleCall] // eslint-disable-line react-hooks/exhaustive-deps
|
|
385
516
|
);
|
|
386
517
|
|
|
387
518
|
// Collapsed, the hero's round buttons are gone — the "…" menu carries
|
|
@@ -22,6 +22,7 @@ import { useTheme } from '../../hooks/useTheme';
|
|
|
22
22
|
import { resolveTheme } from '../../theme/theme';
|
|
23
23
|
import { BellOffIcon, LockIcon } from '../../assets/icons';
|
|
24
24
|
import { useT } from '../../i18n/useT';
|
|
25
|
+
import { formatCallLogLabel } from '../../helpers/callLogMessage';
|
|
25
26
|
import { composeName } from '../../helpers/displayName';
|
|
26
27
|
import { isUnresolvedSenderId } from '../../helpers/isUnresolvedSenderId';
|
|
27
28
|
|
|
@@ -75,13 +76,19 @@ const ChatRoomItem: React.FC<ChatRoomItemProps> = ({
|
|
|
75
76
|
|
|
76
77
|
return {
|
|
77
78
|
...message,
|
|
79
|
+
// A call-log entry's body is English frozen at receive time; rebuild
|
|
80
|
+
// it from the callLog meta so the preview follows the current
|
|
81
|
+
// language like the transcript does (mirrors web's ChatRoomItem).
|
|
82
|
+
body: message.callLog
|
|
83
|
+
? formatCallLogLabel(message.callLog, t, message.body)
|
|
84
|
+
: message.body,
|
|
78
85
|
user: {
|
|
79
86
|
...message.user,
|
|
80
87
|
name: safeName,
|
|
81
88
|
},
|
|
82
89
|
};
|
|
83
90
|
},
|
|
84
|
-
[usersSet]
|
|
91
|
+
[usersSet, t]
|
|
85
92
|
);
|
|
86
93
|
|
|
87
94
|
const lastMessage = useMemo(() => {
|