@ethora/chat-component-rn 26.7.5 → 26.7.6

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.
Files changed (308) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +31 -8
  3. package/lib/commonjs/assets/icons.js +7 -2
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/Header/HeaderRoomList.js +26 -7
  6. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/ChatHeader.js +5 -2
  8. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/ChatRoom.js +36 -14
  10. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/MessageList.js +7 -23
  12. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  14. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  15. package/lib/commonjs/components/MainComponents/RoomList.js +208 -35
  16. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  17. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +317 -98
  18. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  19. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +320 -110
  20. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  21. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +552 -213
  22. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  23. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +226 -0
  24. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  25. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
  26. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  27. package/lib/commonjs/components/Modals/Modal/Modal.js +8 -0
  28. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  29. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +2 -1
  30. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  31. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +202 -104
  32. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  33. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  34. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  35. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +556 -0
  36. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  37. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +210 -0
  38. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  39. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  40. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  41. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +7 -21
  42. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  43. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +507 -244
  44. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  45. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +74 -46
  46. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  47. package/lib/commonjs/components/Modals/styledModalComponents.js +9 -2
  48. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  49. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +17 -7
  50. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  51. package/lib/commonjs/components/styled/SendInput.js +80 -11
  52. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  53. package/lib/commonjs/components/styled/StyledComponents.js +9 -3
  54. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  55. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  56. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  57. package/lib/commonjs/context/xmppProvider.js +23 -38
  58. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  59. package/lib/commonjs/helpers/getChatBackground.js +23 -0
  60. package/lib/commonjs/helpers/getChatBackground.js.map +1 -0
  61. package/lib/commonjs/helpers/mediaLibraryRuntime.js +31 -0
  62. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +1 -0
  63. package/lib/commonjs/helpers/pickImageAsset.js +68 -0
  64. package/lib/commonjs/helpers/pickImageAsset.js.map +1 -0
  65. package/lib/commonjs/helpers/sheetGestures.js +32 -0
  66. package/lib/commonjs/helpers/sheetGestures.js.map +1 -0
  67. package/lib/commonjs/helpers/updateMessagesTillLast.js +12 -40
  68. package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
  69. package/lib/commonjs/hooks/useChatRoomFocus.js +3 -9
  70. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  71. package/lib/commonjs/hooks/useLogout.js +0 -5
  72. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  73. package/lib/commonjs/hooks/useSendMessage.js +23 -50
  74. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  75. package/lib/commonjs/i18n/strings.js +121 -1
  76. package/lib/commonjs/i18n/strings.js.map +1 -1
  77. package/lib/commonjs/main.js +6 -0
  78. package/lib/commonjs/main.js.map +1 -1
  79. package/lib/commonjs/networking/api-requests/user.api.js +59 -0
  80. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  81. package/lib/commonjs/networking/authRefresh.js +12 -2
  82. package/lib/commonjs/networking/authRefresh.js.map +1 -1
  83. package/lib/commonjs/networking/outboundQueue.js +0 -18
  84. package/lib/commonjs/networking/outboundQueue.js.map +1 -1
  85. package/lib/commonjs/networking/stanzaHandlers.js +1 -10
  86. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  87. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  88. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  89. package/lib/commonjs/networking/xmppClient.js +7 -107
  90. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  91. package/lib/commonjs/roomStore/chatSettingsSlice.js +3 -1
  92. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  93. package/lib/commonjs/roomStore/roomsSlice.js +3 -22
  94. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  95. package/lib/module/assets/icons.js +6 -1
  96. package/lib/module/assets/icons.js.map +1 -1
  97. package/lib/module/components/Header/HeaderRoomList.js +26 -7
  98. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  99. package/lib/module/components/MainComponents/ChatHeader.js +5 -2
  100. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  101. package/lib/module/components/MainComponents/ChatRoom.js +36 -14
  102. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  103. package/lib/module/components/MainComponents/MessageList.js +8 -24
  104. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  105. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  106. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  107. package/lib/module/components/MainComponents/RoomList.js +207 -35
  108. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  109. package/lib/module/components/Menu/HeaderRoomListMenu.js +319 -101
  110. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  111. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +311 -113
  112. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  113. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +555 -217
  114. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  115. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +223 -0
  116. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  117. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
  118. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  119. package/lib/module/components/Modals/Modal/Modal.js +9 -1
  120. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  121. package/lib/module/components/Modals/NewChatModal/ModalContent.js +2 -1
  122. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  123. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +205 -106
  124. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  125. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  126. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  127. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +548 -0
  128. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  129. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +205 -0
  130. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  131. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  132. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  133. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +9 -23
  134. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  135. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +509 -248
  136. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  137. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +76 -48
  138. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  139. package/lib/module/components/Modals/styledModalComponents.js +9 -2
  140. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  141. package/lib/module/components/RoomComponents/ChatRoomItem.js +17 -7
  142. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  143. package/lib/module/components/styled/SendInput.js +81 -12
  144. package/lib/module/components/styled/SendInput.js.map +1 -1
  145. package/lib/module/components/styled/StyledComponents.js +9 -3
  146. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  147. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  148. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  149. package/lib/module/context/xmppProvider.js +23 -38
  150. package/lib/module/context/xmppProvider.js.map +1 -1
  151. package/lib/module/helpers/getChatBackground.js +18 -0
  152. package/lib/module/helpers/getChatBackground.js.map +1 -0
  153. package/lib/module/helpers/mediaLibraryRuntime.js +25 -0
  154. package/lib/module/helpers/mediaLibraryRuntime.js.map +1 -0
  155. package/lib/module/helpers/pickImageAsset.js +63 -0
  156. package/lib/module/helpers/pickImageAsset.js.map +1 -0
  157. package/lib/module/helpers/sheetGestures.js +26 -0
  158. package/lib/module/helpers/sheetGestures.js.map +1 -0
  159. package/lib/module/helpers/updateMessagesTillLast.js +13 -41
  160. package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
  161. package/lib/module/hooks/useChatRoomFocus.js +3 -9
  162. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  163. package/lib/module/hooks/useLogout.js +0 -5
  164. package/lib/module/hooks/useLogout.js.map +1 -1
  165. package/lib/module/hooks/useSendMessage.js +24 -51
  166. package/lib/module/hooks/useSendMessage.js.map +1 -1
  167. package/lib/module/i18n/strings.js +121 -1
  168. package/lib/module/i18n/strings.js.map +1 -1
  169. package/lib/module/main.js +1 -1
  170. package/lib/module/main.js.map +1 -1
  171. package/lib/module/networking/api-requests/user.api.js +56 -0
  172. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  173. package/lib/module/networking/authRefresh.js +12 -2
  174. package/lib/module/networking/authRefresh.js.map +1 -1
  175. package/lib/module/networking/outboundQueue.js +0 -17
  176. package/lib/module/networking/outboundQueue.js.map +1 -1
  177. package/lib/module/networking/stanzaHandlers.js +1 -10
  178. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  179. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  180. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  181. package/lib/module/networking/xmppClient.js +7 -107
  182. package/lib/module/networking/xmppClient.js.map +1 -1
  183. package/lib/module/roomStore/chatSettingsSlice.js +3 -1
  184. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  185. package/lib/module/roomStore/roomsSlice.js +2 -20
  186. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  187. package/lib/typescript/assets/icons.d.ts +16 -0
  188. package/lib/typescript/assets/icons.d.ts.map +1 -1
  189. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  190. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  191. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  192. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  193. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  194. package/lib/typescript/components/MainComponents/RoomList.d.ts +7 -0
  195. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  196. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +3 -0
  197. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  198. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +9 -0
  199. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  200. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +10 -0
  201. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  202. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +9 -0
  203. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -0
  204. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  205. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  206. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +4 -2
  207. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  208. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  209. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  210. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  211. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +75 -0
  212. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +1 -0
  213. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +25 -0
  214. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +1 -0
  215. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +6 -1
  216. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  217. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  218. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +16 -0
  219. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  220. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +1 -0
  221. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  222. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  223. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  224. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  225. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  226. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  227. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  228. package/lib/typescript/helpers/getChatBackground.d.ts +15 -0
  229. package/lib/typescript/helpers/getChatBackground.d.ts.map +1 -0
  230. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +3 -0
  231. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +1 -0
  232. package/lib/typescript/helpers/pickImageAsset.d.ts +27 -0
  233. package/lib/typescript/helpers/pickImageAsset.d.ts.map +1 -0
  234. package/lib/typescript/helpers/sheetGestures.d.ts +20 -0
  235. package/lib/typescript/helpers/sheetGestures.d.ts.map +1 -0
  236. package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
  237. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  238. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  239. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  240. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  241. package/lib/typescript/main.d.ts +1 -1
  242. package/lib/typescript/main.d.ts.map +1 -1
  243. package/lib/typescript/networking/api-requests/user.api.d.ts +27 -0
  244. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  245. package/lib/typescript/networking/authRefresh.d.ts +4 -1
  246. package/lib/typescript/networking/authRefresh.d.ts.map +1 -1
  247. package/lib/typescript/networking/outboundQueue.d.ts +0 -16
  248. package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
  249. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  250. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
  251. package/lib/typescript/networking/xmppClient.d.ts +1 -33
  252. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  253. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  254. package/lib/typescript/roomStore/roomsSlice.d.ts +1 -18
  255. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  256. package/lib/typescript/types/models/room.model.d.ts +0 -15
  257. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  258. package/lib/typescript/types/types.d.ts +30 -20
  259. package/lib/typescript/types/types.d.ts.map +1 -1
  260. package/package.json +6 -1
  261. package/src/assets/icons.tsx +48 -9
  262. package/src/components/Header/HeaderRoomList.tsx +24 -6
  263. package/src/components/MainComponents/ChatHeader.tsx +5 -2
  264. package/src/components/MainComponents/ChatRoom.tsx +38 -20
  265. package/src/components/MainComponents/MessageList.tsx +8 -24
  266. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +21 -14
  267. package/src/components/MainComponents/RoomList.tsx +236 -39
  268. package/src/components/Menu/HeaderRoomListMenu.tsx +328 -75
  269. package/src/components/Modals/AttachSheet/AttachSheet.tsx +331 -97
  270. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +598 -279
  271. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +244 -0
  272. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +4 -2
  273. package/src/components/Modals/Modal/Modal.tsx +7 -0
  274. package/src/components/Modals/NewChatModal/ModalContent.tsx +6 -3
  275. package/src/components/Modals/NewChatModal/NewChatModal.tsx +219 -117
  276. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +12 -1
  277. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +615 -0
  278. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +217 -0
  279. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +14 -4
  280. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +9 -25
  281. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +617 -307
  282. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +75 -58
  283. package/src/components/Modals/styledModalComponents.tsx +9 -2
  284. package/src/components/RoomComponents/ChatRoomItem.tsx +14 -7
  285. package/src/components/styled/SendInput.tsx +83 -12
  286. package/src/components/styled/StyledComponents.ts +9 -3
  287. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +11 -4
  288. package/src/context/xmppProvider.tsx +27 -46
  289. package/src/helpers/getChatBackground.ts +18 -0
  290. package/src/helpers/mediaLibraryRuntime.ts +25 -0
  291. package/src/helpers/pickImageAsset.ts +68 -0
  292. package/src/helpers/sheetGestures.ts +25 -0
  293. package/src/helpers/updateMessagesTillLast.tsx +17 -42
  294. package/src/hooks/useChatRoomFocus.ts +3 -11
  295. package/src/hooks/useLogout.tsx +0 -7
  296. package/src/hooks/useSendMessage.tsx +24 -60
  297. package/src/i18n/strings.ts +121 -1
  298. package/src/main.ts +1 -1
  299. package/src/networking/api-requests/user.api.ts +71 -0
  300. package/src/networking/authRefresh.ts +25 -4
  301. package/src/networking/outboundQueue.ts +0 -29
  302. package/src/networking/stanzaHandlers.ts +1 -9
  303. package/src/networking/xmpp/presenceInRoom.xmpp.ts +6 -1
  304. package/src/networking/xmppClient.ts +7 -118
  305. package/src/roomStore/chatSettingsSlice.ts +3 -1
  306. package/src/roomStore/roomsSlice.ts +2 -20
  307. package/src/types/models/room.model.ts +0 -15
  308. package/src/types/types.ts +32 -20
