@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,133 @@
1
+ import React from 'react';
2
+ import { TouchableOpacity, View } from 'react-native';
3
+
4
+ import {
5
+ Icon,
6
+ ImageWithPlaceholder,
7
+ Text,
8
+ VideoThumbnail,
9
+ createStyleSheet,
10
+ useUIKitTheme,
11
+ } from '@sendbird/uikit-react-native-foundation';
12
+ import {
13
+ FileIcon,
14
+ SendbirdBaseMessage,
15
+ SendbirdFileMessage,
16
+ SendbirdUserMessage,
17
+ getFileIconFromMessageType,
18
+ getMessageType,
19
+ getThumbnailUriFromFileMessage,
20
+ } from '@sendbird/uikit-utils';
21
+
22
+ import { useLocalization, usePlatformService } from '../../hooks/useContext';
23
+
24
+ export type MessageToReplyPreviewProps = {
25
+ messageToReply?: SendbirdFileMessage | SendbirdUserMessage;
26
+ setMessageToReply?: (message?: undefined | SendbirdFileMessage | SendbirdUserMessage) => void;
27
+ };
28
+
29
+ export const MessageToReplyPreview = ({ messageToReply, setMessageToReply }: MessageToReplyPreviewProps) => {
30
+ const { colors, select, palette } = useUIKitTheme();
31
+ const { mediaService } = usePlatformService();
32
+ const { STRINGS } = useLocalization();
33
+
34
+ const getFileIconAsImage = (url: string) => {
35
+ return <ImageWithPlaceholder source={{ uri: url }} style={styles.previewImage} />;
36
+ };
37
+
38
+ const getFileIconAsVideoThumbnail = (url: string) => {
39
+ return (
40
+ <VideoThumbnail
41
+ style={styles.previewImage}
42
+ iconSize={0}
43
+ source={url}
44
+ fetchThumbnailFromVideoSource={(uri) => mediaService.getVideoThumbnail({ url: uri, timeMills: 1000 })}
45
+ />
46
+ );
47
+ };
48
+
49
+ const getFileIconAsSymbol = (icon: FileIcon) => {
50
+ return (
51
+ <Icon
52
+ icon={icon}
53
+ size={20}
54
+ color={colors.onBackground02}
55
+ containerStyle={[
56
+ styles.fileIcon,
57
+ {
58
+ backgroundColor: select({ light: palette.background100, dark: palette.background500 }),
59
+ },
60
+ ]}
61
+ />
62
+ );
63
+ };
64
+
65
+ const getFileIcon = (messageToReply: SendbirdBaseMessage) => {
66
+ if (messageToReply?.isFileMessage()) {
67
+ const messageType = getMessageType(messageToReply);
68
+ switch (messageType) {
69
+ case 'file.image':
70
+ return getFileIconAsImage(getThumbnailUriFromFileMessage(messageToReply));
71
+ case 'file.video':
72
+ return getFileIconAsVideoThumbnail(getThumbnailUriFromFileMessage(messageToReply));
73
+ case 'file.voice':
74
+ return null;
75
+ default:
76
+ return getFileIconAsSymbol(getFileIconFromMessageType(messageType));
77
+ }
78
+ }
79
+ return null;
80
+ };
81
+
82
+ if (!messageToReply) return null;
83
+
84
+ return (
85
+ <View style={[styles.messageToReplyContainer, { borderColor: colors.onBackground04 }]}>
86
+ <View style={{ flex: 1, flexDirection: 'row' }}>
87
+ {getFileIcon(messageToReply)}
88
+ <View style={{ flex: 1, flexDirection: 'column' }}>
89
+ <Text numberOfLines={1} style={{ fontSize: 13, fontWeight: '900', marginBottom: 4 }}>
90
+ {STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_TITLE(messageToReply.sender)}
91
+ </Text>
92
+ <Text numberOfLines={1} style={{ fontSize: 13, color: colors.onBackground03 }}>
93
+ {STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_BODY(messageToReply)}
94
+ </Text>
95
+ </View>
96
+ </View>
97
+ <TouchableOpacity onPress={() => setMessageToReply?.(undefined)}>
98
+ <Icon icon={'close'} size={24} color={colors.onBackground01} containerStyle={styles.closeIcon} />
99
+ </TouchableOpacity>
100
+ </View>
101
+ );
102
+ };
103
+
104
+ const styles = createStyleSheet({
105
+ previewImage: {
106
+ width: 36,
107
+ height: 36,
108
+ borderRadius: 10,
109
+ marginTop: 2,
110
+ marginRight: 10,
111
+ overflow: 'hidden',
112
+ },
113
+ messageToReplyContainer: {
114
+ flexDirection: 'row',
115
+ paddingLeft: 18,
116
+ paddingRight: 16,
117
+ paddingTop: 10,
118
+ paddingBottom: 8,
119
+ alignItems: 'center',
120
+ borderTopWidth: 1,
121
+ },
122
+ fileIcon: {
123
+ width: 36,
124
+ height: 36,
125
+ borderRadius: 10,
126
+ marginRight: 10,
127
+ marginTop: 2,
128
+ },
129
+ closeIcon: {
130
+ marginLeft: 4,
131
+ padding: 4,
132
+ },
133
+ });
@@ -1,42 +1,28 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import {
3
3
  NativeSyntheticEvent,
4
- Platform,
5
4
  TextInput as RNTextInput,
6
5
  TextInputSelectionChangeEventData,
7
6
  TouchableOpacity,
8
7
  View,
9
8
  } from 'react-native';
