@amityco/react-native-social-uikit 4.0.0-3dd1feab.0 → 4.0.0-417229c2.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 (263) 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/providers/file-provider.js +19 -38
  14. package/lib/commonjs/providers/file-provider.js.map +1 -1
  15. package/lib/commonjs/screens/CreateLivestream/CreateLivestream.js +16 -16
  16. package/lib/commonjs/screens/CreateLivestream/CreateLivestream.js.map +1 -1
  17. package/lib/commonjs/screens/LivestreamPlayer/index.js +3 -6
  18. package/lib/commonjs/screens/LivestreamPlayer/index.js.map +1 -1
  19. package/lib/commonjs/svg/svg-xml-list.js +1 -1
  20. package/lib/commonjs/util/postTypeChecker.js.map +1 -1
  21. package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +11 -9
  22. package/lib/commonjs/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
  23. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js +1 -1
  24. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js.map +1 -1
  25. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js +2 -1
  26. package/lib/commonjs/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js.map +1 -1
  27. package/lib/commonjs/v4/PublicApi/Elements/ButtonWithIconElement/styles.js +3 -2
  28. package/lib/commonjs/v4/PublicApi/Elements/ButtonWithIconElement/styles.js.map +1 -1
  29. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +28 -25
  30. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
  31. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js +2 -2
  32. package/lib/commonjs/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js.map +1 -1
  33. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js +217 -68
  34. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js.map +1 -1
  35. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js +50 -0
  36. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js.map +1 -0
  37. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js +71 -3
  38. package/lib/commonjs/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js.map +1 -1
  39. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js +150 -124
  40. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js.map +1 -1
  41. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js +2 -1
  42. package/lib/commonjs/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js.map +1 -1
  43. package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +1 -37
  44. package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js.map +1 -1
  45. package/lib/commonjs/v4/component/LivestreamContent/index.js +12 -12
  46. package/lib/commonjs/v4/component/LivestreamContent/index.js.map +1 -1
  47. package/lib/commonjs/v4/component/LoadingImage/index.js +22 -21
  48. package/lib/commonjs/v4/component/LoadingImage/index.js.map +1 -1
  49. package/lib/commonjs/v4/component/LoadingImage/styles.js +2 -19
  50. package/lib/commonjs/v4/component/LoadingImage/styles.js.map +1 -1
  51. package/lib/commonjs/v4/component/LoadingVideo/index.js +3 -11
  52. package/lib/commonjs/v4/component/LoadingVideo/index.js.map +1 -1
  53. package/lib/commonjs/v4/component/PostContent/index.js +4 -4
  54. package/lib/commonjs/v4/component/PostContent/index.js.map +1 -1
  55. package/lib/commonjs/v4/component/PostMenu/index.js +2 -2
  56. package/lib/commonjs/v4/component/PostMenu/index.js.map +1 -1
  57. package/lib/commonjs/v4/component/RenderTextWithMention/RenderTextWithMention.js +16 -9
  58. package/lib/commonjs/v4/component/RenderTextWithMention/RenderTextWithMention.js.map +1 -1
  59. package/lib/commonjs/v4/component/Toast/index.js +4 -4
  60. package/lib/commonjs/v4/component/Toast/index.js.map +1 -1
  61. package/lib/commonjs/v4/component/Toast/styles.js +2 -2
  62. package/lib/commonjs/v4/component/Toast/styles.js.map +1 -1
  63. package/lib/commonjs/v4/constants/index.js +2 -1
  64. package/lib/commonjs/v4/constants/index.js.map +1 -1
  65. package/lib/commonjs/v4/enum/roomStatus.js +14 -0
  66. package/lib/commonjs/v4/enum/roomStatus.js.map +1 -0
  67. package/lib/commonjs/v4/hook/index.js +22 -0
  68. package/lib/commonjs/v4/hook/index.js.map +1 -1
  69. package/lib/commonjs/v4/hook/useCustomRankingGlobalFeed.js +1 -3
  70. package/lib/commonjs/v4/hook/useCustomRankingGlobalFeed.js.map +1 -1
  71. package/lib/commonjs/v4/hook/usePostSubscription.js +38 -0
  72. package/lib/commonjs/v4/hook/usePostSubscription.js.map +1 -0
  73. package/lib/commonjs/v4/hook/useRoomSubscription.js +22 -0
  74. package/lib/commonjs/v4/hook/useRoomSubscription.js.map +1 -0
  75. package/lib/commonjs/v4/index.js +7 -0
  76. package/lib/commonjs/v4/index.js.map +1 -1
  77. package/lib/commonjs/v4/stores/slices/toast.js +4 -1
  78. package/lib/commonjs/v4/stores/slices/toast.js.map +1 -1
  79. package/lib/module/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js +1 -1
  80. package/lib/module/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.js.map +1 -1
  81. package/lib/module/components/MediaSection/index.js +3 -3
  82. package/lib/module/components/MediaSection/index.js.map +1 -1
  83. package/lib/module/components/PostTypeChoiceModal/PostTypeChoiceModal.js +15 -8
  84. package/lib/module/components/PostTypeChoiceModal/PostTypeChoiceModal.js.map +1 -1
  85. package/lib/module/components/PostTypeChoiceModal/style.js +1 -2
  86. package/lib/module/components/PostTypeChoiceModal/style.js.map +1 -1
  87. package/lib/module/components/Social/PostList/index.js +1 -3
  88. package/lib/module/components/Social/PostList/index.js.map +1 -1
  89. package/lib/module/index.js +2 -6
  90. package/lib/module/index.js.map +1 -1
  91. package/lib/module/providers/file-provider.js +19 -38
  92. package/lib/module/providers/file-provider.js.map +1 -1
  93. package/lib/module/screens/CreateLivestream/CreateLivestream.js +17 -17
  94. package/lib/module/screens/CreateLivestream/CreateLivestream.js.map +1 -1
  95. package/lib/module/screens/LivestreamPlayer/index.js +4 -8
  96. package/lib/module/screens/LivestreamPlayer/index.js.map +1 -1
  97. package/lib/module/svg/svg-xml-list.js +1 -1
  98. package/lib/module/util/postTypeChecker.js.map +1 -1
  99. package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js +11 -9
  100. package/lib/module/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.js.map +1 -1
  101. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js +1 -1
  102. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.js.map +1 -1
  103. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js +2 -1
  104. package/lib/module/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.js.map +1 -1
  105. package/lib/module/v4/PublicApi/Elements/ButtonWithIconElement/styles.js +3 -2
  106. package/lib/module/v4/PublicApi/Elements/ButtonWithIconElement/styles.js.map +1 -1
  107. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js +29 -26
  108. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.js.map +1 -1
  109. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js +2 -2
  110. package/lib/module/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.js.map +1 -1
  111. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js +222 -72
  112. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.js.map +1 -1
  113. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js +42 -0
  114. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.js.map +1 -0
  115. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js +71 -3
  116. package/lib/module/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.js.map +1 -1
  117. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js +152 -126
  118. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.js.map +1 -1
  119. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js +2 -1
  120. package/lib/module/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.js.map +1 -1
  121. package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +1 -37
  122. package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js.map +1 -1
  123. package/lib/module/v4/component/LivestreamContent/index.js +13 -13
  124. package/lib/module/v4/component/LivestreamContent/index.js.map +1 -1
  125. package/lib/module/v4/component/LoadingImage/index.js +21 -21
  126. package/lib/module/v4/component/LoadingImage/index.js.map +1 -1
  127. package/lib/module/v4/component/LoadingImage/styles.js +2 -19
  128. package/lib/module/v4/component/LoadingImage/styles.js.map +1 -1
  129. package/lib/module/v4/component/LoadingVideo/index.js +3 -11
  130. package/lib/module/v4/component/LoadingVideo/index.js.map +1 -1
  131. package/lib/module/v4/component/PostContent/index.js +4 -4
  132. package/lib/module/v4/component/PostContent/index.js.map +1 -1
  133. package/lib/module/v4/component/PostMenu/index.js +2 -2
  134. package/lib/module/v4/component/PostMenu/index.js.map +1 -1
  135. package/lib/module/v4/component/RenderTextWithMention/RenderTextWithMention.js +17 -10
  136. package/lib/module/v4/component/RenderTextWithMention/RenderTextWithMention.js.map +1 -1
  137. package/lib/module/v4/component/Toast/index.js +4 -4
  138. package/lib/module/v4/component/Toast/index.js.map +1 -1
  139. package/lib/module/v4/component/Toast/styles.js +2 -2
  140. package/lib/module/v4/component/Toast/styles.js.map +1 -1
  141. package/lib/module/v4/constants/index.js +1 -0
  142. package/lib/module/v4/constants/index.js.map +1 -1
  143. package/lib/module/v4/enum/roomStatus.js +8 -0
  144. package/lib/module/v4/enum/roomStatus.js.map +1 -0
  145. package/lib/module/v4/hook/index.js +2 -0
  146. package/lib/module/v4/hook/index.js.map +1 -1
  147. package/lib/module/v4/hook/useCustomRankingGlobalFeed.js +1 -3
  148. package/lib/module/v4/hook/useCustomRankingGlobalFeed.js.map +1 -1
  149. package/lib/module/v4/hook/usePostSubscription.js +31 -0
  150. package/lib/module/v4/hook/usePostSubscription.js.map +1 -0
  151. package/lib/module/v4/hook/useRoomSubscription.js +15 -0
  152. package/lib/module/v4/hook/useRoomSubscription.js.map +1 -0
  153. package/lib/module/v4/index.js +1 -1
  154. package/lib/module/v4/index.js.map +1 -1
  155. package/lib/module/v4/stores/slices/toast.js +4 -1
  156. package/lib/module/v4/stores/slices/toast.js.map +1 -1
  157. package/lib/typescript/src/components/MediaSection/index.d.ts.map +1 -1
  158. package/lib/typescript/src/components/PostTypeChoiceModal/style.d.ts +1 -2
  159. package/lib/typescript/src/components/PostTypeChoiceModal/style.d.ts.map +1 -1
  160. package/lib/typescript/src/components/Social/PostList/index.d.ts +1 -3
  161. package/lib/typescript/src/components/Social/PostList/index.d.ts.map +1 -1
  162. package/lib/typescript/src/index.d.ts +2 -2
  163. package/lib/typescript/src/index.d.ts.map +1 -1
  164. package/lib/typescript/src/providers/file-provider.d.ts.map +1 -1
  165. package/lib/typescript/src/screens/LivestreamPlayer/index.d.ts.map +1 -1
  166. package/lib/typescript/src/util/postTypeChecker.d.ts +1 -1
  167. package/lib/typescript/src/util/postTypeChecker.d.ts.map +1 -1
  168. package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts +1 -3
  169. package/lib/typescript/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.d.ts.map +1 -1
  170. package/lib/typescript/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.d.ts +1 -0
  171. package/lib/typescript/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.d.ts.map +1 -1
  172. package/lib/typescript/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.d.ts.map +1 -1
  173. package/lib/typescript/src/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.d.ts +1 -1
  174. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.d.ts.map +1 -1
  175. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.d.ts +8 -0
  176. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.d.ts.map +1 -0
  177. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.d.ts +70 -2
  178. package/lib/typescript/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.d.ts.map +1 -1
  179. package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.d.ts.map +1 -1
  180. package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.d.ts +1 -0
  181. package/lib/typescript/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.d.ts.map +1 -1
  182. package/lib/typescript/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.d.ts.map +1 -1
  183. package/lib/typescript/src/v4/component/LivestreamContent/index.d.ts +1 -1
  184. package/lib/typescript/src/v4/component/LivestreamContent/index.d.ts.map +1 -1
  185. package/lib/typescript/src/v4/component/LoadingImage/index.d.ts +1 -2
  186. package/lib/typescript/src/v4/component/LoadingImage/index.d.ts.map +1 -1
  187. package/lib/typescript/src/v4/component/LoadingImage/styles.d.ts +0 -21
  188. package/lib/typescript/src/v4/component/LoadingImage/styles.d.ts.map +1 -1
  189. package/lib/typescript/src/v4/component/LoadingVideo/index.d.ts +1 -2
  190. package/lib/typescript/src/v4/component/LoadingVideo/index.d.ts.map +1 -1
  191. package/lib/typescript/src/v4/component/PostContent/index.d.ts.map +1 -1
  192. package/lib/typescript/src/v4/component/RenderTextWithMention/RenderTextWithMention.d.ts.map +1 -1
  193. package/lib/typescript/src/v4/component/Toast/styles.d.ts +1 -1
  194. package/lib/typescript/src/v4/component/Toast/styles.d.ts.map +1 -1
  195. package/lib/typescript/src/v4/constants/index.d.ts +1 -0
  196. package/lib/typescript/src/v4/constants/index.d.ts.map +1 -1
  197. package/lib/typescript/src/v4/enum/roomStatus.d.ts +8 -0
  198. package/lib/typescript/src/v4/enum/roomStatus.d.ts.map +1 -0
  199. package/lib/typescript/src/v4/hook/index.d.ts +2 -0
  200. package/lib/typescript/src/v4/hook/index.d.ts.map +1 -1
  201. package/lib/typescript/src/v4/hook/usePendingPostQuery.d.ts +3 -0
  202. package/lib/typescript/src/v4/hook/usePendingPostQuery.d.ts.map +1 -1
  203. package/lib/typescript/src/v4/hook/usePostSubscription.d.ts +4 -0
  204. package/lib/typescript/src/v4/hook/usePostSubscription.d.ts.map +1 -0
  205. package/lib/typescript/src/v4/hook/useRoomSubscription.d.ts +4 -0
  206. package/lib/typescript/src/v4/hook/useRoomSubscription.d.ts.map +1 -0
  207. package/lib/typescript/src/v4/index.d.ts +1 -0
  208. package/lib/typescript/src/v4/index.d.ts.map +1 -1
  209. package/lib/typescript/src/v4/routes/RouteParamList.d.ts +1 -1
  210. package/lib/typescript/src/v4/routes/RouteParamList.d.ts.map +1 -1
  211. package/lib/typescript/src/v4/stores/slices/toast.d.ts +1 -0
  212. package/lib/typescript/src/v4/stores/slices/toast.d.ts.map +1 -1
  213. package/package.json +6 -3
  214. package/src/components/CreatePostChooseTargetModal/CreatePostChooseTargetModal.tsx +1 -1
  215. package/src/components/MediaSection/index.tsx +4 -6
  216. package/src/components/PostTypeChoiceModal/PostTypeChoiceModal.tsx +15 -15
  217. package/src/components/PostTypeChoiceModal/style.ts +1 -2
  218. package/src/components/Social/PostList/index.tsx +1 -4
  219. package/src/index.tsx +2 -2
  220. package/src/providers/file-provider.tsx +20 -42
  221. package/src/screens/CreateLivestream/CreateLivestream.tsx +17 -17
  222. package/src/screens/LivestreamPlayer/index.tsx +9 -15
  223. package/src/svg/svg-xml-list.ts +1 -1
  224. package/src/util/postTypeChecker.ts +1 -1
  225. package/src/v4/PublicApi/Components/AmityCreatePostMenuComponent/AmityCreatePostMenuComponent.tsx +10 -10
  226. package/src/v4/PublicApi/Components/AmityPostContentComponent/AmityPostContentComponent.tsx +1 -1
  227. package/src/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/DetailStyle.tsx +1 -1
  228. package/src/v4/PublicApi/Components/AmityPostEngagementActionsComponent/Components/FeedStyle.tsx +1 -1
  229. package/src/v4/PublicApi/Elements/ButtonWithIconElement/styles.ts +3 -2
  230. package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/AmityCommunityProfilePage.tsx +24 -25
  231. package/src/v4/PublicApi/Pages/AmityCommunityProfilePage/styles.ts +2 -2
  232. package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/AmityCreateLivestreamPage.tsx +255 -89
  233. package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/RoomView.tsx +48 -0
  234. package/src/v4/PublicApi/Pages/AmityCreateLivestreamPage/styles.ts +72 -3
  235. package/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/AmityLivestreamPlayerPage.tsx +205 -154
  236. package/src/v4/PublicApi/Pages/AmityLivestreamPlayerPage/styles.ts +2 -0
  237. package/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.tsx +0 -46
  238. package/src/v4/component/LivestreamContent/index.tsx +21 -22
  239. package/src/v4/component/LoadingImage/index.tsx +22 -28
  240. package/src/v4/component/LoadingImage/styles.ts +0 -17
  241. package/src/v4/component/LoadingVideo/index.tsx +3 -12
  242. package/src/v4/component/PostContent/index.tsx +6 -8
  243. package/src/v4/component/PostMenu/index.tsx +2 -2
  244. package/src/v4/component/RenderTextWithMention/RenderTextWithMention.tsx +16 -10
  245. package/src/v4/component/Toast/index.tsx +1 -1
  246. package/src/v4/component/Toast/styles.ts +2 -2
  247. package/src/v4/constants/index.ts +3 -0
  248. package/src/v4/enum/roomStatus.ts +7 -0
  249. package/src/v4/hook/index.ts +2 -0
  250. package/src/v4/hook/useCustomRankingGlobalFeed.ts +1 -1
  251. package/src/v4/hook/usePostSubscription.ts +34 -0
  252. package/src/v4/hook/useRoomSubscription.ts +19 -0
  253. package/src/v4/index.tsx +1 -1
  254. package/src/v4/routes/RouteParamList.tsx +1 -1
  255. package/src/v4/stores/slices/toast.ts +5 -0
  256. package/uikit.config.json +1 -1
  257. package/lib/commonjs/v4/enum/livestreamStatus.js +0 -13
  258. package/lib/commonjs/v4/enum/livestreamStatus.js.map +0 -1
  259. package/lib/module/v4/enum/livestreamStatus.js +0 -7
  260. package/lib/module/v4/enum/livestreamStatus.js.map +0 -1
  261. package/lib/typescript/src/v4/enum/livestreamStatus.d.ts +0 -7
  262. package/lib/typescript/src/v4/enum/livestreamStatus.d.ts.map +0 -1
  263. package/src/v4/enum/livestreamStatus.ts +0 -6