@@ -1,19 +1,99 @@
1
- import React, { FC, useMemo } from 'react';
1
+ import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import {
3
+ Alert,
3
4
  Animated,
4
5
  Text,
5
6
  TouchableOpacity,
6
7
  TouchableWithoutFeedback,
7
8
  StyleSheet,
8
9
  Dimensions,
10
+ Modal,
11
+ PanResponder,
12
+ Platform,
9
13
  View,
10
14
  } from 'react-native';
11
- import { AddNewIcon, ProfileIcon, SettingIcon } from '../../assets/icons';
15
+ import {
16
+ AddNewIcon,
17
+ LogoutIcon,
18
+ ProfileIcon,
19
+ SettingIcon,
20
+ } from '../../assets/icons';
12
21
  import { useDispatch } from 'react-redux';
22
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
13
23
  import { setActiveModal } from '../../roomStore/chatSettingsSlice';
14
24
  import { MODAL_TYPES } from '../../helpers/constants/MODAL_TYPES';
25
+ import { useChatSettingState } from '../../hooks/useChatSettingState';
26
+ import { useLogout } from '../../hooks/useLogout';
27
+ import {
28
+ shouldClaimVerticalDrag,
29
+ shouldDismissOnDrag,
30
+ } from '../../helpers/sheetGestures';
31
+ import type { IConfig } from '../../types/types';
32
+
33
+ type LogoutConfig = NonNullable<IConfig['logout']>;
34
+
35
+ const DEFAULT_LOGOUT_LABEL = 'Sign out';
36
+
37
+ const confirmLogout = (
38
+ confirm: LogoutConfig['confirm'],
39
+ label: string
40
+ ): Promise<boolean> => {
41
+ if (confirm === false) {
42
+ return Promise.resolve(true);
43
+ }
44
+ const copy = typeof confirm === 'object' && confirm ? confirm : {};
45
+ return new Promise<boolean>((resolve) => {
46
+ Alert.alert(
47
+ copy.title ?? label,
48
+ copy.message ?? 'Are you sure you want to sign out?',
49
+ [
50
+ {
51
+ text: copy.cancelText ?? 'Cancel',
52
+ style: 'cancel',
53
+ onPress: () => resolve(false),
54
+ },
55
+ {
56
+ text: copy.confirmText ?? label,
57
+ style: 'destructive',
58
+ onPress: () => resolve(true),
59
+ },
60
+ ],
61
+ { cancelable: true, onDismiss: () => resolve(false) }
62
+ );
63
+ });
64
+ };
15
65
 