10
9
 
11
- import { MentionType } from '@sendbird/chat/message';
12
- import type { BottomSheetItem } from '@sendbird/uikit-react-native-foundation';
10
+ import { MentionType, MessageMetaArray } from '@sendbird/chat/message';
13
11
  import {
14
12
  Icon,
15
- ImageWithPlaceholder,
16
- Text,
13
+ Modal,
17
14
  TextInput,
18
- VideoThumbnail,
19
15
  createStyleSheet,
20
16
  useAlert,
21
17
  useBottomSheet,
22
18
  useToast,
23
19
  useUIKitTheme,
24
20
  } from '@sendbird/uikit-react-native-foundation';
25
- import {
26
- FileIcon,
27
- Logger,
28
- SendbirdBaseMessage,
29
- SendbirdChannel,
30
- getFileIconFromMessageType,
31
- getMessageType,
32
- getThumbnailUriFromFileMessage,
33
- isImage,
34
- shouldCompressImage,
35
- useIIFE,
36
- } from '@sendbird/uikit-utils';
21
+ import { Logger, useDeferredModalState, useIIFE } from '@sendbird/uikit-utils';
37
22
 
23
+ import { VOICE_MESSAGE_META_ARRAY_DURATION_KEY, VOICE_MESSAGE_META_ARRAY_MESSAGE_TYPE_KEY } from '../../constants';
24
+ import { useChannelInputItems } from '../../hooks/useChannelInputItems';
38
25
  import { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';
39
- import SBUError from '../../libs/SBUError';
40
26
  import SBUUtils from '../../libs/SBUUtils';
41
27
  import type { FileType } from '../../platform/types';
42
28
  import type { MentionedUser } from '../../types';
@@ -51,6 +37,9 @@ interface SendInputProps extends ChannelInputProps {
51
37
 
52
38
  const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
53
39
  {
40
+ style,
41
+ VoiceMessageInput,
42
+ MessageToReplyPreview,
54
43
  AttachmentsButton,
55
44
  onPressSendUserMessage,
56
45
  onPressSendFileMessage,
@@ -67,12 +56,18 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
67
56
  },
68
57
  ref,
69
58
  ) {
59
+ const { playerService, recorderService } = usePlatformService();
70
60
  const { mentionManager, sbOptions } = useSendbirdChat();
71
- const { select, colors, palette } = useUIKitTheme();
72
61
  const { STRINGS } = useLocalization();
73
62
  const { openSheet } = useBottomSheet();
74
63
  const toast = useToast();
75
- const { mediaService } = usePlatformService();
64
+
65
+ const {
66
+ onClose,
67
+ onDismiss,
68
+ visible: voiceMessageInputVisible,
69
+ setVisible: setVoiceMessageInputVisible,
70
+ } = useDeferredModalState();
76
71
 
77
72
  const messageReplyParams = useIIFE(() => {
78
73
  const { groupChannel } = sbOptions.uikit;
@@ -122,8 +117,35 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
122
117
  setMessageToReply?.();
123
118
  };
124
119
 
120
+ const sendVoiceMessage = (file: FileType, durationMills: number) => {
121
+ if (inputMuted) {
122
+ toast.show(STRINGS.TOAST.USER_MUTED_ERROR, 'error');
123
+ Logger.error(STRINGS.TOAST.USER_MUTED_ERROR);
124
+ } else if (inputFrozen) {
125
+ toast.show(STRINGS.TOAST.CHANNEL_FROZEN_ERROR, 'error');
126
+ Logger.error(STRINGS.TOAST.CHANNEL_FROZEN_ERROR);
127
+ } else {
128
+ onPressSendFileMessage({
129
+ file,
130
+ metaArrays: [
131
+ new MessageMetaArray({
132
+ key: VOICE_MESSAGE_META_ARRAY_DURATION_KEY,
133
+ value: [String(durationMills)],
134
+ }),
135
+ new MessageMetaArray({
136
+ key: VOICE_MESSAGE_META_ARRAY_MESSAGE_TYPE_KEY,
137
+ value: [`voice/${recorderService.options.extension}`],
138
+ }),
139
+ ],
140
+ ...messageReplyParams,
141
+ }).catch(onFailureToSend);
142
+ }
143
+
144
+ onChangeText('');
145
+ setMessageToReply?.();
146
+ };
147
+
125
148
  const sheetItems = useChannelInputItems(channel, sendFileMessage);
126
- const onPressAttachment = () => openSheet({ sheetItems });
127
149
 
128
150
  const getPlaceholder = () => {
129
151
  if (inputMuted) return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_MUTED;
@@ -134,90 +156,16 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
134
156
  return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_ACTIVE;
135
157
  };
136
158
 
137
- const getFileIconAsImage = (url: string) => {
138
- return <ImageWithPlaceholder source={{ uri: url }} style={styles.previewImage} />;
139
- };
140
-
141
- const getFileIconAsVideoThumbnail = (url: string) => {
142
- return (
143
- <VideoThumbnail
144
- style={styles.previewImage}
145
- iconSize={0}
146
- source={url}
147
- fetchThumbnailFromVideoSource={(uri) => mediaService.getVideoThumbnail({ url: uri, timeMills: 1000 })}
148
- />
149
- );
150
- };
151
-
152
- const getFileIconAsSymbol = (icon: FileIcon) => {
153
- return (
154
- <Icon
155
- icon={icon}
156
- size={20}
157
- color={colors.onBackground02}
158
- containerStyle={{
159
- backgroundColor: select({
160
- light: palette.background100,
161
- dark: palette.background500,
162
- }),
163
- width: 36,
164
- height: 36,
165
- borderRadius: 10,
166
- marginRight: 10,
167
- marginTop: 2,
168
- }}
169
- />
170
- );
171
- };
172
-
173
- const getFileIcon = (messageToReply: SendbirdBaseMessage) => {
174
- if (messageToReply?.isFileMessage()) {
175
- const messageType = getMessageType(messageToReply);
176
- switch (messageType) {
177
- case 'file.image':
178
- return getFileIconAsImage(getThumbnailUriFromFileMessage(messageToReply));
179
- case 'file.video':
180
- return getFileIconAsVideoThumbnail(getThumbnailUriFromFileMessage(messageToReply));
181
- default:
182
- return getFileIconAsSymbol(getFileIconFromMessageType(messageType));
183
- }
184
- }
185
- return null;
186
- };
159
+ const voiceMessageEnabled = channel.isGroupChannel() && sbOptions.uikit.groupChannel.channel.enableVoiceMessage;
160
+ const sendButtonVisible = Boolean(text.trim());
187
161
 
188
162
  return (
189
163
  <View>
190
- {messageToReply && (
191
- <View
192
- style={{
193
- flexDirection: 'row',
194
- paddingLeft: 18,
195
- paddingRight: 16,
196
- paddingTop: 10,
197
- paddingBottom: 8,
198
- alignItems: 'center',
199
- borderTopWidth: 1,
200
- borderColor: colors.onBackground04,
201
- }}
202
- >
203
- <View style={{ flex: 1, flexDirection: 'row' }}>
204
- {getFileIcon(messageToReply)}
205
- <View style={{ flex: 1, flexDirection: 'column' }}>
206
- <Text numberOfLines={1} style={{ fontSize: 13, fontWeight: '900', marginBottom: 4 }}>
207
- {STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_TITLE(messageToReply.sender)}
208
- </Text>
209
- <Text numberOfLines={1} style={{ fontSize: 13, color: colors.onBackground03 }}>
210
- {STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_BODY(messageToReply)}
211
- </Text>
212
- </View>
213
- </View>
214
- <TouchableOpacity onPress={() => setMessageToReply?.(undefined)}>
215
- <Icon icon={'close'} size={24} color={colors.onBackground01} containerStyle={styles.iconSend} />
216
- </TouchableOpacity>
217
- </View>
164
+ {MessageToReplyPreview && (
165
+ <MessageToReplyPreview messageToReply={messageToReply} setMessageToReply={setMessageToReply} />
218
166
  )}
219
167
  <View style={styles.sendInputContainer}>
220
- {AttachmentsButton && <AttachmentsButton onPress={onPressAttachment} disabled={inputDisabled} />}
168
+ {AttachmentsButton && <AttachmentsButton onPress={() => openSheet({ sheetItems })} disabled={inputDisabled} />}
221
169
  <TextInput
222
170
  ref={ref}
223
171
  multiline
@@ -225,7 +173,7 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
225
173
  onSelectionChange={onSelectionChange}
226
174
  editable={!inputDisabled}
227
175
  onChangeText={onChangeText}
228
- style={styles.input}
176
+ style={style}
229
177
  placeholder={getPlaceholder()}
230
178
  >
231
179
  {mentionManager.textToMentionedComponents(
@@ -235,229 +183,98 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
235
183
  )}
236
184
  </TextInput>
237
185
 
238
- {Boolean(text.trim()) && (
239
- <TouchableOpacity onPress={sendUserMessage} disabled={inputDisabled}>
240
- <Icon
241
- color={
242
- inputDisabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight
243
- }
244
- icon={'send'}
245
- size={24}
246
- containerStyle={styles.iconSend}
247
- />
248
- </TouchableOpacity>
186
+ {voiceMessageEnabled && (
187
+ <VoiceMessageButton
188
+ visible={!sendButtonVisible}
189
+ disabled={inputDisabled}
190
+ onPress={() => setVoiceMessageInputVisible(true)}
191
+ />
192
+ )}
193
+ <UserMessageSendButton visible={sendButtonVisible} disabled={inputDisabled} onPress={sendUserMessage} />
194
+ {voiceMessageEnabled && VoiceMessageInput && (
195
+ <Modal
196
+ disableBackgroundClose
197
+ onClose={onClose}
198
+ onDismiss={() => {
199
+ onDismiss();
200
+ Promise.allSettled([playerService.reset(), recorderService.reset()]);
201
+ }}
202
+ backgroundStyle={{ justifyContent: 'flex-end' }}
203
+ visible={voiceMessageInputVisible}
204
+ type={'slide-no-gesture'}
205
+ >
206
+ <VoiceMessageInput onClose={onClose} onSend={({ file, duration }) => sendVoiceMessage(file, duration)} />
207
+ </Modal>
249
208
  )}
250
209
  </View>
251
210
  </View>
252
211
  );
253
212
  });
254
213
 
255
- const useChannelInputItems = (channel: SendbirdChannel, sendFileMessage: (file: FileType) => void) => {
256
- const { sbOptions, imageCompressionConfig } = useSendbirdChat();
214
+ type InputButtonProps = { visible: boolean; disabled: boolean; onPress: () => void };
215
+ const VoiceMessageButton = ({ visible, disabled, onPress }: InputButtonProps) => {
257
216
  const { STRINGS } = useLocalization();
258
- const { fileService, mediaService } = usePlatformService();
259
217
  const { alert } = useAlert();
260
- const toast = useToast();
261
-
262
- const sheetItems: BottomSheetItem['sheetItems'] = [];
263
- const input = useIIFE(() => {
264
- switch (true) {
265
- case channel.isOpenChannel():
266
- return sbOptions.uikit.openChannel.channel.input;
267
- case channel.isGroupChannel():
268
- return sbOptions.uikit.groupChannel.channel.input;
269
- default:
270
- return {
271
- enableDocument: true,
272
- camera: { enablePhoto: true, enableVideo: true },
273
- gallery: { enablePhoto: true, enableVideo: true },
274
- };
218
+ const { playerService, recorderService } = usePlatformService();
219
+ const { colors } = useUIKitTheme();
220
+ if (!visible) return null;
221
+
222
+ const onPressWithPermissionCheck = async () => {
223
+ const recorderGranted = await recorderService.requestPermission();
224
+ if (!recorderGranted) {
225
+ alert({
226
+ title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
227
+ message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
228
+ STRINGS.LABELS.PERMISSION_MICROPHONE,
229
+ STRINGS.LABELS.PERMISSION_APP_NAME,
230
+ ),
231
+ buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
232
+ });
233
+ Logger.error('Failed to request permission for recorder');
234
+ return;
275
235
  }
276
- });
277
236
 
278
- if (input.camera.enablePhoto) {
279
- sheetItems.push({
280
- title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_CAMERA_PHOTO,
281
- icon: 'camera',
282
- onPress: async () => {
283
- const mediaFile = await fileService.openCamera({
284
- mediaType: 'photo',
285
- onOpenFailure: (error) => {
286
- if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
287
- alert({
288
- title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
289
- message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
290
- STRINGS.LABELS.PERMISSION_CAMERA,
291
- STRINGS.LABELS.PERMISSION_APP_NAME,
292
- ),
293
- buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
294
- });
295
- } else {
296
- toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');
297
- }
298
- },
299
- });
300
-
301
- if (mediaFile) {
302
- // Image compression
303
- if (
304
- isImage(mediaFile.uri, mediaFile.type) &&
305
- shouldCompressImage(mediaFile.type, sbOptions.chat.imageCompressionEnabled)
306
- ) {
307
- await SBUUtils.safeRun(async () => {
308
- const compressed = await mediaService.compressImage({
309
- uri: mediaFile.uri,
310
- maxWidth: imageCompressionConfig.width,
311
- maxHeight: imageCompressionConfig.height,
312
- compressionRate: imageCompressionConfig.compressionRate,
313
- });
314
-
315
- if (compressed) {
316
- mediaFile.uri = compressed.uri;
317
- mediaFile.size = compressed.size;
318
- }
319
- });
320
- }
321
-
322
- sendFileMessage(mediaFile);
323
- }
324
- },
325
- });
326
- }
327
-
328
- if (input.camera.enableVideo) {
329
- sheetItems.push({
330
- title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_CAMERA_VIDEO,
331
- icon: 'camera',
332
- onPress: async () => {
333
- const mediaFile = await fileService.openCamera({
334
- mediaType: 'video',
335
- onOpenFailure: (error) => {
336
- if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
337
- alert({
338
- title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
339
- message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
340
- STRINGS.LABELS.PERMISSION_CAMERA,
341
- STRINGS.LABELS.PERMISSION_APP_NAME,
342
- ),
343
- buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
344
- });
345
- } else {
346
- toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');
347
- }
348
- },
349
- });
350
-
351
- if (mediaFile) {
352
- sendFileMessage(mediaFile);
353
- }
354
- },
355
- });
356
- }
357
-
358
- if (input.gallery.enablePhoto || input.gallery.enableVideo) {
359
- const mediaType = (() => {
360
- switch (true) {
361
- case input.gallery.enablePhoto && input.gallery.enableVideo:
362
- return 'all';
363
- case input.gallery.enablePhoto && !input.gallery.enableVideo:
364
- return 'photo';
365
- case !input.gallery.enablePhoto && input.gallery.enableVideo:
366
- return 'video';
367
- default:
368
- return 'all';
369
- }
370
- })();
371
-
372
- sheetItems.push({
373
- title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_PHOTO_LIBRARY,
374
- icon: 'photo',
375
- onPress: async () => {
376
- const mediaFiles = await fileService.openMediaLibrary({
377
- selectionLimit: 1,
378
- mediaType,
379
- onOpenFailure: (error) => {
380
- if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
381
- alert({
382
- title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
383
- message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
384
- STRINGS.LABELS.PERMISSION_DEVICE_STORAGE,
385
- STRINGS.LABELS.PERMISSION_APP_NAME,
386
- ),
387
- buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
388
- });
389
- } else {
390
- toast.show(STRINGS.TOAST.OPEN_PHOTO_LIBRARY_ERROR, 'error');
391
- }
392
- },
393
- });
394
-
395
- if (mediaFiles && mediaFiles[0]) {
396
- const mediaFile = mediaFiles[0];
397
-
398
- // Image compression
399
- if (
400
- isImage(mediaFile.uri, mediaFile.type) &&
401
- shouldCompressImage(mediaFile.type, sbOptions.chat.imageCompressionEnabled)
402
- ) {
403
- await SBUUtils.safeRun(async () => {
404
- const compressed = await mediaService.compressImage({
405
- uri: mediaFile.uri,
406
- maxWidth: imageCompressionConfig.width,
407
- maxHeight: imageCompressionConfig.height,
408
- compressionRate: imageCompressionConfig.compressionRate,
409
- });
410
-
411
- if (compressed) {
412
- mediaFile.uri = compressed.uri;
413
- mediaFile.size = compressed.size;
414
- }
415
- });
416
- }
417
-
418
- sendFileMessage(mediaFile);
419
- }
420
- },
421
- });
422
- }
423
-
424
- if (input.enableDocument) {
425
- sheetItems.push({
426
- title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_FILES,
427
- icon: 'document',
428
- onPress: async () => {
429
- const documentFile = await fileService.openDocument({
430
- onOpenFailure: () => toast.show(STRINGS.TOAST.OPEN_FILES_ERROR, 'error'),
431
- });
432
-
433
- if (documentFile) {
434
- // Image compression
435
- if (
436
- isImage(documentFile.uri, documentFile.type) &&
437
- shouldCompressImage(documentFile.type, sbOptions.chat.imageCompressionEnabled)
438
- ) {
439
- await SBUUtils.safeRun(async () => {
440
- const compressed = await mediaService.compressImage({
441
- uri: documentFile.uri,
442
- maxWidth: imageCompressionConfig.width,
443
- maxHeight: imageCompressionConfig.height,
444
- compressionRate: imageCompressionConfig.compressionRate,
445
- });
446
-
447
- if (compressed) {
448
- documentFile.uri = compressed.uri;
449
- documentFile.size = compressed.size;
450
- }
451
- });
452
- }
237
+ const playerGranted = await playerService.requestPermission();
238
+ if (!playerGranted) {
239
+ alert({
240
+ title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
241
+ message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
242
+ STRINGS.LABELS.PERMISSION_DEVICE_STORAGE,
243
+ STRINGS.LABELS.PERMISSION_APP_NAME,
244
+ ),
245
+ buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
246
+ });
247
+ Logger.error('Failed to request permission for player');
248
+ return;
249
+ }
453
250
 
454
- sendFileMessage(documentFile);
455
- }
456
- },
457
- });
458
- }
251
+ onPress();
252
+ };
459
253
 
