@amityco/react-native-social-uikit 4.0.0-RC9 → 4.0.0-b024948b.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 (245) hide show
  1. package/lib/commonjs/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js +1 -1
  2. package/lib/commonjs/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js.map +1 -1
  3. package/lib/commonjs/components/MediaSection/index.js +3 -3
  4. package/lib/commonjs/components/MediaSection/index.js.map +1 -1
  5. package/lib/commonjs/components/PostTypeChoiceModal/PostTypeChoiceModal.js +14 -5
  6. package/lib/commonjs/components/PostTypeChoiceModal/PostTypeChoiceModal.js.map +1 -1
  7. package/lib/commonjs/components/PostTypeChoiceModal/style.js +1 -2
  8. package/lib/commonjs/components/PostTypeChoiceModal/style.js.map +1 -1
  9. package/lib/commonjs/components/Social/PostList/index.js +1 -3
  10. package/lib/commonjs/components/Social/PostList/index.js.map +1 -1
  11. package/lib/commonjs/index.js +6 -0
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/screens/CreateLivestream/CreateLivestream.js +16 -16
  14. package/lib/commonjs/screens/CreateLivestream/CreateLivestream.js.map +1 -1
  15. package/lib/commonjs/screens/LivestreamPlayer/index.js +3 -6
  16. package/lib/commonjs/screens/LivestreamPlayer/index.js.map +1 -1
  17. package/lib/commonjs/svg/svg-xml-list.js +1 -1
  18. package/lib/commonjs/util/postTypeChecker.js.map +1 -1
  19. package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +11 -9
  20. package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
  21. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js +1 -1
  22. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js.map +1 -1
  23. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js +2 -1
  24. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js.map +1 -1
  25. package/lib/commonjs/v4/PublicApi/Elements/ButtonWithIconElement/styles.js +3 -2
  26. package/lib/commonjs/v4/PublicApi/Elements/ButtonWithIconElement/styles.js.map +1 -1
  27. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +28 -25
  28. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
  29. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js +2 -2
  30. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js.map +1 -1
  31. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js +217 -68
  32. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js.map +1 -1
  33. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js +50 -0
  34. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js.map +1 -0
  35. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js +71 -3
  36. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js.map +1 -1
  37. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js +150 -124
  38. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js.map +1 -1
  39. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js +2 -1
  40. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js.map +1 -1
  41. package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +1 -1
  42. package/lib/commonjs/v4/component/LivestreamContent/index.js +12 -12
  43. package/lib/commonjs/v4/component/LivestreamContent/index.js.map +1 -1
  44. package/lib/commonjs/v4/component/PostContent/index.js +4 -4
  45. package/lib/commonjs/v4/component/PostContent/index.js.map +1 -1
  46. package/lib/commonjs/v4/component/PostMenu/index.js +2 -2
  47. package/lib/commonjs/v4/component/PostMenu/index.js.map +1 -1
  48. package/lib/commonjs/v4/component/PreviewLink/LinkPreview.js +3 -3
  49. package/lib/commonjs/v4/component/PreviewLink/LinkPreview.js.map +1 -1
  50. package/lib/commonjs/v4/component/PreviewLink/utils.js +9 -73
  51. package/lib/commonjs/v4/component/PreviewLink/utils.js.map +1 -1
  52. package/lib/commonjs/v4/component/RenderTextWithMention/RenderTextWithMention.js +16 -9
  53. package/lib/commonjs/v4/component/RenderTextWithMention/RenderTextWithMention.js.map +1 -1
  54. package/lib/commonjs/v4/component/Toast/index.js +4 -4
  55. package/lib/commonjs/v4/component/Toast/index.js.map +1 -1
  56. package/lib/commonjs/v4/component/Toast/styles.js +2 -2
  57. package/lib/commonjs/v4/component/Toast/styles.js.map +1 -1
  58. package/lib/commonjs/v4/constants/index.js +2 -1
  59. package/lib/commonjs/v4/constants/index.js.map +1 -1
  60. package/lib/commonjs/v4/enum/roomStatus.js +14 -0
  61. package/lib/commonjs/v4/enum/roomStatus.js.map +1 -0
  62. package/lib/commonjs/v4/hook/index.js +22 -0
  63. package/lib/commonjs/v4/hook/index.js.map +1 -1
  64. package/lib/commonjs/v4/hook/useCustomRankingGlobalFeed.js +1 -3
  65. package/lib/commonjs/v4/hook/useCustomRankingGlobalFeed.js.map +1 -1
  66. package/lib/commonjs/v4/hook/usePostSubscription.js +38 -0
  67. package/lib/commonjs/v4/hook/usePostSubscription.js.map +1 -0
  68. package/lib/commonjs/v4/hook/useRoomSubscription.js +22 -0
  69. package/lib/commonjs/v4/hook/useRoomSubscription.js.map +1 -0
  70. package/lib/commonjs/v4/index.js +7 -0
  71. package/lib/commonjs/v4/index.js.map +1 -1
  72. package/lib/commonjs/v4/stores/slices/toast.js +4 -1
  73. package/lib/commonjs/v4/stores/slices/toast.js.map +1 -1
  74. package/lib/module/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js +1 -1
  75. package/lib/module/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js.map +1 -1
  76. package/lib/module/components/MediaSection/index.js +3 -3
  77. package/lib/module/components/MediaSection/index.js.map +1 -1
  78. package/lib/module/components/PostTypeChoiceModal/PostTypeChoiceModal.js +15 -8
  79. package/lib/module/components/PostTypeChoiceModal/PostTypeChoiceModal.js.map +1 -1
  80. package/lib/module/components/PostTypeChoiceModal/style.js +1 -2
  81. package/lib/module/components/PostTypeChoiceModal/style.js.map +1 -1
  82. package/lib/module/components/Social/PostList/index.js +1 -3
  83. package/lib/module/components/Social/PostList/index.js.map +1 -1
  84. package/lib/module/index.js +2 -6
  85. package/lib/module/index.js.map +1 -1
  86. package/lib/module/screens/CreateLivestream/CreateLivestream.js +17 -17
  87. package/lib/module/screens/CreateLivestream/CreateLivestream.js.map +1 -1
  88. package/lib/module/screens/LivestreamPlayer/index.js +4 -8
  89. package/lib/module/screens/LivestreamPlayer/index.js.map +1 -1
  90. package/lib/module/svg/svg-xml-list.js +1 -1
  91. package/lib/module/util/postTypeChecker.js.map +1 -1
  92. package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +11 -9
  93. package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
  94. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js +1 -1
  95. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js.map +1 -1
  96. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js +2 -1
  97. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js.map +1 -1
  98. package/lib/module/v4/PublicApi/Elements/ButtonWithIconElement/styles.js +3 -2
  99. package/lib/module/v4/PublicApi/Elements/ButtonWithIconElement/styles.js.map +1 -1
  100. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +29 -26
  101. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
  102. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js +2 -2
  103. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js.map +1 -1
  104. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js +222 -72
  105. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js.map +1 -1
  106. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js +42 -0
  107. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js.map +1 -0
  108. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js +71 -3
  109. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js.map +1 -1
  110. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js +152 -126
  111. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js.map +1 -1
  112. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js +2 -1
  113. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js.map +1 -1
  114. package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +1 -1
  115. package/lib/module/v4/component/LivestreamContent/index.js +13 -13
  116. package/lib/module/v4/component/LivestreamContent/index.js.map +1 -1
  117. package/lib/module/v4/component/PostContent/index.js +4 -4
  118. package/lib/module/v4/component/PostContent/index.js.map +1 -1
  119. package/lib/module/v4/component/PostMenu/index.js +2 -2
  120. package/lib/module/v4/component/PostMenu/index.js.map +1 -1
  121. package/lib/module/v4/component/PreviewLink/LinkPreview.js +3 -3
  122. package/lib/module/v4/component/PreviewLink/LinkPreview.js.map +1 -1
  123. package/lib/module/v4/component/PreviewLink/utils.js +9 -73
  124. package/lib/module/v4/component/PreviewLink/utils.js.map +1 -1
  125. package/lib/module/v4/component/RenderTextWithMention/RenderTextWithMention.js +17 -10
  126. package/lib/module/v4/component/RenderTextWithMention/RenderTextWithMention.js.map +1 -1
  127. package/lib/module/v4/component/Toast/index.js +4 -4
  128. package/lib/module/v4/component/Toast/index.js.map +1 -1
  129. package/lib/module/v4/component/Toast/styles.js +2 -2
  130. package/lib/module/v4/component/Toast/styles.js.map +1 -1
  131. package/lib/module/v4/constants/index.js +1 -0
  132. package/lib/module/v4/constants/index.js.map +1 -1
  133. package/lib/module/v4/enum/roomStatus.js +8 -0
  134. package/lib/module/v4/enum/roomStatus.js.map +1 -0
  135. package/lib/module/v4/hook/index.js +2 -0
  136. package/lib/module/v4/hook/index.js.map +1 -1
  137. package/lib/module/v4/hook/useCustomRankingGlobalFeed.js +1 -3
  138. package/lib/module/v4/hook/useCustomRankingGlobalFeed.js.map +1 -1
  139. package/lib/module/v4/hook/usePostSubscription.js +31 -0
  140. package/lib/module/v4/hook/usePostSubscription.js.map +1 -0
  141. package/lib/module/v4/hook/useRoomSubscription.js +15 -0
  142. package/lib/module/v4/hook/useRoomSubscription.js.map +1 -0
  143. package/lib/module/v4/index.js +1 -1
  144. package/lib/module/v4/index.js.map +1 -1
  145. package/lib/module/v4/stores/slices/toast.js +4 -1
  146. package/lib/module/v4/stores/slices/toast.js.map +1 -1
  147. package/lib/typescript/src/components/MediaSection/index.d.ts.map +1 -1
  148. package/lib/typescript/src/components/PostTypeChoiceModal/style.d.ts +1 -2
  149. package/lib/typescript/src/components/PostTypeChoiceModal/style.d.ts.map +1 -1
  150. package/lib/typescript/src/components/Social/PostList/index.d.ts +1 -3
  151. package/lib/typescript/src/components/Social/PostList/index.d.ts.map +1 -1
  152. package/lib/typescript/src/index.d.ts +2 -2
  153. package/lib/typescript/src/index.d.ts.map +1 -1
  154. package/lib/typescript/src/screens/LivestreamPlayer/index.d.ts.map +1 -1
  155. package/lib/typescript/src/util/postTypeChecker.d.ts +1 -1
  156. package/lib/typescript/src/util/postTypeChecker.d.ts.map +1 -1
  157. package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts +1 -3
  158. package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts.map +1 -1
  159. package/lib/typescript/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.d.ts +1 -0
  160. package/lib/typescript/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.d.ts.map +1 -1
  161. package/lib/typescript/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.d.ts.map +1 -1
  162. package/lib/typescript/src/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.d.ts +1 -1
  163. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.d.ts.map +1 -1
  164. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.d.ts +8 -0
  165. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.d.ts.map +1 -0
  166. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.d.ts +70 -2
  167. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.d.ts.map +1 -1
  168. package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.d.ts.map +1 -1
  169. package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.d.ts +1 -0
  170. package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.d.ts.map +1 -1
  171. package/lib/typescript/src/v4/component/LivestreamContent/index.d.ts +1 -1
  172. package/lib/typescript/src/v4/component/LivestreamContent/index.d.ts.map +1 -1
  173. package/lib/typescript/src/v4/component/PostContent/index.d.ts.map +1 -1
  174. package/lib/typescript/src/v4/component/PreviewLink/utils.d.ts +6 -1
  175. package/lib/typescript/src/v4/component/PreviewLink/utils.d.ts.map +1 -1
  176. package/lib/typescript/src/v4/component/RenderTextWithMention/RenderTextWithMention.d.ts.map +1 -1
  177. package/lib/typescript/src/v4/component/Toast/styles.d.ts +1 -1
  178. package/lib/typescript/src/v4/component/Toast/styles.d.ts.map +1 -1
  179. package/lib/typescript/src/v4/constants/index.d.ts +1 -0
  180. package/lib/typescript/src/v4/constants/index.d.ts.map +1 -1
  181. package/lib/typescript/src/v4/enum/roomStatus.d.ts +8 -0
  182. package/lib/typescript/src/v4/enum/roomStatus.d.ts.map +1 -0
  183. package/lib/typescript/src/v4/hook/index.d.ts +2 -0
  184. package/lib/typescript/src/v4/hook/index.d.ts.map +1 -1
  185. package/lib/typescript/src/v4/hook/usePendingPostQuery.d.ts +3 -0
  186. package/lib/typescript/src/v4/hook/usePendingPostQuery.d.ts.map +1 -1
  187. package/lib/typescript/src/v4/hook/usePostSubscription.d.ts +4 -0
  188. package/lib/typescript/src/v4/hook/usePostSubscription.d.ts.map +1 -0
  189. package/lib/typescript/src/v4/hook/useRoomSubscription.d.ts +4 -0
  190. package/lib/typescript/src/v4/hook/useRoomSubscription.d.ts.map +1 -0
  191. package/lib/typescript/src/v4/index.d.ts +1 -0
  192. package/lib/typescript/src/v4/index.d.ts.map +1 -1
  193. package/lib/typescript/src/v4/routes/RouteParamList.d.ts +1 -1
  194. package/lib/typescript/src/v4/routes/RouteParamList.d.ts.map +1 -1
  195. package/lib/typescript/src/v4/stores/slices/toast.d.ts +1 -0
  196. package/lib/typescript/src/v4/stores/slices/toast.d.ts.map +1 -1
  197. package/package.json +6 -3
  198. package/src/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.tsx +1 -1
  199. package/src/components/MediaSection/index.tsx +4 -6
  200. package/src/components/PostTypeChoiceModal/PostTypeChoiceModal.tsx +15 -15
  201. package/src/components/PostTypeChoiceModal/style.ts +1 -2
  202. package/src/components/Social/PostList/index.tsx +1 -4
  203. package/src/index.tsx +2 -2
  204. package/src/screens/CreateLivestream/CreateLivestream.tsx +17 -17
  205. package/src/screens/LivestreamPlayer/index.tsx +9 -15
  206. package/src/svg/svg-xml-list.ts +1 -1
  207. package/src/util/postTypeChecker.ts +1 -1
  208. package/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.tsx +10 -10
  209. package/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.tsx +1 -1
  210. package/src/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.tsx +1 -1
  211. package/src/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.tsx +1 -1
  212. package/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.ts +3 -2
  213. package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.tsx +24 -25
  214. package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.ts +2 -2
  215. package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.tsx +255 -89
  216. package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.tsx +48 -0
  217. package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.ts +72 -3
  218. package/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.tsx +205 -154
  219. package/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.ts +2 -0
  220. package/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.tsx +1 -1
  221. package/src/v4/component/LivestreamContent/index.tsx +21 -22
  222. package/src/v4/component/PostContent/index.tsx +6 -8
  223. package/src/v4/component/PostMenu/index.tsx +2 -2
  224. package/src/v4/component/PreviewLink/LinkPreview.tsx +3 -3
  225. package/src/v4/component/PreviewLink/utils.ts +9 -108
  226. package/src/v4/component/RenderTextWithMention/RenderTextWithMention.tsx +16 -10
  227. package/src/v4/component/Toast/index.tsx +1 -1
  228. package/src/v4/component/Toast/styles.ts +2 -2
  229. package/src/v4/constants/index.ts +3 -0
  230. package/src/v4/enum/roomStatus.ts +7 -0
  231. package/src/v4/hook/index.ts +2 -0
  232. package/src/v4/hook/useCustomRankingGlobalFeed.ts +1 -1
  233. package/src/v4/hook/usePostSubscription.ts +34 -0
  234. package/src/v4/hook/useRoomSubscription.ts +19 -0
  235. package/src/v4/index.tsx +1 -1
  236. package/src/v4/routes/RouteParamList.tsx +1 -1
  237. package/src/v4/stores/slices/toast.ts +5 -0
  238. package/uikit.config.json +1 -1
  239. package/lib/commonjs/v4/enum/livestreamStatus.js +0 -13
  240. package/lib/commonjs/v4/enum/livestreamStatus.js.map +0 -1
  241. package/lib/module/v4/enum/livestreamStatus.js +0 -7
  242. package/lib/module/v4/enum/livestreamStatus.js.map +0 -1
  243. package/lib/typescript/src/v4/enum/livestreamStatus.d.ts +0 -7
  244. package/lib/typescript/src/v4/enum/livestreamStatus.d.ts.map +0 -1
  245. package/src/v4/enum/livestreamStatus.ts +0 -6