@@ -6,6 +6,7 @@ export const useStyle = (themeStyle: MyMD3Theme) => {
6
6
  container: {
7
7
  display: 'flex',
8
8
  flexDirection: 'row',
9
+ alignItems: 'center',
9
10
  width: 200,
10
11
  paddingTop: 12,
11
12
  paddingBottom: 12,
@@ -13,8 +14,8 @@ export const useStyle = (themeStyle: MyMD3Theme) => {
13
14
  gap: 12,
14
15
  },
15
16
  icon: {
16
- width: 20,
17
- height: 20,
17
+ width: 24,
18
+ height: 24,
18
19
  tintColor: themeStyle.colors.base,
19
20
  },
20
21
  label: {
@@ -35,8 +35,7 @@ import { RootStackParamList } from '../../../routes/RouteParamList';
35
35
  import CommunityCreatePostButton from '../../../elements/CommunityCreatePostButton/CommunityCreatePostButton';
36
36
  import { SvgXml } from 'react-native-svg';
37
37
  import { useBehaviour } from '../../../../v4/providers/BehaviourProvider';
38
-
39
- import { poll, post, story } from '../../../../v4/assets/icons';
38
+ import { livestream, poll, post, story } from '../../../../v4/assets/icons';
40
39
  import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';
41
40
 
42
41
  import { useTheme } from 'react-native-paper';
@@ -265,7 +264,7 @@ function CommunityProfileActions({ pageId, communityId, styles }) {
265
264
  AmityPostTargetSelectionPageBehavior,
266
265
  AmityPollTargetSelectionPageBehavior,
267
266
  AmityStoryTargetSelectionPageBehavior,
268
- // AmityLivestreamPostTargetSelectionPageBehavior,
267
+ AmityLivestreamPostTargetSelectionPageBehavior,
269
268
  } = useBehaviour();
270
269
  const navigation =
271
270
  useNavigation<
@@ -311,26 +310,26 @@ function CommunityProfileActions({ pageId, communityId, styles }) {
311
310
  });
312
311
  };
313
312
 
314
- // const handleCreateLivestream = () => {
315
- // closeBottomSheet();
316
-
317
- // if (
318
- // AmityLivestreamPostTargetSelectionPageBehavior.goToCreateLivestreamPage
319
- // ) {
320
- // return AmityLivestreamPostTargetSelectionPageBehavior.goToCreateLivestreamPage(
321
- // {
322
- // targetId: communityId,
323
- // targetType: 'community',
324
- // targetName: community?.displayName,
325
- // }
326
- // );
327
- // }
328
- // navigation.navigate('CreateLivestream', {
329
- // targetId: communityId,
330
- // targetType: 'community',
331
- // targetName: community?.displayName,
332
- // });
333
- // };
313
+ const handleCreateLivestream = () => {
314
+ closeBottomSheet();
315
+
316
+ if (
317
+ AmityLivestreamPostTargetSelectionPageBehavior.goToCreateLivestreamPage
318
+ ) {
319
+ return AmityLivestreamPostTargetSelectionPageBehavior.goToCreateLivestreamPage(
320
+ {
321
+ targetId: communityId,
322
+ targetType: 'community',
323
+ targetName: community?.displayName,
324
+ }
325
+ );
326
+ }
327
+ navigation.navigate('CreateLivestream', {
328
+ targetId: communityId,
329
+ targetType: 'community',
330
+ targetName: community?.displayName,
331
+ });
332
+ };
334
333
 
335
334
  const handleCreatePoll = () => {
336
335
  closeBottomSheet();
@@ -398,7 +397,7 @@ function CommunityProfileActions({ pageId, communityId, styles }) {
398
397
  <SvgXml width={24} height={24} xml={poll()} color={colors.base} />
399
398
  <Text style={styles.bottomSheetOptionText}>Poll</Text>
400
399
  </TouchableOpacity>
401
- {/* <TouchableOpacity
400
+ <TouchableOpacity
402
401
  onPress={handleCreateLivestream}
403
402
  style={styles.bottomSheetOption}
404
403
  >
@@ -409,7 +408,7 @@ function CommunityProfileActions({ pageId, communityId, styles }) {
409
408
  color={colors.base}
410
409
  />
411
410
  <Text style={styles.bottomSheetOptionText}>Livestream</Text>
412
- </TouchableOpacity> */}
411
+ </TouchableOpacity>
413
412
  </Animated.View>
414
413
  </Pressable>
415
414
  </Modal>
@@ -41,7 +41,7 @@ export const useStyles = (theme: MyMD3Theme) => {
41
41
  backgroundColor: theme.colors.background,
42
42
  borderTopLeftRadius: 20,
43
43
  borderTopRightRadius: 20,
44
- padding: 10,
44
+ paddingHorizontal: 16,
45
45
  minHeight: 200,
46
46
  paddingBottom: insets.bottom + 10,
47
47
  },
@@ -57,7 +57,7 @@ export const useStyles = (theme: MyMD3Theme) => {
57
57
  flexDirection: 'row',
58
58
  alignItems: 'center',
59
59
  paddingVertical: 16,
60
- paddingHorizontal: 16,
60
+ paddingHorizontal: 0,
61
61
  },
62
62
  bottomSheetOptionText: {
63
63
  fontSize: 16,
@@ -1,10 +1,4 @@
1
- import React, {
2
- useCallback,
3
- useEffect,
4
- useLayoutEffect,
5
- useRef,
6
- useState,
7
- } from 'react';
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
8
2
  import {
9
3
  Alert,
10
4
  Image,
@@ -12,20 +6,15 @@ import {
12
6
  Platform,
13
7
  TextInput,
14
8
  TouchableOpacity,
15
- // Linking,
16
9
  View,
17
10
  ImageStyle,
11
+ Linking,
18
12
  } from 'react-native';
19
13
  import { useStyles } from './styles';
20
14
  import { SafeAreaView } from 'react-native-safe-area-context';
21
- // import {
22
- // AmityStreamBroadcasterState,
23
- // AmityVideoBroadcaster,
24
- // // @ts-ignore
25
- // } from '@amityco/video-broadcaster-react-native';
26
15
  import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';
27
16
  import useImagePicker from '../../../../v4/hook/useImagePicker';
28
- import { arrowDown } from '../../../../v4/assets/icons';
17
+ import { arrowDown, close } from '../../../../v4/assets/icons';
29
18
  import { SvgXml } from 'react-native-svg';
30
19
  import { Typography } from '../../../component/Typography/Typography';
31
20
  import { useTheme } from 'react-native-paper';
@@ -33,12 +22,12 @@ import { MyMD3Theme } from '../../../../providers/amity-ui-kit-provider';
33
22
  import { useBottomSheet } from '../../../../redux/slices/bottomSheetSlice';
34
23
  import { CircularProgressIndicator } from '../../../component/CircularProgressIndicator';
35
24
  import { RootStackParamList } from '../../../../v4/routes/RouteParamList';
36
- import { PostRepository, StreamRepository } from '@amityco/ts-sdk-react-native';
25
+ import { PostRepository, RoomRepository } from '@amityco/ts-sdk-react-native';
37
26
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
38
- // import Button from '../../../component/Button/Button';
27
+ import Button from '../../../component/Button/Button';
39
28
  import { useRequestPermission } from '../../../../v4/hook/useCamera';
40
29
  import NetInfo from '@react-native-community/netinfo';
41
- import { LivestreamStatus } from '../../../enum/livestreamStatus';
30
+ import { RoomStatus } from '../../../enum/roomStatus';
42
31
  import { AmityThumbnailActionComponent } from '../../Components/AmityThumbnailActionComponent';
43
32
  import { StartLivestreamButton } from '../../../elements/StartLivestreamButton';
44
33
  import { PageID } from '../../../enum';
@@ -47,6 +36,18 @@ import { CancelCreateLivestreamButton } from '../../../elements/CancelCreateLive
47
36
  import { EndLiveStreamButton } from '../../../elements/EndLiveStreamButton';
48
37
  import { AddThumbnailButton } from '../../../elements/AddThumbnailButton';
49
38
  import { SwitchCameraButton } from '../../../elements/SwitchCameraButton';
39
+ import { Track, LocalVideoTrack } from 'livekit-client';
40
+ import { LiveKitRoom, registerGlobals } from '@livekit/react-native';
41
+ import { RoomView } from './RoomView';
42
+ import { Camera, useCameraDevice } from 'react-native-vision-camera';
43
+ import { useRoomSubscription } from '../../../../v4/hook/useRoomSubscription';
44
+ import { useToast } from '../../../../v4/stores/slices/toast';
45
+ import { usePostSubscription } from '../../../../v4/hook';
46
+
47
+ // Register WebRTC globals required for LiveKit
48
+ registerGlobals();
49
+
50
+ const serverUrl = 'wss://sp-live-3tr59jrk.livekit.cloud';
50
51
 
51
52
  const calculateTime = (time: number) => {
52
53
  const hours = Math.floor(time / 3600000);
@@ -64,7 +65,6 @@ const calculateTime = (time: number) => {
64
65
 
65
66
  function AmityCreateLivestreamPage() {
66
67
  const styles = useStyles();
67
- const streamRef = useRef<any>(null);
68
68
  const navigation =
69
69
  useNavigation<NativeStackNavigationProp<RootStackParamList>>();
70
70
  const theme = useTheme<MyMD3Theme>();
@@ -75,15 +75,31 @@ function AmityCreateLivestreamPage() {
75
75
  const [isLive, setIsLive] = useState<boolean>(false);
76
76
  const [description, setDescription] = useState<string>('');
77
77
  const [isEnding, setIsEnding] = useState<boolean>(false);
78
+ const [countdown, setCountdown] = useState<number | null>(null);
78
79
  const [post, setPost] = useState<Amity.Post | null>(null);
79
- const [stream, setStream] = useState<Amity.Stream | null>(null);
80
- const [timer] = useState<number | null>(null);
80
+ const [room, setRoom] = useState<Amity.Room | null>(null);
81
+ const timerRef = useRef<number | null>(null);
81
82
  const [isConnecting, setIsConnecting] = useState<boolean>(false);
82
83
  const [androidPermission, setAndroidPermission] = useState<boolean>(false);
83
84
  const [iOSPermission, setIOSPermission] = useState<boolean>(true);
84
85
  const [reconnecting, setReconnecting] = useState<boolean>(false);
86
+ const [livekitParticipant, setLivekitParticipant] = useState<any>(null);
87
+ const [isFrontCamera, setIsFrontCamera] = useState<boolean>(true);
88
+ const [roomToken, setRoomToken] = useState<Amity.BroadcasterData | null>(
89
+ null
90
+ );
85
91
  const unsubscribeRef = useRef<Amity.Unsubscriber>(null);
86
92
 
93
+ useRoomSubscription({ room });
94
+
95
+ const { subscribedPost } = usePostSubscription(post?.postId || '');
96
+
97
+ const { showToast } = useToast();
98
+
99
+ const frontCamera = useCameraDevice('front');
100
+ const backCamera = useCameraDevice('back');
101
+ const cameraDevice = isFrontCamera ? frontCamera : backCamera;
102
+
87
103
  const {
88
104
  imageUri,
89
105
  isLoading,
@@ -100,6 +116,43 @@ function AmityCreateLivestreamPage() {
100
116
  (Platform.OS === 'android' && androidPermission) ||
101
117
  (Platform.OS === 'ios' && iOSPermission);
102
118
 
119
+ const fourHours = 4 * 60 * 60 * 1000; // 4 hours
120
+ const countdownStart = fourHours - 10 * 1000; // Start countdown 10 seconds before end
121
+ const toastTriggerTime = fourHours - 3 * 60 * 1000; // Show toast 3 minutes before end
122
+
123
+ const switchCamera = useCallback(async () => {
124
+ if (isLive && livekitParticipant) {
125
+ try {
126
+ const cameraPublication = livekitParticipant.getTrackPublication(
127
+ Track.Source.Camera
128
+ );
129
+
130
+ if (cameraPublication?.track) {
131
+ const videoTrack = cameraPublication.track as LocalVideoTrack;
132
+
133
+ // Stop current camera
134
+ await videoTrack.stop();
135
+
136
+ // Get new facing mode
137
+ const newFacingMode = isFrontCamera ? 'environment' : 'user';
138
+
139
+ // Restart camera with new facing mode
140
+ await videoTrack.restartTrack({
141
+ facingMode: newFacingMode,
142
+ });
143
+
144
+ // Toggle the camera state
145
+ setIsFrontCamera((prev) => !prev);
146
+ }
147
+ } catch (error) {
148
+ console.error('Failed to switch camera:', error);
149
+ }
150
+ } else {
151
+ // Just toggle the camera state for preview
152
+ setIsFrontCamera((prev) => !prev);
153
+ }
154
+ }, [livekitParticipant, isFrontCamera, isLive]);
155
+
103
156
  useRequestPermission({
104
157
  shouldCall: Platform.OS === 'ios',
105
158
  onRequestPermissionFailed: (callback?: () => void) => {
@@ -156,37 +209,54 @@ function AmityCreateLivestreamPage() {
156
209
  setIsLive(true);
157
210
  setIsConnecting(true);
158
211
 
159
- const { data: newStream } = await StreamRepository.createStream({
212
+ const { data: newStream } = await RoomRepository.createRoom({
160
213
  title,
161
214
  description: description || undefined,
162
215
  thumbnailFileId: uploadedImage?.fileId,
216
+ type: 'coHosts',
163
217
  });
164
218
 
219
+ setRoom(newStream);
220
+
165
221
  if (newStream) {
222
+ const roomTokenResponse = await RoomRepository.getBroadcasterData(
223
+ newStream.roomId
224
+ );
225
+
226
+ setRoomToken(roomTokenResponse);
227
+
166
228
  const params = {
167
229
  targetId,
168
230
  targetType,
169
- dataType: 'liveStream' as Amity.PostContentType,
231
+ dataType: 'room' as Amity.PostContentType,
170
232
  data: {
171
233
  text: `${newStream.title}${
172
234
  newStream.description ? `\n\n${newStream.description}` : ''
173
235
  }`,
174
- streamId: newStream.streamId,
236
+ roomId: newStream.roomId,
175
237
  },
176
238
  };
177
239
 
178
240
  const newPost = await PostRepository.createPost(params);
179
241
 
180
- streamRef.current = StreamRepository.getStreamById(
181
- newStream.streamId,
182
- ({ data }) => {
183
- setStream(data);
184
- setPost(newPost.data);
185
- streamRef?.current?.startPublish(newStream.streamId);
186
- }
187
- );
242
+ setPost(newPost.data);
243
+
244
+ // Set isConnecting to false since LiveKit room is already connected
245
+ setIsConnecting(false);
246
+
247
+ // Start the timer when live stream actually starts
248
+ if (timerRef.current) {
249
+ clearInterval(timerRef.current);
250
+ }
251
+
252
+ const intervalId = setInterval(() => {
253
+ setTime((prev) => prev + 1000);
254
+ }, 1000);
255
+
256
+ timerRef.current = intervalId;
188
257
  }
189
258
  } catch (error) {
259
+ console.log('startLiveStream error', error);
190
260
  setIsLive(false);
191
261
  setIsConnecting(false);
192
262
  Alert.alert(
@@ -201,17 +271,6 @@ function AmityCreateLivestreamPage() {
201
271
  }
202
272
  };
203
273
 
204
- // const onBroadcastStateChange = (state: AmityStreamBroadcasterState) => {
205
- // if (state === AmityStreamBroadcasterState.CONNECTED) {
206
- // setIsConnecting(false);
207
- // setReconnecting(false);
208
- // const intervalId = setInterval(() => {
209
- // setTime((prev) => prev + 1000);
210
- // }, 1000);
211
- // setTimer(intervalId);
212
- // }
213
- // };
214
-
215
274
  const confirmEndStreamAlert = () => {
216
275
  Alert.alert(
217
276
  'End live stream?',
@@ -234,21 +293,22 @@ function AmityCreateLivestreamPage() {
234
293
 
235
294
  const endLiveStream = useCallback(
236
295
  async (showEndPopup = false) => {
237
- if (stream) {
296
+ if (room) {
238
297
  setIsEnding(true);
239
298
  try {
240
- await StreamRepository.disposeStream(stream.streamId);
299
+ await RoomRepository.stopRoom(room.roomId);
241
300
  } catch (e) {
242
301
  console.log('disposeStream error', e);
243
302
  } finally {
244
- streamRef?.current.stopPublish();
245
-
246
303
  setIsLive(false);
247
- setStream(null);
304
+ setRoom(null);
248
305
  setTitle('');
249
306
  setDescription('');
250
307
  setTime(0);
251
- clearInterval(timer);
308
+ if (timerRef.current) {
309
+ clearInterval(timerRef.current);
310
+ timerRef.current = null;
311
+ }
252
312
  setIsEnding(false);
253
313
  setReconnecting(false);
254
314
 
@@ -259,15 +319,40 @@ function AmityCreateLivestreamPage() {
259
319
  }
260
320
  }
261
321
  },
262
- [post, stream, timer, navigation]
322
+ [post, room, navigation]
263
323
  );
264
324
 
265
325
  useEffect(() => {
266
- const fourHours = 4 * 60 * 60 * 1000;
267
- if (streamRef.current && stream && time >= fourHours) {
326
+ // Show toast when 3 minutes left
327
+ if (room && time >= toastTriggerTime && time < toastTriggerTime + 1000) {
328
+ showToast({
329
+ type: 'informative',
330
+ message:
331
+ 'Your live will automatically end once it reaches 4-hour limit.',
332
+ duration: 3000,
333
+ bottomPosition: 96,
334
+ });
335
+ }
336
+
337
+ if (room && time >= fourHours) {
268
338
  endLiveStream(true);
339
+ setCountdown(null);
340
+ } else if (room && time >= countdownStart && time < fourHours) {
341
+ // Calculate countdown from 10 to 0
342
+ const remaining = Math.ceil((fourHours - time) / 1000);
343
+ setCountdown(remaining);
344
+ } else {
345
+ setCountdown(null);
269
346
  }
270
- }, [endLiveStream, stream, time]);
347
+ }, [
348
+ endLiveStream,
349
+ room,
350
+ time,
351
+ showToast,
352
+ toastTriggerTime,
353
+ fourHours,
354
+ countdownStart,
355
+ ]);
271
356
 
272
357
  useEffect(() => {
273
358
  if (Platform.OS === 'android') checkPermissionAndroid();
@@ -284,48 +369,45 @@ function AmityCreateLivestreamPage() {
284
369
  return () => unsubscribe();
285
370
  }, []);
286
371
 
287
- useLayoutEffect(() => {
288
- setTimeout(() => {
289
- streamRef.current && streamRef.current.switchCamera();
290
- }, 300);
291
- }, [streamRef]);
292
-
293
372
  useEffect(() => {
294
373
  let threeMinutesTimeout: number;
295
374
 
296
- if (reconnecting && stream && stream?.status === 'live') {
375
+ if (reconnecting && room && room?.status === RoomStatus.live) {
297
376
  threeMinutesTimeout = setTimeout(() => {
298
377
  endLiveStream();
299
378
  }, 1000 * 60 * 3);
300
379
  }
301
380
 
302
- if (
303
- !reconnecting &&
304
- stream &&
305
- stream?.status === 'live' &&
306
- streamRef?.current
307
- ) {
308
- streamRef?.current?.startPublish(stream?.streamId);
309
-
381
+ if (!reconnecting && room && room?.status === RoomStatus.live) {
310
382
  if (threeMinutesTimeout) {
311
383
  clearTimeout(threeMinutesTimeout);
312
384
  threeMinutesTimeout = null;
313
385
  }
314
386
  }
315
- }, [reconnecting, endLiveStream, stream]);
387
+ }, [reconnecting, endLiveStream, room]);
316
388
 
317
389
  useEffect(() => {
318
390
  const isTerminated =
319
- stream?.moderation?.terminateLabels &&
320
- stream?.moderation?.terminateLabels?.length > 0;
391
+ room?.moderation?.terminateLabels &&
392
+ room?.moderation?.terminateLabels?.length > 0;
321
393
  const isLiveOrEnded =
322
- stream?.status === LivestreamStatus.live ||
323
- stream?.status === LivestreamStatus.ended;
394
+ room?.status === RoomStatus.live || room?.status === RoomStatus.ended;
324
395
 
325
396
  if (isLiveOrEnded && isTerminated) {
326
397
  navigation.replace('LivestreamTerminated', { type: 'streamer' });
327
398
  }
328
- }, [stream?.moderation?.terminateLabels, stream?.status, navigation]);
399
+ }, [room?.moderation?.terminateLabels, room?.status, navigation]);
400
+
401
+ useEffect(() => {
402
+ if (room?.isDeleted || subscribedPost?.isDeleted) {
403
+ navigation.replace('PostDetail', { postId: subscribedPost?.postId });
404
+ }
405
+ }, [
406
+ navigation,
407
+ room?.isDeleted,
408
+ subscribedPost?.postId,
409
+ subscribedPost?.isDeleted,
410
+ ]);
329
411
 
330
412
  useEffect(() => {
331
413
  const unsubscribe = unsubscribeRef.current;
@@ -345,17 +427,53 @@ function AmityCreateLivestreamPage() {
345
427
  style={[styles.overlay, !hasPermission && styles.noPermissionOverlay]}
346
428
  />
347
429
  )}
348
- {/* {hasPermission ? (
349
- <View style={styles.cameraContainer}>
350
- <View style={styles.camera}>
351
- <AmityVideoBroadcaster
352
- ref={streamRef}
353
- bitrate={2 * 1024 * 1024}
354
- onBroadcastStateChange={onBroadcastStateChange}
355
- resolution={{ width: 1280, height: 720 }}
356
- />
430
+
431
+ {/* Preview camera part */}
432
+
433
+ {hasPermission ? (
434
+ roomToken ? (
435
+ <LiveKitRoom
436
+ serverUrl={serverUrl}
437
+ token={roomToken.coHostToken}
438
+ connect={true}
439
+ options={{
440
+ adaptiveStream: { pixelDensity: 'screen' },
441
+ }}
442
+ audio={{
443
+ echoCancellation: true,
444
+ noiseSuppression: true,
445
+ autoGainControl: true,
446
+ }}
447
+ video={{
448
+ facingMode: isFrontCamera ? 'user' : 'environment',
449
+ }}
450
+ onConnected={() => {
451
+ setIsConnecting(false);
452
+ setReconnecting(false);
453
+ }}
454
+ >
455
+ <View style={styles.cameraContainer}>
456
+ <View style={styles.camera}>
457
+ <RoomView
458
+ onLocalParticipantReady={setLivekitParticipant}
459
+ isFrontCamera={isFrontCamera}
460
+ />
461
+ </View>
462
+ </View>
463
+ </LiveKitRoom>
464
+ ) : (
465
+ <View style={styles.cameraContainer}>
466
+ <View style={styles.camera}>
467
+ {cameraDevice && (
468
+ <Camera
469
+ style={{ flex: 1 }}
470
+ device={cameraDevice}
471
+ isActive={true}
472
+ />
473
+ )}
474
+ </View>
357
475
  </View>
358
- </View>
476
+ )
359
477
  ) : (
360
478
  <View style={styles.permission}>
361
479
  <Typography.TitleBold style={styles.permissionTitle}>
@@ -374,7 +492,8 @@ function AmityCreateLivestreamPage() {
374
492
  </Typography.BodyBold>
375
493
  </Button>
376
494
  </View>
377
- )} */}
495
+ )}
496
+
378
497
  {isEnding && (
379
498
  <View style={styles.connecting}>
380
499
  <CircularProgressIndicator size={40} strokeWidth={2} />
@@ -406,12 +525,46 @@ function AmityCreateLivestreamPage() {
406
525
  </Typography.Caption>
407
526
  </View>
408
527
  )}
528
+
529
+ <TouchableOpacity
530
+ style={styles.closeButton}
531
+ onPress={() => confirmEndStreamAlert()}
532
+ >
533
+ <SvgXml
534
+ xml={close()}
535
+ width="28"
536
+ height="28"
537
+ color={theme.colors.background}
538
+ />
539
+ </TouchableOpacity>
540
+
409
541
  <View style={styles.timer}>
410
542
  <LiveTimerStatus
411
543
  time={calculateTime(time)}
412
544
  pageId={PageID.create_livestream_page}
413
545
  />
414
546
  </View>
547
+ {countdown !== null && (
548
+ <View style={styles.countdownOverlay}>
549
+ <View style={styles.countdownContainer}>
550
+ <Typography.TitleBold style={styles.countdownText}>
551
+ Live stream ends in
552
+ </Typography.TitleBold>
553
+ <View style={styles.countdownCircle}>
554
+ <CircularProgressIndicator
555
+ size={64}
556
+ strokeWidth={2}
557
+ progress={((10 - countdown) / 10) * 100}
558
+ />
559
+ <View style={styles.countdownNumberContainer}>
560
+ <Typography.Title style={styles.countdownNumber}>
561
+ {countdown}
562
+ </Typography.Title>
563
+ </View>
564
+ </View>
565
+ </View>
566
+ </View>
567
+ )}
415
568
  </>
416
569
  )
417
570
  ) : (
@@ -443,7 +596,18 @@ function AmityCreateLivestreamPage() {
443
596
  />
444
597
  <TouchableOpacity
445
598
  style={styles.communityButton}
446
- onPress={() => navigation.goBack()}
599
+ onPress={() => {
600
+ const state = navigation.getState();
601
+ const routes = state.routes;
602
+ const currentIndex = state.index;
603
+ const previousRoute = routes[currentIndex - 1];
604
+
605
+ if (previousRoute?.name === 'LivestreamPostTargetSelection') {
606
+ navigation.goBack();
607
+ } else {
608
+ return;
609
+ }
610
+ }}
447
611
  activeOpacity={0.7}
448
612
  >
449
613
  <Typography.Body
@@ -452,7 +616,11 @@ function AmityCreateLivestreamPage() {
452
616
  ellipsizeMode="tail"
453
617
  >
454
618
  Live on{' '}
455
- <Typography.BodyBold numberOfLines={1} ellipsizeMode="tail">
619
+ <Typography.BodyBold
620
+ numberOfLines={1}
621
+ ellipsizeMode="tail"
622
+ style={styles.communityName}
623
+ >
456
624
  {targetName}
457
625
  </Typography.BodyBold>
458
626
  </Typography.Body>
@@ -567,9 +735,7 @@ function AmityCreateLivestreamPage() {
567
735
  )}
568
736
  <SwitchCameraButton
569
737
  pageId={PageID.create_livestream_page}
570
- onPress={() => {
571
- streamRef.current && streamRef.current.switchCamera();
572
- }}
738
+ onPress={switchCamera}
573
739
  />
574
740
  </View>
575
741
  </SafeAreaView>