16
- const { width } = Dimensions.get('window');
66
+ export const runLogoutFlow = async (
67
+ logoutConfig: LogoutConfig,
68
+ performLogout: () => Promise<void>
69
+ ): Promise<void> => {
70
+ const label = logoutConfig.label ?? DEFAULT_LOGOUT_LABEL;
71
+ const confirmed = await confirmLogout(logoutConfig.confirm ?? true, label);
72
+ if (!confirmed) {
73
+ return;
74
+ }
75
+ if (logoutConfig.onBeforeLogout) {
76
+ try {
77
+ const proceed = await logoutConfig.onBeforeLogout();
78
+ if (proceed === false) {
79
+ return;
80
+ }
81
+ } catch (e) {
82
+ console.warn('HeaderRoomListMenu: onBeforeLogout threw, logout cancelled', e);
83
+ return;
84
+ }
85
+ }
86
+ await performLogout(); // never rejects (see useLogout)
87
+ if (logoutConfig.onAfterLogout) {
88
+ try {
89
+ await logoutConfig.onAfterLogout();
90
+ } catch (e) {
91
+ console.warn('HeaderRoomListMenu: onAfterLogout threw', e);
92
+ }
93
+ }
94
+ };
95
+
96
+ const { height: windowHeight } = Dimensions.get('window');
17
97
 