@@ -2,6 +2,7 @@ import { decode } from 'html-entities';
2
2
  import { Image } from 'react-native';
3
3
 
4
4
  import { PreviewData, PreviewDataImage, Size } from './types';
5
+ import { Client } from '@amityco/ts-sdk-react-native';
5
6
 
6
7
  export const getActualImageUrl = (baseUrl: string, imageUrl?: string) => {
7
8
  let actualImageUrl = imageUrl?.trim();
@@ -54,7 +55,7 @@ export const getImageSize = (url: string) => {
54
55
 
55
56
  // Functions below use functions from the same file and mocks are not working
56
57
  /* istanbul ignore next */
57
- export const getPreviewData = async (text: string, requestTimeout = 5000) => {
58
+ export const getPreviewData = async (text: string) => {
58
59
  const previewData: PreviewData = {
59
60
  description: undefined,
60
61
  image: undefined,
@@ -77,114 +78,14 @@ export const getPreviewData = async (text: string, requestTimeout = 5000) => {
77
78
  url = 'https://' + url;
78
79
  }
79
80
 
80
- let abortControllerTimeout: number;
81
- const abortController = new AbortController();
81
+ const request = await Client.fetchLinkPreview(url);
82
82
 
83
- const request = fetch(url, {
84
- headers: {
85
- 'User-Agent':
86
- 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36',
87
- },
88
- signal: abortController.signal,
89
- });
90
-
91
- abortControllerTimeout = setTimeout(() => {
92
- abortController.abort();
93
- }, requestTimeout);
94
-
95
- const response = await request;
96
-
97
- clearTimeout(abortControllerTimeout);
98
-
99
- previewData.link = url;
100
-
101
- const contentType = response.headers.get('content-type') ?? '';
102
-
103
- if (REGEX_IMAGE_CONTENT_TYPE.test(contentType)) {
104
- const image = await getPreviewDataImage(url);
105
- previewData.image = image;
106
- return previewData;
107
- }
108
-
109
- const html = await response.text();
110
-
111
- // Some pages return undefined
112
- if (!html) return previewData;
113
-
114
- const head = html.substring(0, html.indexOf('<body'));
115
-
116
- // Get page title
117
- const title = REGEX_TITLE.exec(head);
118
- previewData.title = getHtmlEntitiesDecodedText(title?.[1]);
119
-
120
- let matches: RegExpMatchArray | null;
121
- const meta: RegExpMatchArray[] = [];
122
- while ((matches = REGEX_META.exec(head)) !== null) {
123
- // @ts-ignore
124
- meta.push([...matches]);
125
- }
126
-
127
- const metaPreviewData = meta.reduce<{
128
- description?: string;
129
- imageUrl?: string;
130
- title?: string;
131
- }>(
132
- (acc, curr) => {
133
- // Verify that we have property/name and content
134
- // Note that if a page will specify property, name and content in the same meta, regex will fail
135
- if (!curr[2] || !curr[3]) return acc;
136
-
137
- // Only take the first occurrence
138
- // For description take the meta description tag into consideration
139
- const description =
140
- !acc.description &&
141
- (getContent(curr[2], curr[3], 'og:description') ||
142
- getContent(curr[2], curr[3], 'description'));
143
- const ogImage =
144
- !acc.imageUrl && getContent(curr[2], curr[3], 'og:image');
145
- const ogTitle = !acc.title && getContent(curr[2], curr[3], 'og:title');
146
-
147
- return {
148
- description: description
149
- ? getHtmlEntitiesDecodedText(description)
150
- : acc.description,
151
- imageUrl: ogImage ? getActualImageUrl(url, ogImage) : acc.imageUrl,
152
- title: ogTitle ? getHtmlEntitiesDecodedText(ogTitle) : acc.title,
153
- };
154
- },
155
- { title: previewData.title }
156
- );
157
-
158
- previewData.description = metaPreviewData.description;
159
- previewData.image = await getPreviewDataImage(metaPreviewData.imageUrl);
160
- previewData.title = metaPreviewData.title;
161
-
162
- if (!previewData.image) {
163
- let imageMatches: RegExpMatchArray | null;
164
- const tags: RegExpMatchArray[] = [];
165
- while ((imageMatches = REGEX_IMAGE_TAG.exec(html)) !== null) {
166
- // @ts-ignore
167
- tags.push([...imageMatches]);
168
- }
169
-
170
- let images: PreviewDataImage[] = [];
171
-
172
- for (const tag of tags
173
- .filter((t) => !t[1].startsWith('data'))
174
- .slice(0, 5)) {
175
- const image = await getPreviewDataImage(getActualImageUrl(url, tag[1]));
176
-
177
- if (!image) continue;
178
-
179
- images = [...images, image];
180
- }
181
-
182
- previewData.image = images.sort(
183
- (a, b) => b.height * b.width - a.height * a.width
184
- )[0];
185
- }
186
-
187
- return previewData;
83
+ return {
84
+ description: request.description || undefined,
85
+ image: request.image || undefined,
86
+ link: url,
87
+ title: request.title || undefined,
88
+ };
188
89
  } catch {
189
90
  return previewData;
190
91
  }
@@ -1,4 +1,4 @@
1
- import { Text, Linking } from 'react-native';
1
+ import { Text, Linking, TouchableOpacity } from 'react-native';
2
2
  import { useStyles } from './styles';
3
3
  import React, { memo, useCallback } from 'react';
4
4
  import { useNavigation } from '@react-navigation/native';
@@ -6,6 +6,7 @@ import { IMentionPosition } from '../../types/type';
6
6
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
7
7
  import { RootStackParamList } from '../../routes/RouteParamList';
8
8
  import ReadMore from '@fawazahmed/react-native-read-more';
9
+ import { URL_REGEX } from '../../../v4/constants';
9
10
 
10
11
  interface IrenderTextWithMention {
11
12
  mentionPositionArr: IMentionPosition[];
@@ -28,10 +29,9 @@ const RenderTextWithMention: React.FC<IrenderTextWithMention> = ({
28
29
  const navigation =
29
30
  useNavigation() as NativeStackNavigationProp<RootStackParamList>;
30
31
  const linkArr = useCallback((text: string): LinkInfo[] => {
31
- const urlRegex = /(https?:\/\/|www\.)[^\s]+/g;
32
32
  const links: LinkInfo[] = [];
33
33
  let match;
34
- while ((match = urlRegex.exec(text)) !== null) {
34
+ while ((match = URL_REGEX.exec(text)) !== null) {
35
35
  links.push({
36
36
  link: match[0],
37
37
  index: match.index,
@@ -54,8 +54,14 @@ const RenderTextWithMention: React.FC<IrenderTextWithMention> = ({
54
54
  },
55
55
  [navigation]
56
56
  );
57
- const handleLinkClick = useCallback((url: string) => {
58
- Linking.openURL(url);
57
+ const handleLinkClick = useCallback(async (url: string) => {
58
+ try {
59
+ const hasProtocol = /^(https?|ftp|mailto):/.test(url);
60
+ const formattedUrl = hasProtocol ? url : `https://${url}`;
61
+ await Linking.openURL(formattedUrl);
62
+ } catch (error) {
63
+ console.warn('Failed to open URL:', error);
64
+ }
59
65
  }, []);
60
66
 
61
67
  const handleOnClick = useCallback(
@@ -88,14 +94,14 @@ const RenderTextWithMention: React.FC<IrenderTextWithMention> = ({
88
94
  const nonHighlightedText = textPost.slice(currentPosition, index);
89
95
  // Add highlighted text
90
96
  const highlightedText = (
91
- <Text
92
- selectable
97
+ <TouchableOpacity
93
98
  onPress={() => handleOnClick(link, userId)}
94
99
  key={`highlighted-${i}`}
95
- style={styles.mentionText}
96
100
  >
97
- {textPost.slice(index, index + length)}
98
- </Text>
101
+ <Text style={styles.mentionText} selectable>
102
+ {textPost.slice(index, index + length)}
103
+ </Text>
104
+ </TouchableOpacity>
99
105
  );
100
106
 
101
107
  // Update currentPosition for the next iteration
@@ -8,8 +8,8 @@ import { informative, failed, success } from '../../assets/icons';
8
8
  import { CircularProgressIndicator } from '../CircularProgressIndicator';
9
9
 
10
10
  const Toast = () => {
11
- const { styles, theme } = useStyles();
12
11
  const { hideToast, toast } = useToast();
12
+ const { styles, theme } = useStyles(toast.bottomPosition);
13
13
  const timeoutRef = useRef<number | null>(null);
14
14
  const fadeIn = useRef(new Animated.Value(0)).current;
15
15
 
@@ -3,7 +3,7 @@ import { useTheme } from 'react-native-paper';
3
3
  import type { MyMD3Theme } from '../../../providers/amity-ui-kit-provider';
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
5
 
6
- export const useStyles = () => {
6
+ export const useStyles = (bottomPosition: number = 16) => {
7
7
  const theme = useTheme<MyMD3Theme>();
8
8
  const { bottom } = useSafeAreaInsets();
9
9
 
@@ -13,7 +13,7 @@ export const useStyles = () => {
13
13
  zIndex: 999,
14
14
  width: '90%',
15
15
  borderRadius: 8,
16
- bottom: bottom + 16,
16
+ bottom: bottom + bottomPosition,
17
17
  paddingVertical: 16,
18
18
  alignSelf: 'center',
19
19
  flexDirection: 'row',
@@ -105,3 +105,6 @@ export const QUERY_KEY = {
105
105
  POSTS_COLLECTION: 'posts-collections',
106
106
  PINNED_POSTS_COLLECTION: 'pinned-posts-collections',
107
107
  };
108
+
109
+ export const URL_REGEX =
110
+ /(?:(?:https?|ftp):\/\/(?:[a-zA-Z0-9.-]+|[\d.]+)(?::\d{1,5})?(?:\/(?:[^\s<>|()]*(?:\([^\s<>|()]*\)[^\s<>|()]*)*)*)?|mailto:[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}|www\.(?:[a-zA-Z0-9.-]+)(?:\/(?:[^\s<>|()]*(?:\([^\s<>|()]*\)[^\s<>|()]*)*)*)?(?!\.))/g;
@@ -0,0 +1,7 @@
1
+ export const RoomStatus = {
2
+ idle: 'idle' as Amity.RoomStatus,
3
+ live: 'live' as Amity.RoomStatus,
4
+ recorded: 'recorded' as Amity.RoomStatus,
5
+ ended: 'ended' as Amity.RoomStatus,
6
+ waiting_reconnect: 'waitingReconnect' as Amity.RoomStatus,
7
+ };
@@ -30,3 +30,5 @@ export * from './usePendingPostQuery';
30
30
  export * from './useMembersQuery';
31
31
  export * from './useRolesQuery';
32
32
  export * from './useFlagUserQuery';
33
+ export * from './usePostSubscription';
34
+ export * from './useRoomSubscription';
@@ -51,7 +51,7 @@ export const useCustomRankingGlobalFeed = () => {
51
51
  if (
52
52
  data?.dataType === 'image' ||
53
53
  data?.dataType === 'video' ||
54
- // data?.dataType === 'liveStream' ||
54
+ data?.dataType === 'room' ||
55
55
  data?.dataType === 'poll'
56
56
  ) {
57
57
  resolve(post);
@@ -0,0 +1,34 @@
1
+ import { useEffect, useState } from 'react';
2
+ import {
3
+ getPostTopic,
4
+ PostRepository,
5
+ subscribeTopic,
6
+ } from '@amityco/ts-sdk-react-native';
7
+
8
+ export const usePostSubscription = (postId: string) => {
9
+ const [subscribedPost, setSubscribedPost] = useState<Amity.Post>(null);
10
+
11
+ useEffect(() => {
12
+ let unsubscribe: () => void;
13
+ if (postId) {
14
+ unsubscribe = PostRepository.getPost(postId, ({ data }) => {
15
+ setSubscribedPost(data);
16
+ });
17
+ }
18
+ return () => {
19
+ unsubscribe && unsubscribe();
20
+ };
21
+ }, [postId]);
22
+
23
+ useEffect(() => {
24
+ let unsubscribe: () => void;
25
+ if (subscribedPost) {
26
+ unsubscribe = subscribeTopic(getPostTopic(subscribedPost));
27
+ }
28
+ return () => {
29
+ unsubscribe && unsubscribe();
30
+ };
31
+ }, [subscribedPost]);
32
+
33
+ return { subscribedPost };
34
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ getRoomWatcherTopic,
3
+ subscribeTopic,
4
+ } from '@amityco/ts-sdk-react-native';
5
+ import { useEffect } from 'react';
6
+
7
+ export const useRoomSubscription = ({ room }: { room?: Amity.Room | null }) => {
8
+ useEffect(() => {
9
+ const unsubscriber: Amity.Unsubscriber[] = [];
10
+
11
+ if (room?.roomId && room?.status !== 'recorded') {
12
+ unsubscriber.push(subscribeTopic(getRoomWatcherTopic(room)));
13
+ }
14
+
15
+ return () => unsubscriber.forEach((fn) => fn());
16
+ }, [room, room?.roomId]);
17
+
18
+ return null;
19
+ };
package/src/v4/index.tsx CHANGED
@@ -11,7 +11,7 @@ export { default as AmityMyCommunitiesSearchPage } from './PublicApi/Pages/Amity
11
11
  export { default as AmityAllCategoriesPage } from './PublicApi/Pages/AmityAllCategoriesPage/AmityAllCategoriesPage';
12
12
  export { default as AmityCommunitiesByCategoryPage } from './PublicApi/Pages/AmityCommunitiesByCategoryPage/AmityCommunitiesByCategoryPage';
13
13
  export { default as AmityCommunityProfilePage } from './PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage';
14
- // export { default as AmityCreateLivestreamPage } from './PublicApi/Pages/AmityCreateLivestreamPage';
14
+ export { default as AmityCreateLivestreamPage } from './PublicApi/Pages/AmityCreateLivestreamPage';
15
15
  export { default as AmityLivestreamPostTargetSelectionPage } from './PublicApi/Pages/AmityLivestreamPostTargetSelectionPage';
16
16
  export { default as AmityLivestreamTerminatedPage } from './PublicApi/Pages/AmityLivestreamTerminatedPage';
17
17
  export { default as AmityLivestreamPlayerPage } from './PublicApi/Pages/AmityLivestreamPlayerPage';
@@ -72,7 +72,7 @@ export type RootStackParamList = {
72
72
  targetType: string;
73
73
  };
74
74
  LivestreamPlayer: {
75
- streamId: string;
75
+ roomId: string;
76
76
  post: Amity.Post;
77
77
  };
78
78
  LivestreamTerminated: {
@@ -10,12 +10,14 @@ type ToastState = {
10
10
  message: string;
11
11
  type: 'failed' | 'success' | 'informative' | 'loading';
12
12
  duration?: number;
13
+ bottomPosition?: number;
13
14
  };
14
15
  const initialState: ToastState = {
15
16
  visible: false,
16
17
  message: '',
17
18
  type: 'loading',
18
19
  duration: 2500,
20
+ bottomPosition: 16,
19
21
  };
20
22
 
21
23
  const toastSlice = createSlice({
@@ -27,12 +29,15 @@ const toastSlice = createSlice({
27
29
  state.message = action.payload.message;
28
30
  state.type = action.payload.type;
29
31
  state.duration = action.payload.duration ?? initialState.duration;
32
+ state.bottomPosition =
33
+ action.payload.bottomPosition ?? initialState.bottomPosition;
30
34
  },
31
35
  hideToast: (state) => {
32
36
  state.visible = false;
33
37
  state.message = '';
34
38
  state.type = 'loading';
35
39
  state.duration = 2500;
40
+ state.bottomPosition = 16;
36
41
  },
37
42
  },
38
43
  });
package/uikit.config.json CHANGED
@@ -287,7 +287,7 @@
287
287
  "image": "create_poll_button"
288
288
  },
289
289
  "social_home_page/create_post_menu/create_livestream_button": {
290
- "text": "Livestream",
290
+ "text": "Live stream",
291
291
  "image": "create_livestream_button"
292
292
  },
293
293
  "select_post_target_page/*/close_button": {
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.LivestreamStatus = void 0;
7
- const LivestreamStatus = exports.LivestreamStatus = {
8
- idle: 'idle',
9
- live: 'live',
10
- recorded: 'recorded',
11
- ended: 'ended'
12
- };
13
- //# sourceMappingURL=livestreamStatus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["LivestreamStatus","exports","idle","live","recorded","ended"],"sourceRoot":"../../../../src","sources":["v4/enum/livestreamStatus.ts"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC9BE,IAAI,EAAE,MAA4B;EAClCC,IAAI,EAAE,MAA4B;EAClCC,QAAQ,EAAE,UAAgC;EAC1CC,KAAK,EAAE;AACT,CAAC","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- export const LivestreamStatus = {
2
- idle: 'idle',
3
- live: 'live',
4
- recorded: 'recorded',
5
- ended: 'ended'
6
- };
7
- //# sourceMappingURL=livestreamStatus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["LivestreamStatus","idle","live","recorded","ended"],"sourceRoot":"../../../../src","sources":["v4/enum/livestreamStatus.ts"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG;EAC9BC,IAAI,EAAE,MAA4B;EAClCC,IAAI,EAAE,MAA4B;EAClCC,QAAQ,EAAE,UAAgC;EAC1CC,KAAK,EAAE;AACT,CAAC","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- export declare const LivestreamStatus: {
2
- idle: Amity.StreamStatus;
3
- live: Amity.StreamStatus;
4
- recorded: Amity.StreamStatus;
5
- ended: Amity.StreamStatus;
6
- };
7
- //# sourceMappingURL=livestreamStatus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"livestreamStatus.d.ts","sourceRoot":"","sources":["../../../../../src/v4/enum/livestreamStatus.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;UACX,KAAK,CAAC,YAAY;UAClB,KAAK,CAAC,YAAY;cACV,KAAK,CAAC,YAAY;WACxB,KAAK,CAAC,YAAY;CACrC,CAAC"}
@@ -1,6 +0,0 @@
1
- export const LivestreamStatus = {
2
- idle: 'idle' as Amity.StreamStatus,
3
- live: 'live' as Amity.StreamStatus,
4
- recorded: 'recorded' as Amity.StreamStatus,
5
- ended: 'ended' as Amity.StreamStatus,
6
- };