460
- return sheetItems;
254
+ return (
255
+ <TouchableOpacity onPress={onPressWithPermissionCheck} disabled={disabled}>
256
+ <Icon
257
+ color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}
258
+ icon={'audio-on'}
259
+ size={24}
260
+ containerStyle={styles.sendIcon}
261
+ />
262
+ </TouchableOpacity>
263
+ );
264
+ };
265
+ const UserMessageSendButton = ({ visible, disabled, onPress }: InputButtonProps) => {
266
+ const { colors } = useUIKitTheme();
267
+ if (!visible) return null;
268
+ return (
269
+ <TouchableOpacity onPress={onPress} disabled={disabled}>
270
+ <Icon
271
+ color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}
272
+ icon={'send'}
273
+ size={24}
274
+ containerStyle={styles.sendIcon}
275
+ />
276
+ </TouchableOpacity>
277
+ );
461
278
  };
462
279
 
463
280
  const styles = createStyleSheet({
@@ -467,25 +284,10 @@ const styles = createStyleSheet({
467
284
  alignItems: 'center',
468
285
  flexDirection: 'row',
469
286
  },
470
- input: {
471
- flex: 1,
472
- marginRight: 4,
473
- minHeight: 36,
474
- maxHeight: 36 * Platform.select({ ios: 2.5, default: 2 }),
475
- borderRadius: 20,
476
- },
477
- iconSend: {
287
+ sendIcon: {
478
288
  marginLeft: 4,
479
289
  padding: 4,
480
290
  },
481
- previewImage: {
482
- width: 36,
483
- height: 36,
484
- borderRadius: 10,
485
- marginTop: 2,
486
- marginRight: 10,
487
- overflow: 'hidden',
488
- },
489
291
  });
490
292
 
491
293
  export default SendInput;