@sendbird/uikit-react-native 3.1.2 → 3.3.0

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 (337) hide show
  1. package/README.md +67 -42
  2. package/lib/commonjs/components/ChannelInput/EditInput.js +2 -11
  3. package/lib/commonjs/components/ChannelInput/EditInput.js.map +1 -1
  4. package/lib/commonjs/components/ChannelInput/MessageToReplyPreview.js +145 -0
  5. package/lib/commonjs/components/ChannelInput/MessageToReplyPreview.js.map +1 -0
  6. package/lib/commonjs/components/ChannelInput/SendInput.js +149 -323
  7. package/lib/commonjs/components/ChannelInput/SendInput.js.map +1 -1
  8. package/lib/commonjs/components/ChannelInput/VoiceMessageInput.js +238 -0
  9. package/lib/commonjs/components/ChannelInput/VoiceMessageInput.js.map +1 -0
  10. package/lib/commonjs/components/ChannelInput/index.js +34 -3
  11. package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
  12. package/lib/commonjs/components/ChannelMessageList/index.js +148 -116
  13. package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
  14. package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +24 -13
  15. package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -1
  16. package/lib/commonjs/components/GroupChannelMessageRenderer/index.js +134 -6
  17. package/lib/commonjs/components/GroupChannelMessageRenderer/index.js.map +1 -1
  18. package/lib/commonjs/components/MessageSearchResultItem.js +1 -0
  19. package/lib/commonjs/components/MessageSearchResultItem.js.map +1 -1
  20. package/lib/commonjs/components/OpenChannelMessageRenderer/index.js +1 -0
  21. package/lib/commonjs/components/OpenChannelMessageRenderer/index.js.map +1 -1
  22. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +2 -2
  23. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
  24. package/lib/commonjs/components/ReactionBottomSheets/index.js.map +1 -1
  25. package/lib/commonjs/components/StatusComposition.js.map +1 -1
  26. package/lib/commonjs/constants.js +5 -1
  27. package/lib/commonjs/constants.js.map +1 -1
  28. package/lib/commonjs/containers/GroupChannelPreviewContainer.js +1 -0
  29. package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
  30. package/lib/commonjs/containers/InternalErrorBoundaryContainer.js.map +1 -1
  31. package/lib/commonjs/containers/SendbirdUIKitContainer.js +72 -34
  32. package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
  33. package/lib/commonjs/contexts/PlatformServiceCtx.js +16 -12
  34. package/lib/commonjs/contexts/PlatformServiceCtx.js.map +1 -1
  35. package/lib/commonjs/contexts/ReactionCtx.js +3 -2
  36. package/lib/commonjs/contexts/ReactionCtx.js.map +1 -1
  37. package/lib/commonjs/contexts/SendbirdChatCtx.js +2 -0
  38. package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
  39. package/lib/commonjs/domain/groupChannel/component/GroupChannelHeader.js +14 -4
  40. package/lib/commonjs/domain/groupChannel/component/GroupChannelHeader.js.map +1 -1
  41. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +28 -42
  42. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  43. package/lib/commonjs/domain/groupChannel/module/moduleContext.js +109 -5
  44. package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
  45. package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
  46. package/lib/commonjs/domain/userList/types.js.map +1 -1
  47. package/lib/commonjs/fragments/createGroupChannelFragment.js +34 -7
  48. package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
  49. package/lib/commonjs/fragments/createMessageSearchFragment.js +1 -1
  50. package/lib/commonjs/fragments/createMessageSearchFragment.js.map +1 -1
  51. package/lib/commonjs/hooks/useChannelInputItems.js +211 -0
  52. package/lib/commonjs/hooks/useChannelInputItems.js.map +1 -0
  53. package/lib/commonjs/hooks/useConnection.js +1 -1
  54. package/lib/commonjs/hooks/useConnection.js.map +1 -1
  55. package/lib/commonjs/hooks/useVoiceMessageInput.js +207 -0
  56. package/lib/commonjs/hooks/useVoiceMessageInput.js.map +1 -0
  57. package/lib/commonjs/index.js +36 -0
  58. package/lib/commonjs/index.js.map +1 -1
  59. package/lib/commonjs/libs/MentionManager.js.map +1 -1
  60. package/lib/commonjs/libs/SBUUtils.js +4 -0
  61. package/lib/commonjs/libs/SBUUtils.js.map +1 -1
  62. package/lib/commonjs/libs/VoiceMessageConfig.js +30 -0
  63. package/lib/commonjs/libs/VoiceMessageConfig.js.map +1 -0
  64. package/lib/commonjs/localization/StringSet.type.js.map +1 -1
  65. package/lib/commonjs/localization/createBaseStringSet.js +24 -9
  66. package/lib/commonjs/localization/createBaseStringSet.js.map +1 -1
  67. package/lib/commonjs/platform/createFileService.expo.js +10 -0
  68. package/lib/commonjs/platform/createFileService.expo.js.map +1 -1
  69. package/lib/commonjs/platform/createFileService.native.js +19 -0
  70. package/lib/commonjs/platform/createFileService.native.js.map +1 -1
  71. package/lib/commonjs/platform/createPlayerService.expo.js +137 -0
  72. package/lib/commonjs/platform/createPlayerService.expo.js.map +1 -0
  73. package/lib/commonjs/platform/createPlayerService.native.js +139 -0
  74. package/lib/commonjs/platform/createPlayerService.native.js.map +1 -0
  75. package/lib/commonjs/platform/createRecorderService.expo.js +158 -0
  76. package/lib/commonjs/platform/createRecorderService.expo.js.map +1 -0
  77. package/lib/commonjs/platform/createRecorderService.native.js +157 -0
  78. package/lib/commonjs/platform/createRecorderService.native.js.map +1 -0
  79. package/lib/commonjs/platform/types.js.map +1 -1
  80. package/lib/commonjs/types.js +7 -0
  81. package/lib/commonjs/types.js.map +1 -1
  82. package/lib/commonjs/utils/promise.js +138 -0
  83. package/lib/commonjs/utils/promise.js.map +1 -0
  84. package/lib/commonjs/version.js +1 -1
  85. package/lib/commonjs/version.js.map +1 -1
  86. package/lib/module/components/ChannelInput/EditInput.js +3 -12
  87. package/lib/module/components/ChannelInput/EditInput.js.map +1 -1
  88. package/lib/module/components/ChannelInput/MessageToReplyPreview.js +137 -0
  89. package/lib/module/components/ChannelInput/MessageToReplyPreview.js.map +1 -0
  90. package/lib/module/components/ChannelInput/SendInput.js +152 -326
  91. package/lib/module/components/ChannelInput/SendInput.js.map +1 -1
  92. package/lib/module/components/ChannelInput/VoiceMessageInput.js +228 -0
  93. package/lib/module/components/ChannelInput/VoiceMessageInput.js.map +1 -0
  94. package/lib/module/components/ChannelInput/index.js +36 -5
  95. package/lib/module/components/ChannelInput/index.js.map +1 -1
  96. package/lib/module/components/ChannelMessageList/index.js +149 -117
  97. package/lib/module/components/ChannelMessageList/index.js.map +1 -1
  98. package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +24 -13
  99. package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -1
  100. package/lib/module/components/GroupChannelMessageRenderer/index.js +132 -7
  101. package/lib/module/components/GroupChannelMessageRenderer/index.js.map +1 -1
  102. package/lib/module/components/MessageSearchResultItem.js +2 -1
  103. package/lib/module/components/MessageSearchResultItem.js.map +1 -1
  104. package/lib/module/components/OpenChannelMessageRenderer/index.js +1 -0
  105. package/lib/module/components/OpenChannelMessageRenderer/index.js.map +1 -1
  106. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +2 -2
  107. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
  108. package/lib/module/components/ReactionBottomSheets/index.js.map +1 -1
  109. package/lib/module/components/StatusComposition.js.map +1 -1
  110. package/lib/module/constants.js +2 -0
  111. package/lib/module/constants.js.map +1 -1
  112. package/lib/module/containers/GroupChannelPreviewContainer.js +2 -1
  113. package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
  114. package/lib/module/containers/InternalErrorBoundaryContainer.js.map +1 -1
  115. package/lib/module/containers/SendbirdUIKitContainer.js +74 -36
  116. package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
  117. package/lib/module/contexts/PlatformServiceCtx.js +14 -11
  118. package/lib/module/contexts/PlatformServiceCtx.js.map +1 -1
  119. package/lib/module/contexts/ReactionCtx.js +3 -2
  120. package/lib/module/contexts/ReactionCtx.js.map +1 -1
  121. package/lib/module/contexts/SendbirdChatCtx.js +2 -0
  122. package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
  123. package/lib/module/domain/groupChannel/component/GroupChannelHeader.js +15 -5
  124. package/lib/module/domain/groupChannel/component/GroupChannelHeader.js.map +1 -1
  125. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +29 -43
  126. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  127. package/lib/module/domain/groupChannel/module/moduleContext.js +111 -7
  128. package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
  129. package/lib/module/domain/groupChannel/types.js.map +1 -1
  130. package/lib/module/domain/userList/types.js.map +1 -1
  131. package/lib/module/fragments/createGroupChannelFragment.js +36 -9
  132. package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
  133. package/lib/module/fragments/createMessageSearchFragment.js +1 -1
  134. package/lib/module/fragments/createMessageSearchFragment.js.map +1 -1
  135. package/lib/module/hooks/useChannelInputItems.js +203 -0
  136. package/lib/module/hooks/useChannelInputItems.js.map +1 -0
  137. package/lib/module/hooks/useConnection.js +1 -1
  138. package/lib/module/hooks/useConnection.js.map +1 -1
  139. package/lib/module/hooks/useVoiceMessageInput.js +199 -0
  140. package/lib/module/hooks/useVoiceMessageInput.js.map +1 -0
  141. package/lib/module/index.js +8 -0
  142. package/lib/module/index.js.map +1 -1
  143. package/lib/module/libs/MentionManager.js.map +1 -1
  144. package/lib/module/libs/SBUUtils.js +4 -0
  145. package/lib/module/libs/SBUUtils.js.map +1 -1
  146. package/lib/module/libs/VoiceMessageConfig.js +23 -0
  147. package/lib/module/libs/VoiceMessageConfig.js.map +1 -0
  148. package/lib/module/localization/StringSet.type.js.map +1 -1
  149. package/lib/module/localization/createBaseStringSet.js +25 -10
  150. package/lib/module/localization/createBaseStringSet.js.map +1 -1
  151. package/lib/module/platform/createFileService.expo.js +10 -0
  152. package/lib/module/platform/createFileService.expo.js.map +1 -1
  153. package/lib/module/platform/createFileService.native.js +19 -0
  154. package/lib/module/platform/createFileService.native.js.map +1 -1
  155. package/lib/module/platform/createPlayerService.expo.js +129 -0
  156. package/lib/module/platform/createPlayerService.expo.js.map +1 -0
  157. package/lib/module/platform/createPlayerService.native.js +132 -0
  158. package/lib/module/platform/createPlayerService.native.js.map +1 -0
  159. package/lib/module/platform/createRecorderService.expo.js +150 -0
  160. package/lib/module/platform/createRecorderService.expo.js.map +1 -0
  161. package/lib/module/platform/createRecorderService.native.js +149 -0
  162. package/lib/module/platform/createRecorderService.native.js.map +1 -0
  163. package/lib/module/platform/types.js.map +1 -1
  164. package/lib/module/types.js +5 -1
  165. package/lib/module/types.js.map +1 -1
  166. package/lib/module/utils/promise.js +132 -0
  167. package/lib/module/utils/promise.js.map +1 -0
  168. package/lib/module/version.js +1 -1
  169. package/lib/module/version.js.map +1 -1
  170. package/lib/typescript/src/components/ChannelCover.d.ts +2 -1
  171. package/lib/typescript/src/components/ChannelInput/AttachmentsButton.d.ts +2 -1
  172. package/lib/typescript/src/components/ChannelInput/MessageToReplyPreview.d.ts +7 -0
  173. package/lib/typescript/src/components/ChannelInput/VoiceMessageInput.d.ts +11 -0
  174. package/lib/typescript/src/components/ChannelInput/index.d.ts +9 -3
  175. package/lib/typescript/src/components/ChannelMessageList/index.d.ts +4 -1
  176. package/lib/typescript/src/components/FileViewer.d.ts +2 -1
  177. package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.d.ts +2 -1
  178. package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.d.ts +1 -1
  179. package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.d.ts +1 -1
  180. package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.d.ts +4 -2
  181. package/lib/typescript/src/components/GroupChannelMessageRenderer/index.d.ts +3 -0
  182. package/lib/typescript/src/components/NewMessagesButton.d.ts +1 -1
  183. package/lib/typescript/src/components/OpenChannelMessageRenderer/OpenChannelMessageDateSeparator.d.ts +2 -1
  184. package/lib/typescript/src/components/OpenChannelMessageRenderer/index.d.ts +2 -0
  185. package/lib/typescript/src/components/ProviderLayout.d.ts +1 -1
  186. package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +2 -1
  187. package/lib/typescript/src/components/ReactionAddons/MessageReactionAddon.d.ts +2 -1
  188. package/lib/typescript/src/components/ReactionAddons/ReactionRoundedButton.d.ts +3 -2
  189. package/lib/typescript/src/components/ReactionAddons/index.d.ts +3 -2
  190. package/lib/typescript/src/components/ReactionBottomSheets/ReactionListBottomSheet.d.ts +2 -1
  191. package/lib/typescript/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.d.ts +2 -1
  192. package/lib/typescript/src/components/ReactionBottomSheets/index.d.ts +4 -4
  193. package/lib/typescript/src/components/ScrollToBottomButton.d.ts +1 -1
  194. package/lib/typescript/src/components/StatusComposition.d.ts +4 -4
  195. package/lib/typescript/src/components/TypedPlaceholder.d.ts +2 -1
  196. package/lib/typescript/src/components/UserActionBar.d.ts +2 -1
  197. package/lib/typescript/src/components/UserSelectableBar.d.ts +2 -1
  198. package/lib/typescript/src/constants.d.ts +2 -0
  199. package/lib/typescript/src/containers/GroupChannelPreviewContainer.d.ts +2 -1
  200. package/lib/typescript/src/containers/InternalErrorBoundaryContainer.d.ts +3 -3
  201. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +19 -8
  202. package/lib/typescript/src/contexts/LocalizationCtx.d.ts +1 -1
  203. package/lib/typescript/src/contexts/PlatformServiceCtx.d.ts +8 -8
  204. package/lib/typescript/src/contexts/ReactionCtx.d.ts +5 -2
  205. package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +6 -3
  206. package/lib/typescript/src/contexts/UserProfileCtx.d.ts +1 -1
  207. package/lib/typescript/src/domain/groupChannel/component/GroupChannelHeader.d.ts +2 -1
  208. package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput.d.ts +1 -1
  209. package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +1 -1
  210. package/lib/typescript/src/domain/groupChannel/component/GroupChannelStatusEmpty.d.ts +2 -1
  211. package/lib/typescript/src/domain/groupChannel/component/GroupChannelStatusLoading.d.ts +2 -1
  212. package/lib/typescript/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.d.ts +2 -1
  213. package/lib/typescript/src/domain/groupChannel/types.d.ts +48 -0
  214. package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.d.ts +2 -1
  215. package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.d.ts +2 -1
  216. package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.d.ts +2 -1
  217. package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.d.ts +2 -1
  218. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListHeader.d.ts +2 -1
  219. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListList.d.ts +2 -1
  220. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListStatusEmpty.d.ts +2 -1
  221. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListStatusLoading.d.ts +2 -1
  222. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListTypeSelector.d.ts +2 -1
  223. package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationHeader.d.ts +2 -1
  224. package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationMenu.d.ts +2 -1
  225. package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.d.ts +2 -1
  226. package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.d.ts +2 -1
  227. package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.d.ts +2 -1
  228. package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.d.ts +2 -1
  229. package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.d.ts +2 -1
  230. package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.d.ts +2 -1
  231. package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.d.ts +2 -1
  232. package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsList.d.ts +2 -1
  233. package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.d.ts +2 -1
  234. package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.d.ts +2 -1
  235. package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsHeader.d.ts +2 -1
  236. package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsInfo.d.ts +2 -1
  237. package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.d.ts +2 -1
  238. package/lib/typescript/src/domain/messageSearch/component/MessageSearchHeader.d.ts +2 -1
  239. package/lib/typescript/src/domain/messageSearch/component/MessageSearchList.d.ts +2 -1
  240. package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusEmpty.d.ts +2 -1
  241. package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusLoading.d.ts +2 -1
  242. package/lib/typescript/src/domain/openChannel/component/OpenChannelHeader.d.ts +2 -2
  243. package/lib/typescript/src/domain/openChannel/component/OpenChannelInput.d.ts +1 -1
  244. package/lib/typescript/src/domain/openChannel/component/OpenChannelMessageList.d.ts +1 -1
  245. package/lib/typescript/src/domain/openChannel/component/OpenChannelStatusEmpty.d.ts +2 -1
  246. package/lib/typescript/src/domain/openChannel/component/OpenChannelStatusLoading.d.ts +2 -1
  247. package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersHeader.d.ts +2 -1
  248. package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersList.d.ts +2 -1
  249. package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersStatusEmpty.d.ts +2 -1
  250. package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersStatusLoading.d.ts +2 -1
  251. package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateHeader.d.ts +2 -1
  252. package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateProfileInput.d.ts +2 -1
  253. package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateStatusLoading.d.ts +2 -1
  254. package/lib/typescript/src/domain/openChannelList/component/OpenChannelListHeader.d.ts +2 -1
  255. package/lib/typescript/src/domain/openChannelList/component/OpenChannelListList.d.ts +2 -1
  256. package/lib/typescript/src/domain/openChannelList/component/OpenChannelListStatusEmpty.d.ts +2 -1
  257. package/lib/typescript/src/domain/openChannelList/component/OpenChannelListStatusLoading.d.ts +2 -1
  258. package/lib/typescript/src/domain/openChannelModeration/component/OpenChannelModerationHeader.d.ts +2 -1
  259. package/lib/typescript/src/domain/openChannelModeration/component/OpenChannelModerationMenu.d.ts +2 -1
  260. package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsHeader.d.ts +2 -1
  261. package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsList.d.ts +2 -1
  262. package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsStatusEmpty.d.ts +2 -1
  263. package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsStatusLoading.d.ts +2 -1
  264. package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsHeader.d.ts +2 -1
  265. package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsList.d.ts +2 -1
  266. package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsStatusEmpty.d.ts +2 -1
  267. package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsStatusLoading.d.ts +2 -1
  268. package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsHeader.d.ts +2 -1
  269. package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsInfo.d.ts +2 -1
  270. package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsMenu.d.ts +2 -1
  271. package/lib/typescript/src/domain/userList/component/UserListHeader.d.ts +3 -3
  272. package/lib/typescript/src/domain/userList/component/UserListList.d.ts +1 -1
  273. package/lib/typescript/src/domain/userList/component/UserListStatusEmpty.d.ts +2 -1
  274. package/lib/typescript/src/domain/userList/component/UserListStatusLoading.d.ts +2 -1
  275. package/lib/typescript/src/domain/userList/types.d.ts +2 -2
  276. package/lib/typescript/src/hooks/useChannelInputItems.d.ts +10 -0
  277. package/lib/typescript/src/hooks/useVoiceMessageInput.d.ts +53 -0
  278. package/lib/typescript/src/index.d.ts +4 -0
  279. package/lib/typescript/src/libs/MentionManager.d.ts +2 -1
  280. package/lib/typescript/src/libs/SBUUtils.d.ts +1 -0
  281. package/lib/typescript/src/libs/VoiceMessageConfig.d.ts +25 -0
  282. package/lib/typescript/src/localization/StringSet.type.d.ts +7 -0
  283. package/lib/typescript/src/platform/createPlayerService.expo.d.ts +7 -0
  284. package/lib/typescript/src/platform/createPlayerService.native.d.ts +9 -0
  285. package/lib/typescript/src/platform/createRecorderService.expo.d.ts +7 -0
  286. package/lib/typescript/src/platform/createRecorderService.native.d.ts +9 -0
  287. package/lib/typescript/src/platform/types.d.ts +100 -1
  288. package/lib/typescript/src/types.d.ts +5 -1
  289. package/lib/typescript/src/utils/promise.d.ts +7 -0
  290. package/lib/typescript/src/version.d.ts +1 -1
  291. package/package.json +10 -12
  292. package/src/components/ChannelInput/EditInput.tsx +3 -15
  293. package/src/components/ChannelInput/MessageToReplyPreview.tsx +133 -0
  294. package/src/components/ChannelInput/SendInput.tsx +131 -329
  295. package/src/components/ChannelInput/VoiceMessageInput.tsx +206 -0
  296. package/src/components/ChannelInput/index.tsx +37 -6
  297. package/src/components/ChannelMessageList/index.tsx +145 -113
  298. package/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.tsx +24 -11
  299. package/src/components/GroupChannelMessageRenderer/index.tsx +113 -4
  300. package/src/components/MessageSearchResultItem.tsx +2 -1
  301. package/src/components/OpenChannelMessageRenderer/index.tsx +1 -0
  302. package/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.tsx +2 -2
  303. package/src/components/ReactionBottomSheets/index.tsx +3 -2
  304. package/src/components/StatusComposition.tsx +3 -3
  305. package/src/constants.ts +2 -0
  306. package/src/containers/GroupChannelPreviewContainer.tsx +2 -0
  307. package/src/containers/InternalErrorBoundaryContainer.tsx +1 -1
  308. package/src/containers/SendbirdUIKitContainer.tsx +103 -59
  309. package/src/contexts/PlatformServiceCtx.tsx +22 -20
  310. package/src/contexts/ReactionCtx.tsx +7 -5
  311. package/src/contexts/SendbirdChatCtx.tsx +10 -2
  312. package/src/domain/groupChannel/component/GroupChannelHeader.tsx +14 -3
  313. package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +30 -43
  314. package/src/domain/groupChannel/module/moduleContext.tsx +119 -7
  315. package/src/domain/groupChannel/types.ts +45 -0
  316. package/src/domain/userList/types.ts +2 -2
  317. package/src/fragments/createGroupChannelFragment.tsx +43 -8
  318. package/src/fragments/createMessageSearchFragment.tsx +1 -1
  319. package/src/hooks/useChannelInputItems.ts +215 -0
  320. package/src/hooks/useConnection.ts +1 -1
  321. package/src/hooks/useVoiceMessageInput.ts +237 -0
  322. package/src/index.ts +9 -1
  323. package/src/libs/MentionManager.tsx +1 -1
  324. package/src/libs/SBUUtils.ts +5 -0
  325. package/src/libs/VoiceMessageConfig.ts +28 -0
  326. package/src/localization/StringSet.type.ts +8 -0
  327. package/src/localization/createBaseStringSet.ts +27 -11
  328. package/src/platform/createFileService.expo.ts +10 -0
  329. package/src/platform/createFileService.native.ts +19 -0
  330. package/src/platform/createPlayerService.expo.tsx +142 -0
  331. package/src/platform/createPlayerService.native.tsx +148 -0
  332. package/src/platform/createRecorderService.expo.tsx +160 -0
  333. package/src/platform/createRecorderService.native.tsx +170 -0
  334. package/src/platform/types.ts +114 -1
  335. package/src/types.ts +6 -1
  336. package/src/utils/promise.ts +139 -0
  337. package/src/version.ts +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","TouchableOpacity","View","Icon","ImageWithPlaceholder","Text","VideoThumbnail","createStyleSheet","useUIKitTheme","getFileIconFromMessageType","getMessageType","getThumbnailUriFromFileMessage","useLocalization","usePlatformService","MessageToReplyPreview","_ref","messageToReply","setMessageToReply","colors","select","palette","mediaService","STRINGS","getFileIconAsImage","url","createElement","source","uri","style","styles","previewImage","getFileIconAsVideoThumbnail","iconSize","fetchThumbnailFromVideoSource","getVideoThumbnail","timeMills","getFileIconAsSymbol","icon","size","color","onBackground02","containerStyle","fileIcon","backgroundColor","light","background100","dark","background500","getFileIcon","isFileMessage","messageType","messageToReplyContainer","borderColor","onBackground04","flex","flexDirection","numberOfLines","fontSize","fontWeight","marginBottom","LABELS","CHANNEL_INPUT_REPLY_PREVIEW_TITLE","sender","onBackground03","CHANNEL_INPUT_REPLY_PREVIEW_BODY","onPress","undefined","onBackground01","closeIcon","width","height","borderRadius","marginTop","marginRight","overflow","paddingLeft","paddingRight","paddingTop","paddingBottom","alignItems","borderTopWidth","marginLeft","padding"],"sources":["MessageToReplyPreview.tsx"],"sourcesContent":["import React from 'react';\nimport { TouchableOpacity, View } from 'react-native';\n\nimport {\n Icon,\n ImageWithPlaceholder,\n Text,\n VideoThumbnail,\n createStyleSheet,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport {\n FileIcon,\n SendbirdBaseMessage,\n SendbirdFileMessage,\n SendbirdUserMessage,\n getFileIconFromMessageType,\n getMessageType,\n getThumbnailUriFromFileMessage,\n} from '@sendbird/uikit-utils';\n\nimport { useLocalization, usePlatformService } from '../../hooks/useContext';\n\nexport type MessageToReplyPreviewProps = {\n messageToReply?: SendbirdFileMessage | SendbirdUserMessage;\n setMessageToReply?: (message?: undefined | SendbirdFileMessage | SendbirdUserMessage) => void;\n};\n\nexport const MessageToReplyPreview = ({ messageToReply, setMessageToReply }: MessageToReplyPreviewProps) => {\n const { colors, select, palette } = useUIKitTheme();\n const { mediaService } = usePlatformService();\n const { STRINGS } = useLocalization();\n\n const getFileIconAsImage = (url: string) => {\n return <ImageWithPlaceholder source={{ uri: url }} style={styles.previewImage} />;\n };\n\n const getFileIconAsVideoThumbnail = (url: string) => {\n return (\n <VideoThumbnail\n style={styles.previewImage}\n iconSize={0}\n source={url}\n fetchThumbnailFromVideoSource={(uri) => mediaService.getVideoThumbnail({ url: uri, timeMills: 1000 })}\n />\n );\n };\n\n const getFileIconAsSymbol = (icon: FileIcon) => {\n return (\n <Icon\n icon={icon}\n size={20}\n color={colors.onBackground02}\n containerStyle={[\n styles.fileIcon,\n {\n backgroundColor: select({ light: palette.background100, dark: palette.background500 }),\n },\n ]}\n />\n );\n };\n\n const getFileIcon = (messageToReply: SendbirdBaseMessage) => {\n if (messageToReply?.isFileMessage()) {\n const messageType = getMessageType(messageToReply);\n switch (messageType) {\n case 'file.image':\n return getFileIconAsImage(getThumbnailUriFromFileMessage(messageToReply));\n case 'file.video':\n return getFileIconAsVideoThumbnail(getThumbnailUriFromFileMessage(messageToReply));\n case 'file.voice':\n return null;\n default:\n return getFileIconAsSymbol(getFileIconFromMessageType(messageType));\n }\n }\n return null;\n };\n\n if (!messageToReply) return null;\n\n return (\n <View style={[styles.messageToReplyContainer, { borderColor: colors.onBackground04 }]}>\n <View style={{ flex: 1, flexDirection: 'row' }}>\n {getFileIcon(messageToReply)}\n <View style={{ flex: 1, flexDirection: 'column' }}>\n <Text numberOfLines={1} style={{ fontSize: 13, fontWeight: '900', marginBottom: 4 }}>\n {STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_TITLE(messageToReply.sender)}\n </Text>\n <Text numberOfLines={1} style={{ fontSize: 13, color: colors.onBackground03 }}>\n {STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_BODY(messageToReply)}\n </Text>\n </View>\n </View>\n <TouchableOpacity onPress={() => setMessageToReply?.(undefined)}>\n <Icon icon={'close'} size={24} color={colors.onBackground01} containerStyle={styles.closeIcon} />\n </TouchableOpacity>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n previewImage: {\n width: 36,\n height: 36,\n borderRadius: 10,\n marginTop: 2,\n marginRight: 10,\n overflow: 'hidden',\n },\n messageToReplyContainer: {\n flexDirection: 'row',\n paddingLeft: 18,\n paddingRight: 16,\n paddingTop: 10,\n paddingBottom: 8,\n alignItems: 'center',\n borderTopWidth: 1,\n },\n fileIcon: {\n width: 36,\n height: 36,\n borderRadius: 10,\n marginRight: 10,\n marginTop: 2,\n },\n closeIcon: {\n marginLeft: 4,\n padding: 4,\n },\n});\n"],"mappings":"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"}
@@ -1,13 +1,17 @@
1
1
  import React, { forwardRef } from 'react';
2
- import { Platform, TouchableOpacity, View } from 'react-native';
3
- import { MentionType } from '@sendbird/chat/message';
4
- import { Icon, ImageWithPlaceholder, Text, TextInput, VideoThumbnail, createStyleSheet, useAlert, useBottomSheet, useToast, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
5
- import { Logger, getFileIconFromMessageType, getMessageType, getThumbnailUriFromFileMessage, isImage, shouldCompressImage, useIIFE } from '@sendbird/uikit-utils';
2
+ import { TouchableOpacity, View } from 'react-native';
3
+ import { MentionType, MessageMetaArray } from '@sendbird/chat/message';
4
+ import { Icon, Modal, TextInput, createStyleSheet, useAlert, useBottomSheet, useToast, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
5
+ import { Logger, useDeferredModalState, useIIFE } from '@sendbird/uikit-utils';
6
+ import { VOICE_MESSAGE_META_ARRAY_DURATION_KEY, VOICE_MESSAGE_META_ARRAY_MESSAGE_TYPE_KEY } from '../../constants';
7
+ import { useChannelInputItems } from '../../hooks/useChannelInputItems';
6
8
  import { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';
7
- import SBUError from '../../libs/SBUError';
8
9
  import SBUUtils from '../../libs/SBUUtils';
9
10
  const SendInput = /*#__PURE__*/forwardRef(function SendInput(_ref, ref) {
10
11
  let {
12
+ style,
13
+ VoiceMessageInput,
14
+ MessageToReplyPreview,
11
15
  AttachmentsButton,
12
16
  onPressSendUserMessage,
13
17
  onPressSendFileMessage,
@@ -22,15 +26,14 @@ const SendInput = /*#__PURE__*/forwardRef(function SendInput(_ref, ref) {
22
26
  messageToReply,
23
27
  setMessageToReply
24
28
  } = _ref;
29
+ const {
30
+ playerService,
31
+ recorderService
32
+ } = usePlatformService();
25
33
  const {
26
34
  mentionManager,
27
35
  sbOptions
28
36
  } = useSendbirdChat();
29
- const {
30
- select,
31
- colors,
32
- palette
33
- } = useUIKitTheme();
34
37
  const {
35
38
  STRINGS
36
39
  } = useLocalization();
@@ -39,8 +42,11 @@ const SendInput = /*#__PURE__*/forwardRef(function SendInput(_ref, ref) {
39
42
  } = useBottomSheet();
40
43
  const toast = useToast();
41
44
  const {
42
- mediaService
43
- } = usePlatformService();
45
+ onClose,
46
+ onDismiss,
47
+ visible: voiceMessageInputVisible,
48
+ setVisible: setVoiceMessageInputVisible
49
+ } = useDeferredModalState();
44
50
  const messageReplyParams = useIIFE(() => {
45
51
  const {
46
52
  groupChannel
@@ -82,10 +88,30 @@ const SendInput = /*#__PURE__*/forwardRef(function SendInput(_ref, ref) {
82
88
  }).catch(onFailureToSend);
83
89
  setMessageToReply === null || setMessageToReply === void 0 ? void 0 : setMessageToReply();
84
90
  };
91
+ const sendVoiceMessage = (file, durationMills) => {
92
+ if (inputMuted) {
93
+ toast.show(STRINGS.TOAST.USER_MUTED_ERROR, 'error');
94
+ Logger.error(STRINGS.TOAST.USER_MUTED_ERROR);
95
+ } else if (inputFrozen) {
96
+ toast.show(STRINGS.TOAST.CHANNEL_FROZEN_ERROR, 'error');
97
+ Logger.error(STRINGS.TOAST.CHANNEL_FROZEN_ERROR);
98
+ } else {
99
+ onPressSendFileMessage({
100
+ file,
101
+ metaArrays: [new MessageMetaArray({
102
+ key: VOICE_MESSAGE_META_ARRAY_DURATION_KEY,
103
+ value: [String(durationMills)]
104
+ }), new MessageMetaArray({
105
+ key: VOICE_MESSAGE_META_ARRAY_MESSAGE_TYPE_KEY,
106
+ value: [`voice/${recorderService.options.extension}`]
107
+ })],
108
+ ...messageReplyParams
109
+ }).catch(onFailureToSend);
110
+ }
111
+ onChangeText('');
112
+ setMessageToReply === null || setMessageToReply === void 0 ? void 0 : setMessageToReply();
113
+ };
85
114
  const sheetItems = useChannelInputItems(channel, sendFileMessage);
86
- const onPressAttachment = () => openSheet({
87
- sheetItems
88
- });
89
115
  const getPlaceholder = () => {
90
116
  if (inputMuted) return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_MUTED;
91
117
  if (inputFrozen) return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_DISABLED;
@@ -93,102 +119,17 @@ const SendInput = /*#__PURE__*/forwardRef(function SendInput(_ref, ref) {
93
119
  if (messageToReply) return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_REPLY;
94
120
  return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_ACTIVE;
95
121
  };
96
- const getFileIconAsImage = url => {
97
- return /*#__PURE__*/React.createElement(ImageWithPlaceholder, {
98
- source: {
99
- uri: url
100
- },
101
- style: styles.previewImage
102
- });
103
- };
104
- const getFileIconAsVideoThumbnail = url => {
105
- return /*#__PURE__*/React.createElement(VideoThumbnail, {
106
- style: styles.previewImage,
107
- iconSize: 0,
108
- source: url,
109
- fetchThumbnailFromVideoSource: uri => mediaService.getVideoThumbnail({
110
- url: uri,
111
- timeMills: 1000
112
- })
113
- });
114
- };
115
- const getFileIconAsSymbol = icon => {
116
- return /*#__PURE__*/React.createElement(Icon, {
117
- icon: icon,
118
- size: 20,
119
- color: colors.onBackground02,
120
- containerStyle: {
121
- backgroundColor: select({
122
- light: palette.background100,
123
- dark: palette.background500
124
- }),
125
- width: 36,
126
- height: 36,
127
- borderRadius: 10,
128
- marginRight: 10,
129
- marginTop: 2
130
- }
131
- });
132
- };
133
- const getFileIcon = messageToReply => {
134
- if (messageToReply !== null && messageToReply !== void 0 && messageToReply.isFileMessage()) {
135
- const messageType = getMessageType(messageToReply);
136
- switch (messageType) {
137
- case 'file.image':
138
- return getFileIconAsImage(getThumbnailUriFromFileMessage(messageToReply));
139
- case 'file.video':
140
- return getFileIconAsVideoThumbnail(getThumbnailUriFromFileMessage(messageToReply));
141
- default:
142
- return getFileIconAsSymbol(getFileIconFromMessageType(messageType));
143
- }
144
- }
145
- return null;
146
- };
147
- return /*#__PURE__*/React.createElement(View, null, messageToReply && /*#__PURE__*/React.createElement(View, {
148
- style: {
149
- flexDirection: 'row',
150
- paddingLeft: 18,
151
- paddingRight: 16,
152
- paddingTop: 10,
153
- paddingBottom: 8,
154
- alignItems: 'center',
155
- borderTopWidth: 1,
156
- borderColor: colors.onBackground04
157
- }
158
- }, /*#__PURE__*/React.createElement(View, {
159
- style: {
160
- flex: 1,
161
- flexDirection: 'row'
162
- }
163
- }, getFileIcon(messageToReply), /*#__PURE__*/React.createElement(View, {
164
- style: {
165
- flex: 1,
166
- flexDirection: 'column'
167
- }
168
- }, /*#__PURE__*/React.createElement(Text, {
169
- numberOfLines: 1,
170
- style: {
171
- fontSize: 13,
172
- fontWeight: '900',
173
- marginBottom: 4
174
- }
175
- }, STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_TITLE(messageToReply.sender)), /*#__PURE__*/React.createElement(Text, {
176
- numberOfLines: 1,
177
- style: {
178
- fontSize: 13,
179
- color: colors.onBackground03
180
- }
181
- }, STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_BODY(messageToReply)))), /*#__PURE__*/React.createElement(TouchableOpacity, {
182
- onPress: () => setMessageToReply === null || setMessageToReply === void 0 ? void 0 : setMessageToReply(undefined)
183
- }, /*#__PURE__*/React.createElement(Icon, {
184
- icon: 'close',
185
- size: 24,
186
- color: colors.onBackground01,
187
- containerStyle: styles.iconSend
188
- }))), /*#__PURE__*/React.createElement(View, {
122
+ const voiceMessageEnabled = channel.isGroupChannel() && sbOptions.uikit.groupChannel.channel.enableVoiceMessage;
123
+ const sendButtonVisible = Boolean(text.trim());
124
+ return /*#__PURE__*/React.createElement(View, null, MessageToReplyPreview && /*#__PURE__*/React.createElement(MessageToReplyPreview, {
125
+ messageToReply: messageToReply,
126
+ setMessageToReply: setMessageToReply
127
+ }), /*#__PURE__*/React.createElement(View, {
189
128
  style: styles.sendInputContainer
190
129
  }, AttachmentsButton && /*#__PURE__*/React.createElement(AttachmentsButton, {
191
- onPress: onPressAttachment,
130
+ onPress: () => openSheet({
131
+ sheetItems
132
+ }),
192
133
  disabled: inputDisabled
193
134
  }), /*#__PURE__*/React.createElement(TextInput, {
194
135
  ref: ref,
@@ -197,214 +138,117 @@ const SendInput = /*#__PURE__*/forwardRef(function SendInput(_ref, ref) {
197
138
  onSelectionChange: onSelectionChange,
198
139
  editable: !inputDisabled,
199
140
  onChangeText: onChangeText,
200
- style: styles.input,
141
+ style: style,
201
142
  placeholder: getPlaceholder()
202
- }, mentionManager.textToMentionedComponents(text, mentionedUsers, sbOptions.uikit.groupChannel.channel.enableMention)), Boolean(text.trim()) && /*#__PURE__*/React.createElement(TouchableOpacity, {
203
- onPress: sendUserMessage,
204
- disabled: inputDisabled
205
- }, /*#__PURE__*/React.createElement(Icon, {
206
- color: inputDisabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight,
207
- icon: 'send',
208
- size: 24,
209
- containerStyle: styles.iconSend
143
+ }, mentionManager.textToMentionedComponents(text, mentionedUsers, sbOptions.uikit.groupChannel.channel.enableMention)), voiceMessageEnabled && /*#__PURE__*/React.createElement(VoiceMessageButton, {
144
+ visible: !sendButtonVisible,
145
+ disabled: inputDisabled,
146
+ onPress: () => setVoiceMessageInputVisible(true)
147
+ }), /*#__PURE__*/React.createElement(UserMessageSendButton, {
148
+ visible: sendButtonVisible,
149
+ disabled: inputDisabled,
150
+ onPress: sendUserMessage
151
+ }), voiceMessageEnabled && VoiceMessageInput && /*#__PURE__*/React.createElement(Modal, {
152
+ disableBackgroundClose: true,
153
+ onClose: onClose,
154
+ onDismiss: () => {
155
+ onDismiss();
156
+ Promise.allSettled([playerService.reset(), recorderService.reset()]);
157
+ },
158
+ backgroundStyle: {
159
+ justifyContent: 'flex-end'
160
+ },
161
+ visible: voiceMessageInputVisible,
162
+ type: 'slide-no-gesture'
163
+ }, /*#__PURE__*/React.createElement(VoiceMessageInput, {
164
+ onClose: onClose,
165
+ onSend: _ref2 => {
166
+ let {
167
+ file,
168
+ duration
169
+ } = _ref2;
170
+ return sendVoiceMessage(file, duration);
171
+ }
210
172
  }))));
211
173
  });
212
- const useChannelInputItems = (channel, sendFileMessage) => {
213
- const {
214
- sbOptions,
215
- imageCompressionConfig
216
- } = useSendbirdChat();
174
+ const VoiceMessageButton = _ref3 => {
175
+ let {
176
+ visible,
177
+ disabled,
178
+ onPress
179
+ } = _ref3;
217
180
  const {
218
181
  STRINGS
219
182
  } = useLocalization();
220
- const {
221
- fileService,
222
- mediaService
223
- } = usePlatformService();
224
183
  const {
225
184
  alert
226
185
  } = useAlert();
227
- const toast = useToast();
228
- const sheetItems = [];
229
- const input = useIIFE(() => {
230
- switch (true) {
231
- case channel.isOpenChannel():
232
- return sbOptions.uikit.openChannel.channel.input;
233
- case channel.isGroupChannel():
234
- return sbOptions.uikit.groupChannel.channel.input;
235
- default:
236
- return {
237
- enableDocument: true,
238
- camera: {
239
- enablePhoto: true,
240
- enableVideo: true
241
- },
242
- gallery: {
243
- enablePhoto: true,
244
- enableVideo: true
245
- }
246
- };
186
+ const {
187
+ playerService,
188
+ recorderService
189
+ } = usePlatformService();
190
+ const {
191
+ colors
192
+ } = useUIKitTheme();
193
+ if (!visible) return null;
194
+ const onPressWithPermissionCheck = async () => {
195
+ const recorderGranted = await recorderService.requestPermission();
196
+ if (!recorderGranted) {
197
+ alert({
198
+ title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
199
+ message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(STRINGS.LABELS.PERMISSION_MICROPHONE, STRINGS.LABELS.PERMISSION_APP_NAME),
200
+ buttons: [{
201
+ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK,
202
+ onPress: () => SBUUtils.openSettings()
203
+ }]
204
+ });
205
+ Logger.error('Failed to request permission for recorder');
206
+ return;
247
207
  }
248
- });
249
- if (input.camera.enablePhoto) {
250
- sheetItems.push({
251
- title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_CAMERA_PHOTO,
252
- icon: 'camera',
253
- onPress: async () => {
254
- const mediaFile = await fileService.openCamera({
255
- mediaType: 'photo',
256
- onOpenFailure: error => {
257
- if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
258
- alert({
259
- title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
260
- message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(STRINGS.LABELS.PERMISSION_CAMERA, STRINGS.LABELS.PERMISSION_APP_NAME),
261
- buttons: [{
262
- text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK,
263
- onPress: () => SBUUtils.openSettings()
264
- }]
265
- });
266
- } else {
267
- toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');
268
- }
269
- }
270
- });
271
- if (mediaFile) {
272
- // Image compression
273
- if (isImage(mediaFile.uri, mediaFile.type) && shouldCompressImage(mediaFile.type, sbOptions.chat.imageCompressionEnabled)) {
274
- await SBUUtils.safeRun(async () => {
275
- const compressed = await mediaService.compressImage({
276
- uri: mediaFile.uri,
277
- maxWidth: imageCompressionConfig.width,
278
- maxHeight: imageCompressionConfig.height,
279
- compressionRate: imageCompressionConfig.compressionRate
280
- });
281
- if (compressed) {
282
- mediaFile.uri = compressed.uri;
283
- mediaFile.size = compressed.size;
284
- }
285
- });
286
- }
287
- sendFileMessage(mediaFile);
288
- }
289
- }
290
- });
291
- }
292
- if (input.camera.enableVideo) {
293
- sheetItems.push({
294
- title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_CAMERA_VIDEO,
295
- icon: 'camera',
296
- onPress: async () => {
297
- const mediaFile = await fileService.openCamera({
298
- mediaType: 'video',
299
- onOpenFailure: error => {
300
- if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
301
- alert({
302
- title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
303
- message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(STRINGS.LABELS.PERMISSION_CAMERA, STRINGS.LABELS.PERMISSION_APP_NAME),
304
- buttons: [{
305
- text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK,
306
- onPress: () => SBUUtils.openSettings()
307
- }]
308
- });
309
- } else {
310
- toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');
311
- }
312
- }
313
- });
314
- if (mediaFile) {
315
- sendFileMessage(mediaFile);
316
- }
317
- }
318
- });
319
- }
320
- if (input.gallery.enablePhoto || input.gallery.enableVideo) {
321
- const mediaType = (() => {
322
- switch (true) {
323
- case input.gallery.enablePhoto && input.gallery.enableVideo:
324
- return 'all';
325
- case input.gallery.enablePhoto && !input.gallery.enableVideo:
326
- return 'photo';
327
- case !input.gallery.enablePhoto && input.gallery.enableVideo:
328
- return 'video';
329
- default:
330
- return 'all';
331
- }
332
- })();
333
- sheetItems.push({
334
- title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_PHOTO_LIBRARY,
335
- icon: 'photo',
336
- onPress: async () => {
337
- const mediaFiles = await fileService.openMediaLibrary({
338
- selectionLimit: 1,
339
- mediaType,
340
- onOpenFailure: error => {
341
- if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
342
- alert({
343
- title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
344
- message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(STRINGS.LABELS.PERMISSION_DEVICE_STORAGE, STRINGS.LABELS.PERMISSION_APP_NAME),
345
- buttons: [{
346
- text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK,
347
- onPress: () => SBUUtils.openSettings()
348
- }]
349
- });
350
- } else {
351
- toast.show(STRINGS.TOAST.OPEN_PHOTO_LIBRARY_ERROR, 'error');
352
- }
353
- }
354
- });
355
- if (mediaFiles && mediaFiles[0]) {
356
- const mediaFile = mediaFiles[0];
357
-
358
- // Image compression
359
- if (isImage(mediaFile.uri, mediaFile.type) && shouldCompressImage(mediaFile.type, sbOptions.chat.imageCompressionEnabled)) {
360
- await SBUUtils.safeRun(async () => {
361
- const compressed = await mediaService.compressImage({
362
- uri: mediaFile.uri,
363
- maxWidth: imageCompressionConfig.width,
364
- maxHeight: imageCompressionConfig.height,
365
- compressionRate: imageCompressionConfig.compressionRate
366
- });
367
- if (compressed) {
368
- mediaFile.uri = compressed.uri;
369
- mediaFile.size = compressed.size;
370
- }
371
- });
372
- }
373
- sendFileMessage(mediaFile);
374
- }
375
- }
376
- });
377
- }
378
- if (input.enableDocument) {
379
- sheetItems.push({
380
- title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_FILES,
381
- icon: 'document',
382
- onPress: async () => {
383
- const documentFile = await fileService.openDocument({
384
- onOpenFailure: () => toast.show(STRINGS.TOAST.OPEN_FILES_ERROR, 'error')
385
- });
386
- if (documentFile) {
387
- // Image compression
388
- if (isImage(documentFile.uri, documentFile.type) && shouldCompressImage(documentFile.type, sbOptions.chat.imageCompressionEnabled)) {
389
- await SBUUtils.safeRun(async () => {
390
- const compressed = await mediaService.compressImage({
391
- uri: documentFile.uri,
392
- maxWidth: imageCompressionConfig.width,
393
- maxHeight: imageCompressionConfig.height,
394
- compressionRate: imageCompressionConfig.compressionRate
395
- });
396
- if (compressed) {
397
- documentFile.uri = compressed.uri;
398
- documentFile.size = compressed.size;
399
- }
400
- });
401
- }
402
- sendFileMessage(documentFile);
403
- }
404
- }
405
- });
406
- }
407
- return sheetItems;
208
+ const playerGranted = await playerService.requestPermission();
209
+ if (!playerGranted) {
210
+ alert({
211
+ title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
212
+ message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(STRINGS.LABELS.PERMISSION_DEVICE_STORAGE, STRINGS.LABELS.PERMISSION_APP_NAME),
213
+ buttons: [{
214
+ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK,
215
+ onPress: () => SBUUtils.openSettings()
216
+ }]
217
+ });
218
+ Logger.error('Failed to request permission for player');
219
+ return;
220
+ }
221
+ onPress();
222
+ };
223
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
224
+ onPress: onPressWithPermissionCheck,
225
+ disabled: disabled
226
+ }, /*#__PURE__*/React.createElement(Icon, {
227
+ color: disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight,
228
+ icon: 'audio-on',
229
+ size: 24,
230
+ containerStyle: styles.sendIcon
231
+ }));
232
+ };
233
+ const UserMessageSendButton = _ref4 => {
234
+ let {
235
+ visible,
236
+ disabled,
237
+ onPress
238
+ } = _ref4;
239
+ const {
240
+ colors
241
+ } = useUIKitTheme();
242
+ if (!visible) return null;
243
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
244
+ onPress: onPress,
245
+ disabled: disabled
246
+ }, /*#__PURE__*/React.createElement(Icon, {
247
+ color: disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight,
248
+ icon: 'send',
249
+ size: 24,
250
+ containerStyle: styles.sendIcon
251
+ }));
408
252
  };
409
253
  const styles = createStyleSheet({
410
254
  sendInputContainer: {
@@ -413,27 +257,9 @@ const styles = createStyleSheet({
413
257
  alignItems: 'center',
414
258
  flexDirection: 'row'
415
259
  },
416
- input: {
417
- flex: 1,
418
- marginRight: 4,
419
- minHeight: 36,
420
- maxHeight: 36 * Platform.select({
421
- ios: 2.5,
422
- default: 2
423
- }),
424
- borderRadius: 20
425
- },
426
- iconSend: {
260
+ sendIcon: {
427
261
  marginLeft: 4,
428
262
  padding: 4
429
- },
430
- previewImage: {
431
- width: 36,
432
- height: 36,
433
- borderRadius: 10,
434
- marginTop: 2,
435
- marginRight: 10,
436
- overflow: 'hidden'
437
263
  }
438
264
  });
439
265
  export default SendInput;