18
98
  interface HeaderRoomListMenuProps {
19
99
  isDrawerOpen: boolean;
@@ -29,86 +109,245 @@ export const HeaderRoomListMenu: FC<HeaderRoomListMenuProps> = ({
29
109
  closeDrawer,
30
110
  }) => {
31
111
  const dispatch = useDispatch();
112
+ const { config } = useChatSettingState();
113
+ const performLogout = useLogout();
114
+ const logoutConfig = config?.logout?.enabled ? config.logout : undefined;
115
+ const primaryColor = config?.colors?.primary ?? '#0052CD';
116
+
117
+ const insets = useSafeAreaInsets();
118
+ // Measured, so the sheet is exactly as tall as its rows and starts
119
+ // fully off-screen no matter how many options the host enables.
120
+ const [sheetHeight, setSheetHeight] = useState(windowHeight * 0.4);
121
+ // Finger offset, layered on top of the open/close animation the parent
122
+ // drives. Reset once the sheet is unmounted, so a swipe-dismissed sheet
123
+ // never snaps back into view on its way out.
124
+ const dragY = useRef(new Animated.Value(0)).current;
125
+ const sheetHeightRef = useRef(sheetHeight);
126
+ sheetHeightRef.current = sheetHeight;
127
+
128
+ // closeDrawer is a fresh function each render; the responder is built
129
+ // once, so it reads the current one through a ref rather than the one it
130
+ // closed over on mount.
131
+ const closeDrawerRef = useRef(closeDrawer);
132
+ closeDrawerRef.current = closeDrawer;
133
+
134
+ const pendingActionRef = useRef<(() => void) | null>(null);
135
+
136
+ const runPendingAction = useCallback(() => {
137
+ const action = pendingActionRef.current;
138
+ pendingActionRef.current = null;
139
+ action?.();
140
+ }, []);
141
+
142
+ useEffect(() => {
143
+ if (Platform.OS === 'ios' || isDrawerOpen) {
144
+ return;
145
+ }
146
+ const id = setTimeout(runPendingAction, 0);
147
+ return () => clearTimeout(id);
148
+ }, [isDrawerOpen, runPendingAction]);
149
+
150
+ const handleOptionPress = useCallback(
151
+ (action: () => void) => {
152
+ pendingActionRef.current = action;
153
+ closeDrawer();
154
+ },
155
+ [closeDrawer]
156
+ );
32
157
 
33
- const drawerTranslateX = drawerAnimation.interpolate({
158
+ useEffect(() => {
159
+ if (!isDrawerOpen) {
160
+ dragY.setValue(0);
161
+ return;
162
+ }
163
+ // Hand `dragY` to the native driver up front. The open/close value is
164
+ // already native (the parent animates it that way), and a transform
165
+ // that mixes a native node with a JS-only one drops the JS updates on
166
+ // the floor — which is exactly a drag that moves nothing.
167
+ Animated.timing(dragY, {
168
+ toValue: 0,
169
+ duration: 0,
170
+ useNativeDriver: true,
171
+ }).start();
172
+ }, [isDrawerOpen, dragY]);
173
+
174
+ const openTranslateY = drawerAnimation.interpolate({
34
175
  inputRange: [0, 1],
35
- outputRange: [width, 0],
176
+ outputRange: [sheetHeight, 0],
36
177
  });
37
178
 
38
- const menuOptions = useMemo(
39
- () => [
179
+ const dismissByDrag = () => {
180
+ Animated.timing(dragY, {
181
+ toValue: sheetHeightRef.current,
182
+ duration: 180,
183
+ useNativeDriver: true,
184
+ }).start();
185
+ closeDrawerRef.current();
186
+ };
187
+
188
+ const makeDragResponder = (claimOnStart: boolean) =>
189
+ PanResponder.create({
190
+ // The grab area claims on touch-DOWN: nothing to negotiate against,
191
+ // so a pull on the handle always drags.
192
+ onStartShouldSetPanResponder: () => claimOnStart,
193
+ // CAPTURE matters on the body: a drag that starts on a row makes
194
+ // that row's Touchable the responder on touch-down, and a plain
195
+ // `onMoveShouldSetPanResponder` is never consulted afterwards.
196
+ // Capturing on the first clearly-vertical movement takes the gesture
197
+ // back, while a tap (dy ≈ 0) still reaches the row.
198
+ onMoveShouldSetPanResponderCapture: (_evt, g) =>
199
+ claimOnStart || shouldClaimVerticalDrag(g.dy, g.dx),
200
+ onMoveShouldSetPanResponder: (_evt, g) =>
201
+ claimOnStart || shouldClaimVerticalDrag(g.dy, g.dx),
202
+ onPanResponderTerminationRequest: () => false,
203
+ onPanResponderMove: (_evt, g) => {
204
+ dragY.setValue(Math.max(0, g.dy));
205
+ },
206
+ onPanResponderRelease: (_evt, g) => {
207
+ if (shouldDismissOnDrag(g.dy, g.vy)) {
208
+ dismissByDrag();
209
+ return;
210
+ }
211
+ Animated.spring(dragY, {
212
+ toValue: 0,
213
+ tension: 90,
214
+ friction: 14,
215
+ useNativeDriver: true,
216
+ }).start();
217
+ },
218
+ onPanResponderTerminate: () => {
219
+ Animated.spring(dragY, {
220
+ toValue: 0,
221
+ tension: 90,
222
+ friction: 14,
223
+ useNativeDriver: true,
224
+ }).start();
225
+ },
226
+ });
227
+
228
+ // Built once — `useRef(expr)` would re-run PanResponder.create every
229
+ // render and throw the result away.
230
+ const bodyPanRef = useRef<ReturnType<typeof makeDragResponder> | null>(null);
231
+ const handlePanRef = useRef<ReturnType<typeof makeDragResponder> | null>(null);
232
+ if (!bodyPanRef.current) {bodyPanRef.current = makeDragResponder(false);}
233
+ if (!handlePanRef.current) {handlePanRef.current = makeDragResponder(true);}
234
+ const pan = bodyPanRef.current;
235
+ const handlePan = handlePanRef.current;
236
+
237
+ const menuOptions = useMemo(() => {
238
+ const options: {
239
+ label: string;
240
+ icon: React.ReactElement;
241
+ onClick: () => void;
242
+ styles?: { color: string };
243
+ }[] = [
40
244
  {
41
245
  label: 'New Chat',
42
- icon: <AddNewIcon color="#8C8C8C" />,
246
+ icon: <AddNewIcon color={primaryColor} />,
43
247
  onClick: () => {
44
248
  dispatch(setActiveModal(MODAL_TYPES.NEW_CHAT));
45
- console.log('New chat clicked');
46
249
  },
47
250
  styles: { color: '#141414' },
48
251
  },
49
252
  {
50
253
  label: 'Profile',
51
- icon: <ProfileIcon color="#8C8C8C" />,
254
+ icon: <ProfileIcon color={primaryColor} />,
52
255
  onClick: () => {
53
256
  dispatch(setActiveModal(MODAL_TYPES.PROFILE));
54
- console.log('Profile clicked');
55
257
  },
56
258
  },
57
259
  {
58
260
  label: 'Settings',
59
- icon: <SettingIcon color="#8C8C8C" />,
261
+ icon: <SettingIcon color={primaryColor} />,
60
262
  onClick: () => {
61
263
  dispatch(setActiveModal(MODAL_TYPES.SETTINGS));
62
- console.log('Settings clicked');
63
264
  },
64
265
  },
65
- // {
66
- // label: "Logout",
67
- // onClick: handleLogout,
68
- // },
69
- ],
70
- []
71
- );
266
+ ];
267
+ if (logoutConfig) {
268
+ options.push({
269
+ label: logoutConfig.label ?? DEFAULT_LOGOUT_LABEL,
270
+ icon: <LogoutIcon color={primaryColor} />,
271
+ styles: { color: primaryColor },
272
+ onClick: () => {
273
+ runLogoutFlow(logoutConfig, performLogout).catch(() => {});
274
+ },
275
+ });
276
+ }
277
+ return options;
278
+ }, [dispatch, logoutConfig, performLogout, primaryColor]);
72
279
 
73
280
  return (
74
- <>
281
+ // Presented through a real <Modal>: as an in-tree overlay the sheet was
282
+ // bounded by the room list's own container, so it stopped short of the
283
+ // screen's bottom edge (that pale strip under it) and the dim never
284
+ // reached the host's chrome.
285
+ <Modal
286
+ transparent
287
+ visible={isDrawerOpen}
288
+ animationType="none"
289
+ statusBarTranslucent
290
+ onRequestClose={closeDrawer}
291
+ onDismiss={runPendingAction}
292
+ >
293
+ <TouchableWithoutFeedback onPress={closeDrawer}>
294
+ <Animated.View
295
+ style={[styles.overlay, { opacity: overlayAnimation }]}
296
+ />
297
+ </TouchableWithoutFeedback>
298
+ {/* A bottom sheet rather than the old full-height right-hand drawer:
299
+ * three rows never needed the whole screen, and coming up from the
300
+ * bottom keeps them within thumb reach. Inset by 2pt all round so a
301
+ * sliver of the dimmed screen shows around it. */}
75
302
  <Animated.View
303
+ testID="header-menu-sheet"
304
+ onLayout={(e) => {
305
+ const measured = e.nativeEvent.layout.height;
306
+ if (measured > 0) {setSheetHeight(measured);}
307
+ }}
76
308
  style={[
77
- styles.drawer,
78
- { transform: [{ translateX: drawerTranslateX }] },
309
+ styles.sheet,
310
+ {
311
+ paddingBottom: insets.bottom + 20,
312
+ // Two entries rather than Animated.add: the parent's value is
313
+ // driven natively, and stacking the transforms keeps each node
314
+ // on its own driver instead of mixing them in one expression.
315
+ transform: [{ translateY: openTranslateY }, { translateY: dragY }],
316
+ },
79
317
  ]}
318
+ {...pan.panHandlers}
80
319
  >
81
- {menuOptions.map((option, index) => (
82
- <View key={index} style={styles.menuItemWrapper}>
83
- <TouchableOpacity
84
- style={styles.menuItem}
85
- onPress={() => {
86
- option.onClick();
87
- closeDrawer();
88
- }}
89
- >
90
- <View
91
- style={{
92
- width: 22,
93
- alignItems: 'center',
94
- }}
320
+ {/* Full-width grab area, not just the 40pt pill: it claims the
321
+ * gesture the moment it is touched. */}
322
+ <View
323
+ testID="header-menu-grabber"
324
+ style={styles.grabArea}
325
+ {...handlePan.panHandlers}
326
+ >
327
+ <View style={styles.grabber} />
328
+ </View>
329
+ <View style={styles.card}>
330
+ {menuOptions.map((option, index) => (
331
+ <View key={index} style={styles.menuItemWrapper}>
332
+ <TouchableOpacity
333
+ style={styles.menuItem}
334
+ testID={`header-menu-${option.label}`}
335
+ activeOpacity={0.6}
336
+ onPress={() => handleOptionPress(option.onClick)}
95
337
  >
96
- {option.icon}
97
- </View>
98
- <Text style={[styles.label, option?.styles]}>{option.label}</Text>
99
- </TouchableOpacity>
100
- {index < menuOptions.length - 1 && <View style={styles.divider} />}
101
- </View>
102
- ))}
338
+ <View style={styles.iconSlot}>{option.icon}</View>
339
+ <Text style={[styles.label, option?.styles]}>
340
+ {option.label}
341
+ </Text>
342
+ </TouchableOpacity>
343
+ {index < menuOptions.length - 1 && (
344
+ <View style={styles.divider} />
345
+ )}
346
+ </View>
347
+ ))}
348
+ </View>
103
349
  </Animated.View>
104
- {isDrawerOpen && (
105
- <TouchableWithoutFeedback onPress={closeDrawer}>
106
- <Animated.View
107
- style={[styles.overlay, { opacity: overlayAnimation }]}
108
- />
109
- </TouchableWithoutFeedback>
110
- )}
111
- </>
350
+ </Modal>
112
351
  );
113
352
  };
114
353
 
@@ -120,40 +359,54 @@ const styles = StyleSheet.create({
120
359
  menuItem: {
121
360
  flexDirection: 'row',
122
361
  alignItems: 'center',
123
- padding: 16,
362
+ paddingVertical: 18,
363
+ paddingHorizontal: 16,
364
+ },
365
+ iconSlot: {
366
+ width: 26,
367
+ alignItems: 'center',
124
368
  },
125
369
  label: {
126
370
  fontSize: 16,
127
- marginLeft: 10,
371
+ fontWeight: '500',
372
+ color: '#141414',
373
+ marginLeft: 12,
128
374
  },
129
375
  divider: {
130
- height: 1,
131
- width: '100%',
132
- backgroundColor: '#0052cd0d',
376
+ height: StyleSheet.hairlineWidth,
377
+ marginLeft: 54,
378
+ backgroundColor: '#E4E4E9',
133
379
  },
134
- drawer: {
380
+ sheet: {
135
381
  position: 'absolute',
136
- top: 0,
137
- bottom: 0,
138
- right: 0,
139
- width: width * 0.7,
140
- backgroundColor: '#fff',
141
- padding: 20,
382
+ // Inset rather than flush: the dimmed screen stays visible as a thin
383
+ // line around the sheet.
384
+ left: 3,
385
+ right: 3,
386
+ bottom: 3,
387
+ paddingTop: 8,
388
+ backgroundColor: '#FFFFFF',
389
+ borderRadius: 20,
142
390
  shadowColor: '#000',
143
- shadowOpacity: 0.3,
144
- shadowOffset: { width: -2, height: 0 },
145
- shadowRadius: 5,
146
- elevation: 5,
391
+ shadowOpacity: 0.12,
392
+ shadowOffset: { width: 0, height: -3 },
393
+ shadowRadius: 12,
394
+ elevation: 12,
147
395
  zIndex: 999,
148
396
  },
149
- drawerTitle: {
150
- fontSize: 20,
151
- fontWeight: 'bold',
152
- marginBottom: 20,
397
+ grabArea: {
398
+ alignItems: 'center',
399
+ paddingTop: 6,
400
+ paddingBottom: 12,
401
+ },
402
+ grabber: {
403
+ width: 40,
404
+ height: 4,
405
+ borderRadius: 2,
406
+ backgroundColor: '#C9CBD1',
153
407
  },
154
- drawerItem: {
155
- fontSize: 18,
156
- marginBottom: 10,
408
+ card: {
409
+ overflow: 'hidden',
157
410
  },
158
411
  overlay: {
159
412
  position: 'absolute',