@amityco/react-native-social-uikit 4.1.1-fe2678f6.0 → 4.2.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.
- package/README.md +7 -0
- package/lib/commonjs/core/assets/icons/post.js +1 -1
- package/lib/commonjs/core/assets/icons/post.js.map +1 -1
- package/lib/commonjs/core/assets/icons/story.js +1 -1
- package/lib/commonjs/core/assets/icons/story.js.map +1 -1
- package/lib/commonjs/core/assets/icons/xml.js +16 -2
- package/lib/commonjs/core/assets/icons/xml.js.map +1 -1
- package/lib/commonjs/core/legacy/file.js +145 -62
- package/lib/commonjs/core/legacy/file.js.map +1 -1
- package/lib/commonjs/core/stores/slices/feedSlice.js +3 -0
- package/lib/commonjs/core/stores/slices/feedSlice.js.map +1 -1
- package/lib/commonjs/core/stores/slices/globalfeedSlice.js +5 -0
- package/lib/commonjs/core/stores/slices/globalfeedSlice.js.map +1 -1
- package/lib/commonjs/core/stores/slices/localVideoThumbnailSlice.js +46 -0
- package/lib/commonjs/core/stores/slices/localVideoThumbnailSlice.js.map +1 -0
- package/lib/commonjs/core/stores/slices/uiSlice.js +5 -1
- package/lib/commonjs/core/stores/slices/uiSlice.js.map +1 -1
- package/lib/commonjs/core/stores/store/index.js +3 -1
- package/lib/commonjs/core/stores/store/index.js.map +1 -1
- package/lib/commonjs/social/components/LoadingImage/index.js +73 -12
- package/lib/commonjs/social/components/LoadingImage/index.js.map +1 -1
- package/lib/commonjs/social/components/LoadingImage/styles.js +8 -3
- package/lib/commonjs/social/components/LoadingImage/styles.js.map +1 -1
- package/lib/commonjs/social/components/LoadingVideo/index.js +90 -16
- package/lib/commonjs/social/components/LoadingVideo/index.js.map +1 -1
- package/lib/commonjs/social/components/LoadingVideo/styles.js +14 -5
- package/lib/commonjs/social/components/LoadingVideo/styles.js.map +1 -1
- package/lib/commonjs/social/components/MediaViewer/MediaViewer.js +13 -13
- package/lib/commonjs/social/components/MediaViewer/MediaViewer.js.map +1 -1
- package/lib/commonjs/social/components/MediaViewer/styles.js +11 -1
- package/lib/commonjs/social/components/MediaViewer/styles.js.map +1 -1
- package/lib/commonjs/social/components/PostContent/index.js +8 -29
- package/lib/commonjs/social/components/PostContent/index.js.map +1 -1
- package/lib/commonjs/social/components/SelectedMediaComponent/SelectedMediaComponent.js +109 -17
- package/lib/commonjs/social/components/SelectedMediaComponent/SelectedMediaComponent.js.map +1 -1
- package/lib/commonjs/social/components/legacy/LoadingVideo/index.js +17 -6
- package/lib/commonjs/social/components/legacy/LoadingVideo/index.js.map +1 -1
- package/lib/commonjs/social/elements/PostMediaElement/PostMediaElement.js +121 -23
- package/lib/commonjs/social/elements/PostMediaElement/PostMediaElement.js.map +1 -1
- package/lib/commonjs/social/elements/PostMediaElement/styles.js +7 -0
- package/lib/commonjs/social/elements/PostMediaElement/styles.js.map +1 -1
- package/lib/commonjs/social/features/community/PendingRequest/components/PendingPostList/PendingPostList.js +11 -5
- package/lib/commonjs/social/features/community/PendingRequest/components/PendingPostList/PendingPostList.js.map +1 -1
- package/lib/commonjs/social/features/feed/components/NewsFeed/NewsFeed.js +14 -0
- package/lib/commonjs/social/features/feed/components/NewsFeed/NewsFeed.js.map +1 -1
- package/lib/commonjs/social/features/post/Composer/PostComposer.js +234 -86
- package/lib/commonjs/social/features/post/Composer/PostComposer.js.map +1 -1
- package/lib/commonjs/social/hooks/index.js +11 -0
- package/lib/commonjs/social/hooks/index.js.map +1 -1
- package/lib/commonjs/social/hooks/useCommunities.js +5 -3
- package/lib/commonjs/social/hooks/useCommunities.js.map +1 -1
- package/lib/commonjs/social/hooks/useCommunityPermission.js +43 -0
- package/lib/commonjs/social/hooks/useCommunityPermission.js.map +1 -0
- package/lib/commonjs/social/hooks/useCustomRankingGlobalFeed.js +10 -1
- package/lib/commonjs/social/hooks/useCustomRankingGlobalFeed.js.map +1 -1
- package/lib/commonjs/social/hooks/useFile.js +11 -0
- package/lib/commonjs/social/hooks/useFile.js.map +1 -1
- package/lib/commonjs/social/screens/CommunityProfile/components/Header/Header.js +18 -7
- package/lib/commonjs/social/screens/CommunityProfile/components/Header/Header.js.map +1 -1
- package/lib/commonjs/social/utils/mediaAttachments.js +150 -0
- package/lib/commonjs/social/utils/mediaAttachments.js.map +1 -0
- package/lib/commonjs/social/utils/postChildren.js +72 -0
- package/lib/commonjs/social/utils/postChildren.js.map +1 -0
- package/lib/module/core/assets/icons/post.js +1 -1
- package/lib/module/core/assets/icons/post.js.map +1 -1
- package/lib/module/core/assets/icons/story.js +1 -1
- package/lib/module/core/assets/icons/story.js.map +1 -1
- package/lib/module/core/assets/icons/xml.js +13 -0
- package/lib/module/core/assets/icons/xml.js.map +1 -1
- package/lib/module/core/legacy/file.js +145 -62
- package/lib/module/core/legacy/file.js.map +1 -1
- package/lib/module/core/stores/slices/feedSlice.js +3 -0
- package/lib/module/core/stores/slices/feedSlice.js.map +1 -1
- package/lib/module/core/stores/slices/globalfeedSlice.js +5 -0
- package/lib/module/core/stores/slices/globalfeedSlice.js.map +1 -1
- package/lib/module/core/stores/slices/localVideoThumbnailSlice.js +41 -0
- package/lib/module/core/stores/slices/localVideoThumbnailSlice.js.map +1 -0
- package/lib/module/core/stores/slices/uiSlice.js +5 -1
- package/lib/module/core/stores/slices/uiSlice.js.map +1 -1
- package/lib/module/core/stores/store/index.js +3 -1
- package/lib/module/core/stores/store/index.js.map +1 -1
- package/lib/module/social/components/LoadingImage/index.js +74 -14
- package/lib/module/social/components/LoadingImage/index.js.map +1 -1
- package/lib/module/social/components/LoadingImage/styles.js +8 -3
- package/lib/module/social/components/LoadingImage/styles.js.map +1 -1
- package/lib/module/social/components/LoadingVideo/index.js +91 -17
- package/lib/module/social/components/LoadingVideo/index.js.map +1 -1
- package/lib/module/social/components/LoadingVideo/styles.js +14 -5
- package/lib/module/social/components/LoadingVideo/styles.js.map +1 -1
- package/lib/module/social/components/MediaViewer/MediaViewer.js +13 -13
- package/lib/module/social/components/MediaViewer/MediaViewer.js.map +1 -1
- package/lib/module/social/components/MediaViewer/styles.js +11 -1
- package/lib/module/social/components/MediaViewer/styles.js.map +1 -1
- package/lib/module/social/components/PostContent/index.js +8 -29
- package/lib/module/social/components/PostContent/index.js.map +1 -1
- package/lib/module/social/components/SelectedMediaComponent/SelectedMediaComponent.js +110 -18
- package/lib/module/social/components/SelectedMediaComponent/SelectedMediaComponent.js.map +1 -1
- package/lib/module/social/components/legacy/LoadingVideo/index.js +17 -6
- package/lib/module/social/components/legacy/LoadingVideo/index.js.map +1 -1
- package/lib/module/social/elements/PostMediaElement/PostMediaElement.js +123 -25
- package/lib/module/social/elements/PostMediaElement/PostMediaElement.js.map +1 -1
- package/lib/module/social/elements/PostMediaElement/styles.js +7 -0
- package/lib/module/social/elements/PostMediaElement/styles.js.map +1 -1
- package/lib/module/social/features/community/PendingRequest/components/PendingPostList/PendingPostList.js +12 -6
- package/lib/module/social/features/community/PendingRequest/components/PendingPostList/PendingPostList.js.map +1 -1
- package/lib/module/social/features/feed/components/NewsFeed/NewsFeed.js +15 -1
- package/lib/module/social/features/feed/components/NewsFeed/NewsFeed.js.map +1 -1
- package/lib/module/social/features/post/Composer/PostComposer.js +236 -89
- package/lib/module/social/features/post/Composer/PostComposer.js.map +1 -1
- package/lib/module/social/hooks/index.js +1 -0
- package/lib/module/social/hooks/index.js.map +1 -1
- package/lib/module/social/hooks/useCommunities.js +5 -3
- package/lib/module/social/hooks/useCommunities.js.map +1 -1
- package/lib/module/social/hooks/useCommunityPermission.js +37 -0
- package/lib/module/social/hooks/useCommunityPermission.js.map +1 -0
- package/lib/module/social/hooks/useCustomRankingGlobalFeed.js +10 -1
- package/lib/module/social/hooks/useCustomRankingGlobalFeed.js.map +1 -1
- package/lib/module/social/hooks/useFile.js +11 -0
- package/lib/module/social/hooks/useFile.js.map +1 -1
- package/lib/module/social/screens/CommunityProfile/components/Header/Header.js +19 -8
- package/lib/module/social/screens/CommunityProfile/components/Header/Header.js.map +1 -1
- package/lib/module/social/utils/mediaAttachments.js +139 -0
- package/lib/module/social/utils/mediaAttachments.js.map +1 -0
- package/lib/module/social/utils/postChildren.js +66 -0
- package/lib/module/social/utils/postChildren.js.map +1 -0
- package/lib/typescript/core/assets/icons/xml.d.ts +1 -0
- package/lib/typescript/core/assets/icons/xml.d.ts.map +1 -1
- package/lib/typescript/core/legacy/file.d.ts +32 -0
- package/lib/typescript/core/legacy/file.d.ts.map +1 -1
- package/lib/typescript/core/stores/slices/feedSlice.d.ts.map +1 -1
- package/lib/typescript/core/stores/slices/globalfeedSlice.d.ts.map +1 -1
- package/lib/typescript/core/stores/slices/localVideoThumbnailSlice.d.ts +35 -0
- package/lib/typescript/core/stores/slices/localVideoThumbnailSlice.d.ts.map +1 -0
- package/lib/typescript/core/stores/slices/uiSlice.d.ts +5 -0
- package/lib/typescript/core/stores/slices/uiSlice.d.ts.map +1 -1
- package/lib/typescript/core/stores/store/index.d.ts.map +1 -1
- package/lib/typescript/core/types/mention.d.ts +34 -0
- package/lib/typescript/core/types/mention.d.ts.map +1 -1
- package/lib/typescript/social/components/LoadingImage/index.d.ts +8 -2
- package/lib/typescript/social/components/LoadingImage/index.d.ts.map +1 -1
- package/lib/typescript/social/components/LoadingImage/styles.d.ts.map +1 -1
- package/lib/typescript/social/components/LoadingVideo/index.d.ts +9 -2
- package/lib/typescript/social/components/LoadingVideo/index.d.ts.map +1 -1
- package/lib/typescript/social/components/LoadingVideo/styles.d.ts +1 -0
- package/lib/typescript/social/components/LoadingVideo/styles.d.ts.map +1 -1
- package/lib/typescript/social/components/MediaViewer/MediaViewer.d.ts.map +1 -1
- package/lib/typescript/social/components/MediaViewer/styles.d.ts +1 -0
- package/lib/typescript/social/components/MediaViewer/styles.d.ts.map +1 -1
- package/lib/typescript/social/components/PostContent/index.d.ts.map +1 -1
- package/lib/typescript/social/components/SelectedMediaComponent/SelectedMediaComponent.d.ts +2 -2
- package/lib/typescript/social/components/SelectedMediaComponent/SelectedMediaComponent.d.ts.map +1 -1
- package/lib/typescript/social/components/legacy/LoadingVideo/index.d.ts.map +1 -1
- package/lib/typescript/social/elements/PostMediaElement/PostMediaElement.d.ts.map +1 -1
- package/lib/typescript/social/elements/PostMediaElement/styles.d.ts +4 -0
- package/lib/typescript/social/elements/PostMediaElement/styles.d.ts.map +1 -1
- package/lib/typescript/social/features/community/PendingRequest/components/PendingPostList/PendingPostList.d.ts.map +1 -1
- package/lib/typescript/social/features/feed/components/NewsFeed/NewsFeed.d.ts.map +1 -1
- package/lib/typescript/social/features/post/Composer/PostComposer.d.ts.map +1 -1
- package/lib/typescript/social/hooks/index.d.ts +1 -0
- package/lib/typescript/social/hooks/index.d.ts.map +1 -1
- package/lib/typescript/social/hooks/useCommunities.d.ts +2 -1
- package/lib/typescript/social/hooks/useCommunities.d.ts.map +1 -1
- package/lib/typescript/social/hooks/useCommunityPermission.d.ts +14 -0
- package/lib/typescript/social/hooks/useCommunityPermission.d.ts.map +1 -0
- package/lib/typescript/social/hooks/useCustomRankingGlobalFeed.d.ts.map +1 -1
- package/lib/typescript/social/hooks/useFile.d.ts +11 -0
- package/lib/typescript/social/hooks/useFile.d.ts.map +1 -1
- package/lib/typescript/social/screens/CommunityProfile/components/Header/Header.d.ts.map +1 -1
- package/lib/typescript/social/utils/mediaAttachments.d.ts +91 -0
- package/lib/typescript/social/utils/mediaAttachments.d.ts.map +1 -0
- package/lib/typescript/social/utils/postChildren.d.ts +38 -0
- package/lib/typescript/social/utils/postChildren.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/core/assets/icons/post.tsx +1 -1
- package/src/core/assets/icons/story.tsx +1 -1
- package/src/core/assets/icons/xml.ts +15 -0
- package/src/core/legacy/file.tsx +169 -84
- package/src/core/stores/slices/feedSlice.ts +3 -0
- package/src/core/stores/slices/globalfeedSlice.ts +5 -0
- package/src/core/stores/slices/localVideoThumbnailSlice.ts +58 -0
- package/src/core/stores/slices/uiSlice.ts +8 -0
- package/src/core/stores/store/index.ts +2 -0
- package/src/core/types/mention.ts +34 -0
- package/src/social/components/LoadingImage/index.tsx +81 -12
- package/src/social/components/LoadingImage/styles.ts +8 -3
- package/src/social/components/LoadingVideo/index.tsx +111 -21
- package/src/social/components/LoadingVideo/styles.ts +13 -4
- package/src/social/components/MediaViewer/MediaViewer.tsx +11 -12
- package/src/social/components/MediaViewer/styles.ts +9 -1
- package/src/social/components/PostContent/index.tsx +3 -35
- package/src/social/components/SelectedMediaComponent/SelectedMediaComponent.tsx +103 -13
- package/src/social/components/legacy/LoadingVideo/index.tsx +26 -15
- package/src/social/elements/PostMediaElement/PostMediaElement.tsx +139 -29
- package/src/social/elements/PostMediaElement/styles.ts +7 -0
- package/src/social/features/community/PendingRequest/components/PendingPostList/PendingPostList.tsx +11 -6
- package/src/social/features/feed/components/NewsFeed/NewsFeed.tsx +16 -1
- package/src/social/features/post/Composer/PostComposer.tsx +304 -91
- package/src/social/hooks/index.ts +1 -0
- package/src/social/hooks/useCommunities.ts +4 -2
- package/src/social/hooks/useCommunityPermission.ts +40 -0
- package/src/social/hooks/useCustomRankingGlobalFeed.ts +8 -1
- package/src/social/hooks/useFile.ts +11 -0
- package/src/social/screens/CommunityProfile/components/Header/Header.tsx +19 -10
- package/src/social/utils/mediaAttachments.ts +158 -0
- package/src/social/utils/postChildren.ts +85 -0
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _netinfo = _interopRequireDefault(require("@react-native-community/netinfo"));
|
|
8
9
|
var _reactNative = require("react-native");
|
|
9
10
|
var Progress = _interopRequireWildcard(require("react-native-progress"));
|
|
10
11
|
var _reactNativeSvg = require("react-native-svg");
|
|
@@ -12,6 +13,7 @@ var _file = require("../../../core/legacy/file");
|
|
|
12
13
|
var _xml = require("../../../core/assets/icons/xml");
|
|
13
14
|
var _styles = require("./styles");
|
|
14
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
17
|
const LoadingImage = ({
|
|
16
18
|
source,
|
|
17
19
|
onClose,
|
|
@@ -19,11 +21,12 @@ const LoadingImage = ({
|
|
|
19
21
|
onLoadFinish,
|
|
20
22
|
onUploadError,
|
|
21
23
|
isUploaded = false,
|
|
24
|
+
displayUri,
|
|
22
25
|
fileId = '',
|
|
23
26
|
isEditMode = false,
|
|
24
27
|
fileCount,
|
|
25
28
|
postId,
|
|
26
|
-
|
|
29
|
+
onUploadingChange,
|
|
27
30
|
carousel = false
|
|
28
31
|
}) => {
|
|
29
32
|
const [loading, setLoading] = (0, _react.useState)(true);
|
|
@@ -33,16 +36,33 @@ const LoadingImage = ({
|
|
|
33
36
|
const styles = (0, _styles.useStyles)();
|
|
34
37
|
const handleLoadEnd = (0, _react.useCallback)(() => {
|
|
35
38
|
setLoading(false);
|
|
36
|
-
|
|
37
|
-
}, [
|
|
39
|
+
onUploadingChange === null || onUploadingChange === void 0 || onUploadingChange(false, source);
|
|
40
|
+
}, [onUploadingChange, source]);
|
|
38
41
|
(0, _react.useEffect)(() => {
|
|
39
42
|
if (progress === 100) {
|
|
40
43
|
setIsProcess(true);
|
|
41
44
|
}
|
|
42
45
|
}, [progress]);
|
|
43
46
|
const uploadFileToAmity = (0, _react.useCallback)(async () => {
|
|
44
|
-
|
|
47
|
+
onUploadingChange === null || onUploadingChange === void 0 || onUploadingChange(true, source);
|
|
45
48
|
setIsUploadError(false);
|
|
49
|
+
// A retry re-enters this function with `loading` already false — the failed
|
|
50
|
+
// attempt's `handleLoadEnd` cleared it and nothing ever set it back, so
|
|
51
|
+
// `setLoading` only ever ran downwards in this component. The frame then
|
|
52
|
+
// re-uploaded with no spinner at all, which reads as "finished instantly"
|
|
53
|
+
// while Post stays disabled for the length of the upload.
|
|
54
|
+
// Progress and the processing flag are stale from the failed attempt too,
|
|
55
|
+
// so reset the whole visual upload state here rather than only in the
|
|
56
|
+
// mount effect, which does not re-run on a retry.
|
|
57
|
+
setLoading(true);
|
|
58
|
+
setProgress(0);
|
|
59
|
+
setIsProcess(false);
|
|
60
|
+
// Clearing the local flag alone left this source inside the parent's
|
|
61
|
+
// `imageErrors` set, and that set is otherwise only cleared by the
|
|
62
|
+
// mount effect below — which does not re-run on a retry, since neither
|
|
63
|
+
// `isUploaded` nor `source` changed. Post stayed disabled even after the
|
|
64
|
+
// retry uploaded fine, so tell the parent the error is gone up front.
|
|
65
|
+
onUploadError === null || onUploadError === void 0 || onUploadError(false, source);
|
|
46
66
|
try {
|
|
47
67
|
const file = await (0, _file.uploadImageFile)(source, percent => {
|
|
48
68
|
setProgress(percent);
|
|
@@ -53,7 +73,8 @@ const LoadingImage = ({
|
|
|
53
73
|
handleLoadEnd();
|
|
54
74
|
onLoadFinish && onLoadFinish((_file$ = file[0]) === null || _file$ === void 0 ? void 0 : _file$.fileId, ((_file$2 = file[0]) === null || _file$2 === void 0 ? void 0 : _file$2.fileUrl) + '?size=medium', (_file$3 = file[0]) === null || _file$3 === void 0 ? void 0 : _file$3.attributes.name, index, source);
|
|
55
75
|
} else {
|
|
56
|
-
|
|
76
|
+
// `handleLoadEnd` already reports the upload as finished — the extra
|
|
77
|
+
// setter call it used to be paired with was redundant.
|
|
57
78
|
handleLoadEnd();
|
|
58
79
|
setIsProcess(false);
|
|
59
80
|
setIsUploadError(true);
|
|
@@ -62,11 +83,34 @@ const LoadingImage = ({
|
|
|
62
83
|
} catch (error) {
|
|
63
84
|
handleLoadEnd();
|
|
64
85
|
setIsProcess(false);
|
|
65
|
-
setIsUploading(false);
|
|
66
86
|
setIsUploadError(true);
|
|
67
87
|
onUploadError === null || onUploadError === void 0 || onUploadError(true, source);
|
|
68
88
|
}
|
|
69
|
-
}, [handleLoadEnd, index, onLoadFinish, onUploadError,
|
|
89
|
+
}, [handleLoadEnd, index, onLoadFinish, onUploadError, onUploadingChange, source]);
|
|
90
|
+
|
|
91
|
+
// The frame is expected to end up uploaded, and Post enabled, once
|
|
92
|
+
// connectivity returns. Nothing retried on its own —
|
|
93
|
+
// the error key only cleared on a manual tap on that specific frame, and the
|
|
94
|
+
// peek carousel can leave a failed frame off-screen entirely, so Post stayed
|
|
95
|
+
// disabled with no visible cause. Retry when the device regains a
|
|
96
|
+
// connection, using the same NetInfo listener idiom as post Detail and the
|
|
97
|
+
// livestream screens.
|
|
98
|
+
//
|
|
99
|
+
// Gated on a disconnected -> connected transition, not merely on being
|
|
100
|
+
// connected: addEventListener fires immediately with the current state, so a
|
|
101
|
+
// failure that happened while online (a server error, say) would otherwise
|
|
102
|
+
// re-fire on every resubscribe and spin.
|
|
103
|
+
const wasDisconnectedRef = (0, _react.useRef)(false);
|
|
104
|
+
(0, _react.useEffect)(() => {
|
|
105
|
+
const unsubscribe = _netinfo.default.addEventListener(state => {
|
|
106
|
+
const isConnected = !!state.isConnected;
|
|
107
|
+
if (isConnected && wasDisconnectedRef.current && isUploadError) {
|
|
108
|
+
uploadFileToAmity();
|
|
109
|
+
}
|
|
110
|
+
wasDisconnectedRef.current = !isConnected;
|
|
111
|
+
});
|
|
112
|
+
return () => unsubscribe();
|
|
113
|
+
}, [isUploadError, uploadFileToAmity]);
|
|
70
114
|
const handleDelete = async () => {
|
|
71
115
|
if (fileId && !isEditMode) {
|
|
72
116
|
await (0, _file.deleteAmityFile)(fileId);
|
|
@@ -84,6 +128,17 @@ const LoadingImage = ({
|
|
|
84
128
|
uploadFileToAmity();
|
|
85
129
|
}
|
|
86
130
|
}, [isUploaded, source]);
|
|
131
|
+
|
|
132
|
+
// A frame can be removed (or its source swapped) while its upload is still
|
|
133
|
+
// in flight, in which case `handleLoadEnd` never runs and the composer would
|
|
134
|
+
// keep waiting on an entry no mounted child owns any more — leaving Post
|
|
135
|
+
// disabled forever. Clearing it from this cleanup keeps the
|
|
136
|
+
// bookkeeping in the same component that added it.
|
|
137
|
+
(0, _react.useEffect)(() => {
|
|
138
|
+
return () => {
|
|
139
|
+
onUploadingChange === null || onUploadingChange === void 0 || onUploadingChange(false, source);
|
|
140
|
+
};
|
|
141
|
+
}, [onUploadingChange, source]);
|
|
87
142
|
const onRetryUpload = () => {
|
|
88
143
|
uploadFileToAmity();
|
|
89
144
|
};
|
|
@@ -91,7 +146,7 @@ const LoadingImage = ({
|
|
|
91
146
|
style: carousel ? styles.carouselContainer : fileCount >= 3 ? styles.image3XContainer : styles.container
|
|
92
147
|
}, /*#__PURE__*/React.createElement(_reactNative.Image, {
|
|
93
148
|
source: {
|
|
94
|
-
uri: source
|
|
149
|
+
uri: displayUri ?? source
|
|
95
150
|
},
|
|
96
151
|
resizeMode: carousel ? 'cover' : 'contain',
|
|
97
152
|
style: [styles.image, loading ? styles.loadingImage : styles.loadedImage]
|
|
@@ -117,13 +172,19 @@ const LoadingImage = ({
|
|
|
117
172
|
width: "28",
|
|
118
173
|
height: "28"
|
|
119
174
|
}))), /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, {
|
|
120
|
-
style: styles.closeButton
|
|
175
|
+
style: styles.closeButton
|
|
176
|
+
// The button matches web at 28dp, which is still under Apple's 44pt
|
|
177
|
+
// minimum touch target. Grow the touch area rather than the black
|
|
178
|
+
// disc, so the visual stays in parity while the frame stays tappable:
|
|
179
|
+
// 28 + 8 on each side lands exactly on 44.
|
|
180
|
+
,
|
|
181
|
+
hitSlop: 8,
|
|
121
182
|
disabled: (loading || isProcess) && !isUploadError,
|
|
122
183
|
onPress: handleDelete
|
|
123
184
|
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgXml, {
|
|
124
|
-
xml: (0, _xml.
|
|
125
|
-
width: "
|
|
126
|
-
height: "
|
|
185
|
+
xml: (0, _xml.mediaRemoveIcon)(),
|
|
186
|
+
width: "20",
|
|
187
|
+
height: "20"
|
|
127
188
|
})));
|
|
128
189
|
};
|
|
129
190
|
var _default = exports.default = LoadingImage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","Progress","_interopRequireWildcard","_reactNativeSvg","_file","_xml","_styles","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LoadingImage","source","onClose","index","onLoadFinish","onUploadError","isUploaded","fileId","isEditMode","fileCount","postId","
|
|
1
|
+
{"version":3,"names":["_react","require","_netinfo","_interopRequireDefault","_reactNative","Progress","_interopRequireWildcard","_reactNativeSvg","_file","_xml","_styles","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LoadingImage","source","onClose","index","onLoadFinish","onUploadError","isUploaded","displayUri","fileId","isEditMode","fileCount","postId","onUploadingChange","carousel","loading","setLoading","useState","progress","setProgress","isProcess","setIsProcess","isUploadError","setIsUploadError","styles","useStyles","handleLoadEnd","useCallback","useEffect","uploadFileToAmity","file","uploadImageFile","percent","_file$","_file$2","_file$3","fileUrl","attributes","name","error","wasDisconnectedRef","useRef","unsubscribe","NetInfo","addEventListener","state","isConnected","current","handleDelete","deleteAmityFile","onRetryUpload","React","createElement","View","style","carouselContainer","image3XContainer","container","Image","uri","resizeMode","image","loadingImage","loadedImage","overlay","CircleSnail","size","borderColor","thickness","Circle","unfilledColor","failedOverlay","TouchableOpacity","errorOverlay","onPress","SvgXml","xml","toastIcon","width","height","closeButton","hitSlop","disabled","mediaRemoveIcon","_default","exports"],"sourceRoot":"../../../../../src","sources":["social/components/LoadingImage/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,G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GAAI;IACzBgD,IAAI,EAAE,EAAG;IACTC,WAAW,EAAC,aAAa;IACzBG,aAAa,EAAC,SAAS;IACvBF,SAAS,EAAE;EAAE,CACd,CAEC,CACP,EACA,CAACrD,OAAO,IAAIO,aAAa,iBACxB6B,KAAA,CAAAC,aAAA,CAAC7E,YAAA,CAAA8E,IAAI;IAACC,KAAK,EAAE9B,MAAM,CAAC+C;EAAc,gBAChCpB,KAAA,CAAAC,aAAA,CAAC7E,YAAA,CAAAiG,gBAAgB;IAAClB,KAAK,EAAE9B,MAAM,CAACiD,YAAa;IAACC,OAAO,EAAExB;EAAc,gBACnEC,KAAA,CAAAC,aAAA,CAAC1E,eAAA,CAAAiG,MAAM;IAACC,GAAG,EAAE,IAAAC,cAAS,EAAC,CAAE;IAACC,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC;EAAI,CAAE,CAClC,CACd,CACP,eAED5B,KAAA,CAAAC,aAAA,CAAC7E,YAAA,CAAAiG,gBAAgB;IACflB,KAAK,EAAE9B,MAAM,CAACwD;IACd;IACA;IACA;IACA;IAAA;IACAC,OAAO,EAAE,CAAE;IACXC,QAAQ,EAAE,CAACnE,OAAO,IAAIK,SAAS,KAAK,CAACE,aAAc;IACnDoD,OAAO,EAAE1B;EAAa,gBAEtBG,KAAA,CAAAC,aAAA,CAAC1E,eAAA,CAAAiG,MAAM;IAACC,GAAG,EAAE,IAAAO,oBAAe,EAAC,CAAE;IAACL,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC;EAAI,CAAE,CACxC,CACd,CAAC;AAEX,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAA7F,OAAA,GACaS,YAAY","ignoreList":[]}
|
|
@@ -62,9 +62,14 @@ const useStyles = () => {
|
|
|
62
62
|
},
|
|
63
63
|
closeButton: {
|
|
64
64
|
position: 'absolute',
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
// Matched to the web UIKit's remove button, which is 20px of icon inside
|
|
66
|
+
// 4px of padding at an 8px offset. The old 12/7 pair came to nearly the
|
|
67
|
+
// same 26dp outer size but filled only 46% of the circle with the glyph
|
|
68
|
+
// against web's 71%, so it read as a heavy black disc with a tiny cross
|
|
69
|
+
// in it.
|
|
70
|
+
top: 8,
|
|
71
|
+
right: 8,
|
|
72
|
+
padding: 4,
|
|
68
73
|
backgroundColor: 'rgba(0, 0, 0, 0.4)',
|
|
69
74
|
borderRadius: 72,
|
|
70
75
|
zIndex: 10
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","useStyles","width","useWindowDimensions","StyleSheet","create","container","flex","height","margin","image3XContainer","carouselContainer","image","resizeMode","borderRadius","position","overlay","absoluteFillObject","justifyContent","alignItems","failedOverlay","backgroundColor","errorOverlay","top","left","right","progressBar","marginVertical","loadingImage","opacity","loadedImage","closeButton","padding","zIndex","exports"],"sourceRoot":"../../../../../src","sources":["social/components/LoadingImage/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,SAAS,GAAGA,CAAA,KAAM;EAC7B,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EACvC,OAAOC,uBAAU,CAACC,MAAM,CAAC;IACvBC,SAAS,EAAE;MACTC,IAAI,EAAE,CAAC;MACPC,MAAM,EAAEN,KAAK,GAAG,EAAE;MAClBO,MAAM,EAAE;IACV,CAAC;IACDC,gBAAgB,EAAE;MAChBR,KAAK,EAAEA,KAAK,GAAG,CAAC,GAAG,EAAE;MACrBM,MAAM,EAAEN,KAAK,GAAG,CAAC,GAAG,EAAE;MACtBO,MAAM,EAAE;IACV,CAAC;IACDE,iBAAiB,EAAE;MACjBT,KAAK,EAAE,MAAM;MACbM,MAAM,EAAE;IACV,CAAC;IACDI,KAAK,EAAE;MACLV,KAAK,EAAE,MAAM;MACbM,MAAM,EAAE,MAAM;MACdK,UAAU,EAAE,OAAO;MACnBC,YAAY,EAAE,CAAC;MACfC,QAAQ,EAAE;IACZ,CAAC;IACDC,OAAO,EAAE;MACP,GAAGZ,uBAAU,CAACa,kBAAkB;MAChCC,cAAc,EAAE,QAAQ;MACxBC,UAAU,EAAE;IACd,CAAC;IACDC,aAAa,EAAE;MACb,GAAGhB,uBAAU,CAACa,kBAAkB;MAChCC,cAAc,EAAE,QAAQ;MACxBC,UAAU,EAAE,QAAQ;MACpBE,eAAe,EAAE,oBAAoB;MACrCP,YAAY,EAAE;IAChB,CAAC;IACDQ,YAAY,EAAE;MACZP,QAAQ,EAAE,UAAU;MACpBQ,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,CAAC;MACPC,KAAK,EAAE,CAAC;MACRN,UAAU,EAAE,QAAQ;MACpBD,cAAc,EAAE;IAClB,CAAC;IACDQ,WAAW,EAAE;MACXC,cAAc,EAAE;IAClB,CAAC;IACDC,YAAY,EAAE;MACZC,OAAO,EAAE;IACX,CAAC;IACDC,WAAW,EAAE;MACXD,OAAO,EAAE;IACX,CAAC;IACDE,WAAW,EAAE;MACXhB,QAAQ,EAAE,UAAU;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","useStyles","width","useWindowDimensions","StyleSheet","create","container","flex","height","margin","image3XContainer","carouselContainer","image","resizeMode","borderRadius","position","overlay","absoluteFillObject","justifyContent","alignItems","failedOverlay","backgroundColor","errorOverlay","top","left","right","progressBar","marginVertical","loadingImage","opacity","loadedImage","closeButton","padding","zIndex","exports"],"sourceRoot":"../../../../../src","sources":["social/components/LoadingImage/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,SAAS,GAAGA,CAAA,KAAM;EAC7B,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EACvC,OAAOC,uBAAU,CAACC,MAAM,CAAC;IACvBC,SAAS,EAAE;MACTC,IAAI,EAAE,CAAC;MACPC,MAAM,EAAEN,KAAK,GAAG,EAAE;MAClBO,MAAM,EAAE;IACV,CAAC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AjC,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _netinfo = _interopRequireDefault(require("@react-native-community/netinfo"));
|
|
8
9
|
var _reactNative = require("react-native");
|
|
9
10
|
var Progress = _interopRequireWildcard(require("react-native-progress"));
|
|
10
11
|
var _reactNativeSvg = require("react-native-svg");
|
|
@@ -16,8 +17,8 @@ var _native = require("@react-navigation/native");
|
|
|
16
17
|
var _uiSlice = _interopRequireDefault(require("../../../core/stores/slices/uiSlice"));
|
|
17
18
|
var _reactNativeCompressor = require("react-native-compressor");
|
|
18
19
|
var _store = require("../../../core/stores/store");
|
|
19
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
22
|
const LoadingVideo = ({
|
|
22
23
|
source,
|
|
23
24
|
onClose,
|
|
@@ -25,13 +26,14 @@ const LoadingVideo = ({
|
|
|
25
26
|
onLoadFinish,
|
|
26
27
|
onUploadError,
|
|
27
28
|
isUploaded = false,
|
|
29
|
+
displayUri,
|
|
28
30
|
thumbNail,
|
|
29
31
|
onPlay,
|
|
30
32
|
fileId,
|
|
31
33
|
isEditMode = false,
|
|
32
34
|
fileCount,
|
|
33
35
|
postId,
|
|
34
|
-
|
|
36
|
+
onUploadingChange,
|
|
35
37
|
carousel = false
|
|
36
38
|
}) => {
|
|
37
39
|
const dispatch = (0, _store.useUIKitDispatch)();
|
|
@@ -43,6 +45,10 @@ const LoadingVideo = ({
|
|
|
43
45
|
const [isProcess, setIsProcess] = (0, _react.useState)(false);
|
|
44
46
|
const [isUploadError, setIsUploadError] = (0, _react.useState)(false);
|
|
45
47
|
const [thumbNailImage, setThumbNailImage] = (0, _react.useState)(thumbNail ?? '');
|
|
48
|
+
// `uploadFileToAmity` is memoised on [source] only, so reading the state
|
|
49
|
+
// there would capture the empty first-render value. Mirror it into a ref so
|
|
50
|
+
// the upload callback always sees the frame that was actually decoded.
|
|
51
|
+
const thumbNailImageRef = (0, _react.useRef)(thumbNail ?? '');
|
|
46
52
|
const styles = (0, _styles.useStyles)();
|
|
47
53
|
const [playingUri, setPlayingUri] = (0, _react.useState)('');
|
|
48
54
|
const [isPause, setIsPause] = (0, _react.useState)(true);
|
|
@@ -63,10 +69,11 @@ const LoadingVideo = ({
|
|
|
63
69
|
};
|
|
64
70
|
const handleLoadEnd = () => {
|
|
65
71
|
setLoading(false);
|
|
66
|
-
|
|
72
|
+
onUploadingChange === null || onUploadingChange === void 0 || onUploadingChange(false, source);
|
|
67
73
|
};
|
|
68
74
|
const processThumbNail = async () => {
|
|
69
|
-
const generatedThumbNail = await (0, _reactNativeCompressor.createVideoThumbnail)(source);
|
|
75
|
+
const generatedThumbNail = await (0, _reactNativeCompressor.createVideoThumbnail)(displayUri ?? source);
|
|
76
|
+
thumbNailImageRef.current = generatedThumbNail.path;
|
|
70
77
|
setThumbNailImage(generatedThumbNail.path);
|
|
71
78
|
};
|
|
72
79
|
(0, _react.useEffect)(() => {
|
|
@@ -78,8 +85,25 @@ const LoadingVideo = ({
|
|
|
78
85
|
}
|
|
79
86
|
}, [progress]);
|
|
80
87
|
const uploadFileToAmity = (0, _react.useCallback)(async () => {
|
|
81
|
-
|
|
88
|
+
onUploadingChange === null || onUploadingChange === void 0 || onUploadingChange(true, source);
|
|
82
89
|
setIsUploadError(false);
|
|
90
|
+
// A retry re-enters this function with `loading` already false — the failed
|
|
91
|
+
// attempt's `handleLoadEnd` cleared it and nothing ever set it back, so
|
|
92
|
+
// `setLoading` only ever ran downwards in this component. The frame then
|
|
93
|
+
// re-uploaded with no spinner at all, which reads as "finished instantly"
|
|
94
|
+
// while Post stays disabled for the length of the upload.
|
|
95
|
+
// Progress and the processing flag are stale from the failed attempt too,
|
|
96
|
+
// so reset the whole visual upload state here rather than only in the
|
|
97
|
+
// mount effect, which does not re-run on a retry.
|
|
98
|
+
setLoading(true);
|
|
99
|
+
setProgress(0);
|
|
100
|
+
setIsProcess(false);
|
|
101
|
+
// Clearing the local flag alone left this source inside the parent's
|
|
102
|
+
// `videoErrors` set, and that set is otherwise only cleared by the
|
|
103
|
+
// mount effect below — which does not re-run on a retry, since none of
|
|
104
|
+
// `fileId`/`isUploaded`/`source` changed. Post stayed disabled even after
|
|
105
|
+
// the retry uploaded fine, so tell the parent the error is gone up front.
|
|
106
|
+
onUploadError === null || onUploadError === void 0 || onUploadError(false, source);
|
|
83
107
|
try {
|
|
84
108
|
const file = await (0, _file.uploadVideoFile)(source, percent => {
|
|
85
109
|
setProgress(percent);
|
|
@@ -88,7 +112,13 @@ const LoadingVideo = ({
|
|
|
88
112
|
var _file$, _file$2, _file$3;
|
|
89
113
|
setIsProcess(false);
|
|
90
114
|
handleLoadEnd();
|
|
91
|
-
onLoadFinish && onLoadFinish((_file$ = file[0]) === null || _file$ === void 0 ? void 0 : _file$.fileId, (_file$2 = file[0]) === null || _file$2 === void 0 ? void 0 : _file$2.fileUrl, (_file$3 = file[0]) === null || _file$3 === void 0 ? void 0 : _file$3.attributes.name, index, source,
|
|
115
|
+
onLoadFinish && onLoadFinish((_file$ = file[0]) === null || _file$ === void 0 ? void 0 : _file$.fileId, (_file$2 = file[0]) === null || _file$2 === void 0 ? void 0 : _file$2.fileUrl, (_file$3 = file[0]) === null || _file$3 === void 0 ? void 0 : _file$3.attributes.name, index, source,
|
|
116
|
+
// Hand back the frame this component decoded, not the incoming
|
|
117
|
+
// prop — for a newly picked video that prop is empty, so the
|
|
118
|
+
// generated thumbnail used to be dropped on the floor. The
|
|
119
|
+
// composer stores it so the feed can show it while the server is
|
|
120
|
+
// still transcoding (PDT-4904).
|
|
121
|
+
thumbNailImageRef.current || thumbNail);
|
|
92
122
|
} else {
|
|
93
123
|
handleLoadEnd();
|
|
94
124
|
dispatch(showToastMessage({
|
|
@@ -108,6 +138,30 @@ const LoadingVideo = ({
|
|
|
108
138
|
onUploadError === null || onUploadError === void 0 || onUploadError(true, source);
|
|
109
139
|
}
|
|
110
140
|
}, [source]);
|
|
141
|
+
|
|
142
|
+
// The frame is expected to end up uploaded, and Post enabled, once
|
|
143
|
+
// connectivity returns. Nothing retried on its own —
|
|
144
|
+
// the error key only cleared on a manual tap on that specific frame, and the
|
|
145
|
+
// peek carousel can leave a failed frame off-screen entirely, so Post stayed
|
|
146
|
+
// disabled with no visible cause. Retry when the device regains a
|
|
147
|
+
// connection, using the same NetInfo listener idiom as post Detail and the
|
|
148
|
+
// livestream screens.
|
|
149
|
+
//
|
|
150
|
+
// Gated on a disconnected -> connected transition, not merely on being
|
|
151
|
+
// connected: addEventListener fires immediately with the current state, so a
|
|
152
|
+
// failure that happened while online (a server error, say) would otherwise
|
|
153
|
+
// re-fire on every resubscribe and spin.
|
|
154
|
+
const wasDisconnectedRef = (0, _react.useRef)(false);
|
|
155
|
+
(0, _react.useEffect)(() => {
|
|
156
|
+
const unsubscribe = _netinfo.default.addEventListener(state => {
|
|
157
|
+
const isConnected = !!state.isConnected;
|
|
158
|
+
if (isConnected && wasDisconnectedRef.current && isUploadError) {
|
|
159
|
+
uploadFileToAmity();
|
|
160
|
+
}
|
|
161
|
+
wasDisconnectedRef.current = !isConnected;
|
|
162
|
+
});
|
|
163
|
+
return () => unsubscribe();
|
|
164
|
+
}, [isUploadError, uploadFileToAmity]);
|
|
111
165
|
const handleDelete = async () => {
|
|
112
166
|
if (fileId && !isEditMode) {
|
|
113
167
|
await (0, _file.deleteAmityFile)(fileId);
|
|
@@ -126,15 +180,29 @@ const LoadingVideo = ({
|
|
|
126
180
|
}
|
|
127
181
|
}, [fileId, isUploaded, source]);
|
|
128
182
|
const handleOnPlay = () => {
|
|
129
|
-
|
|
130
|
-
//
|
|
131
|
-
//
|
|
183
|
+
// In carousel mode the parent (onPlay) owns the full-screen media viewer,
|
|
184
|
+
// so this component never mounts the inline <Video> and never receives a
|
|
185
|
+
// dismiss callback to unpause with. Leaving `isPause` alone keeps the play
|
|
186
|
+
// icon rendered, which is what the frame shows once the viewer closes
|
|
187
|
+
// (PDT-4904); toggling it here hid the icon for the rest of the session.
|
|
132
188
|
if (onPlay) {
|
|
133
189
|
onPlay(source);
|
|
134
190
|
return;
|
|
135
191
|
}
|
|
192
|
+
setIsPause(!isPause);
|
|
136
193
|
playVideoFullScreen(source);
|
|
137
194
|
};
|
|
195
|
+
|
|
196
|
+
// A frame can be removed (or its source swapped) while its upload is still
|
|
197
|
+
// in flight, in which case `handleLoadEnd` never runs and the composer would
|
|
198
|
+
// keep waiting on an entry no mounted child owns any more — leaving Post
|
|
199
|
+
// disabled forever. Clearing it from this cleanup keeps the
|
|
200
|
+
// bookkeeping in the same component that added it.
|
|
201
|
+
(0, _react.useEffect)(() => {
|
|
202
|
+
return () => {
|
|
203
|
+
onUploadingChange === null || onUploadingChange === void 0 || onUploadingChange(false, source);
|
|
204
|
+
};
|
|
205
|
+
}, [onUploadingChange, source]);
|
|
138
206
|
const onRetryUpload = () => {
|
|
139
207
|
uploadFileToAmity();
|
|
140
208
|
};
|
|
@@ -163,7 +231,7 @@ const LoadingVideo = ({
|
|
|
163
231
|
style: [styles.image, loading ? styles.loadingImage : styles.loadedImage]
|
|
164
232
|
}) : /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
165
233
|
style: styles.image
|
|
166
|
-
}), loading
|
|
234
|
+
}), loading && /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
167
235
|
style: styles.overlay
|
|
168
236
|
}, isProcess ? /*#__PURE__*/React.createElement(Progress.CircleSnail, {
|
|
169
237
|
size: 24,
|
|
@@ -175,21 +243,27 @@ const LoadingVideo = ({
|
|
|
175
243
|
borderColor: "transparent",
|
|
176
244
|
unfilledColor: "#ffffff",
|
|
177
245
|
thickness: 2
|
|
178
|
-
}))
|
|
246
|
+
})), !loading && isUploadError && /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, {
|
|
179
247
|
style: styles.overlay,
|
|
180
248
|
onPress: onRetryUpload
|
|
181
249
|
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgXml, {
|
|
182
250
|
xml: (0, _xml.toastIcon)(),
|
|
183
251
|
width: "24",
|
|
184
252
|
height: "24"
|
|
185
|
-
}))
|
|
186
|
-
style: styles.closeButton
|
|
253
|
+
})), /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, {
|
|
254
|
+
style: styles.closeButton
|
|
255
|
+
// The button matches web at 28dp, which is still under Apple's 44pt
|
|
256
|
+
// minimum touch target. Grow the touch area rather than the black
|
|
257
|
+
// disc, so the visual stays in parity while the frame stays tappable:
|
|
258
|
+
// 28 + 8 on each side lands exactly on 44.
|
|
259
|
+
,
|
|
260
|
+
hitSlop: 8,
|
|
187
261
|
disabled: (loading || isProcess) && !isUploadError,
|
|
188
262
|
onPress: handleDelete
|
|
189
263
|
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgXml, {
|
|
190
|
-
xml: (0, _xml.
|
|
191
|
-
width: "
|
|
192
|
-
height: "
|
|
264
|
+
xml: (0, _xml.mediaRemoveIcon)(),
|
|
265
|
+
width: "20",
|
|
266
|
+
height: "20"
|
|
193
267
|
})));
|
|
194
268
|
};
|
|
195
269
|
var _default = exports.default = LoadingVideo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","Progress","_interopRequireWildcard","_reactNativeSvg","_file","_xml","_styles","_reactNativeVideo","_interopRequireDefault","_native","_uiSlice","_reactNativeCompressor","_store","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LoadingVideo","source","onClose","index","onLoadFinish","onUploadError","isUploaded","thumbNail","onPlay","fileId","isEditMode","fileCount","postId","setIsUploading","carousel","dispatch","useUIKitDispatch","showToastMessage","uiSlice","actions","loading","setLoading","useState","progress","setProgress","isProcess","setIsProcess","isUploadError","setIsUploadError","thumbNailImage","setThumbNailImage","styles","useStyles","playingUri","setPlayingUri","isPause","setIsPause","navigation","useNavigation","playVideoFullScreen","fileUrl","Platform","OS","navigate","onClosePlayer","handleLoadEnd","processThumbNail","generatedThumbNail","createVideoThumbnail","path","useEffect","uploadFileToAmity","useCallback","file","uploadVideoFile","percent","_file$","_file$2","_file$3","attributes","name","toastMessage","error","handleDelete","deleteAmityFile","handleOnPlay","onRetryUpload","React","createElement","View","style","carouselContainer","image3XContainer","container","TouchableOpacity","playButton","onPress","SvgXml","xml","videoControlIcon","playBtn","width","height","controls","image","uri","onFullscreenPlayerWillDismiss","paused","Image","resizeMode","loadingImage","loadedImage","overlay","CircleSnail","size","borderColor","thickness","Circle","unfilledColor","toastIcon","closeButton","disabled","closeIcon","_default","exports"],"sourceRoot":"../../../../../src","sources":["social/components/LoadingVideo/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,QAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AAMA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AAEA,IAAA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cAAS,EAAC,CAAE;IAAClB,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC;EAAI,CAAE,CAClC,CAAC,gBAEnBf,KAAA,CAAAC,aAAA,CAACpG,YAAA,CAAA0G,gBAAgB;IACfJ,KAAK,EAAEvC,MAAM,CAACqE,WAAY;IAC1BC,QAAQ,EAAE,CAACjF,OAAO,IAAIK,SAAS,KAAK,CAACE,aAAc;IACnDiD,OAAO,EAAEb;EAAa,gBAEtBI,KAAA,CAAAC,aAAA,CAACjG,eAAA,CAAA0G,MAAM;IAACC,GAAG,EAAE,IAAAwB,cAAS,EAAC,OAAO,CAAE;IAACrB,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC;EAAI,CAAE,CACzC,CAEhB,CAAC;AAEX,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAAzH,OAAA,GACaiB,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","require","_netinfo","_interopRequireDefault","_reactNative","Progress","_interopRequireWildcard","_reactNativeSvg","_file","_xml","_styles","_reactNativeVideo","_native","_uiSlice","_reactNativeCompressor","_store","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LoadingVideo","source","onClose","index","onLoadFinish","onUploadError","isUploaded","displayUri","thumbNail","onPlay","fileId","isEditMode","fileCount","postId","onUploadingChange","carousel","dispatch","useUIKitDispatch","showToastMessage","uiSlice","actions","loading","setLoading","useState","progress","setProgress","isProcess","setIsProcess","isUploadError","setIsUploadError","thumbNailImage","setThumbNailImage","thumbNailImageRef","useRef","styles","useStyles","playingUri","setPlayingUri","isPause","setIsPause","navigation","useNavigation","playVideoFullScreen","fileUrl","Platform","OS","navigate","onClosePlayer","handleLoadEnd","processThumbNail","generatedThumbNail","createVideoThumbnail","current","path","useEffect","uploadFileToAmity","useCallback","file","uploadVideoFile","percent","_file$","_file$2","_file$3","attributes","name","toastMessage","error","wasDisconnectedRef","unsubscribe","NetInfo","addEventListener","state","isConnected","handleDelete","deleteAmityFile","handleOnPlay","onRetryUpload","React","createElement","View","style","carouselContainer","image3XContainer","container","TouchableOpacity","playButton","onPress","SvgXml","xml","videoControlIcon","playBtn","width","height","controls","image","uri","onFullscreenPlayerWillDismiss","paused","Image","resizeMode","loadingImage","loadedImage","overlay","CircleSnail","size","borderColor","thickness","Circle","unfilledColor","toastIcon","closeButton","hitSlop","disabled","mediaRemoveIcon","_default","exports"],"sourceRoot":"../../../../../src","sources":["social/components/LoadingVideo/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAOA,IAAAI,QAAA,GAAAC,uBAAA,CAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,IAAA,GAAAR,OAAA;AAMA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAEA,IAAAY,QAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,sBAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAA8D,SAAAK,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAU,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAA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AmH,MAAM;IAACC,GAAG,EAAE,IAAAyB,oBAAe,EAAC,CAAE;IAACtB,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC;EAAI,CAAE,CACxC,CACd,CAAC;AAEX,CAAC;AAAC,IAAAsB,QAAA,GAAAC,OAAA,CAAA5H,OAAA,GACaS,YAAY","ignoreList":[]}
|
|
@@ -52,11 +52,20 @@ const useStyles = () => {
|
|
|
52
52
|
},
|
|
53
53
|
closeButton: {
|
|
54
54
|
position: 'absolute',
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
// Matched to the web UIKit's remove button, which is 20px of icon inside
|
|
56
|
+
// 4px of padding at an 8px offset. The old 12/7 pair came to nearly the
|
|
57
|
+
// same 26dp outer size but filled only 46% of the circle with the glyph
|
|
58
|
+
// against web's 71%, so it read as a heavy black disc with a tiny cross
|
|
59
|
+
// in it.
|
|
60
|
+
top: 8,
|
|
61
|
+
right: 8,
|
|
62
|
+
padding: 4,
|
|
63
|
+
// Matches LoadingImage exactly: the icon is closeIcon('white') in both,
|
|
64
|
+
// so the white scrim this used to carry left a white-on-white button
|
|
65
|
+
// that all but disappeared over a light frame.
|
|
66
|
+
backgroundColor: 'rgba(0, 0, 0, 0.4)',
|
|
67
|
+
borderRadius: 72,
|
|
68
|
+
zIndex: 10
|
|
60
69
|
},
|
|
61
70
|
playButton: {
|
|
62
71
|
width: 100,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","useStyles","width","useWindowDimensions","StyleSheet","create","container","flex","height","margin","image3XContainer","carouselContainer","image","resizeMode","borderRadius","backgroundColor","overlay","position","top","left","transform","translateX","translateY","progressBar","marginVertical","loadingImage","opacity","loadedImage","closeButton","right","padding","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","useStyles","width","useWindowDimensions","StyleSheet","create","container","flex","height","margin","image3XContainer","carouselContainer","image","resizeMode","borderRadius","backgroundColor","overlay","position","top","left","transform","translateX","translateY","progressBar","marginVertical","loadingImage","opacity","loadedImage","closeButton","right","padding","zIndex","playButton","exports"],"sourceRoot":"../../../../../src","sources":["social/components/LoadingVideo/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,SAAS,GAAGA,CAAA,KAAM;EAC7B,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EACvC,OAAOC,uBAAU,CAACC,MAAM,CAAC;IACvBC,SAAS,EAAE;MACTC,IAAI,EAAE,CAAC;MACPC,MAAM,EAAEN,KAAK,GAAG,EAAE;MAClBO,MAAM,EAAE;IACV,CAAC;IACDC,gBAAgB,EAAE;MAChBR,KAAK,EAAEA,KAAK,GAAG,CAAC,GAAG,EAAE;MACrBM,MAAM,EAAEN,KAAK,GAAG,CAAC,GAAG,EAAE;MACtBO,MAAM,EAAE;IACV,CAAC;IACDE,iBAAiB,EAAE;MACjBT,KAAK,EAAE,MAAM;MACbM,MAAM,EAAE;IACV,CAAC;IACDI,KAAK,EAAE;MACLV,KAAK,EAAE,MAAM;MACbM,MAAM,EAAE,MAAM;MACdK,UAAU,EAAE,OAAO;MACnBC,YAAY,EAAE,CAAC;MACfC,eAAe,EAAE;IACnB,CAAC;IACDC,OAAO,EAAE;MACPC,QAAQ,EAAE,UAAU;MACpBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAE,CAAC;MAAG,CAAC,EAAE;QAAEC,UAAU,EAAE,CAAC;MAAG,CAAC;IACtD,CAAC;IACDC,WAAW,EAAE;MACXC,cAAc,EAAE;IAClB,CAAC;IACDC,YAAY,EAAE;MACZC,OAAO,EAAE;IACX,CAAC;IACDC,WAAW,EAAE;MACXD,OAAO,EAAE;IACX,CAAC;IACDE,WAAW,EAAE;MACXX,QAAQ,EAAE,UAAU;MACpB;MACA;MACA;MACA;MACA;MACAC,GAAG,EAAE,CAAC;MACNW,KAAK,EAAE,CAAC;MACRC,OAAO,EAAE,CAAC;MACV;MACA;MACA;MACAf,eAAe,EAAE,oBAAoB;MACrCD,YAAY,EAAE,EAAE;MAChBiB,MAAM,EAAE;IACV,CAAC;IACDC,UAAU,EAAE;MACV9B,KAAK,EAAE,GAAG;MACVM,MAAM,EAAE,GAAG;MACXM,YAAY,EAAE,EAAE;MAChBG,QAAQ,EAAE,UAAU;MACpBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAE,CAAC;MAAG,CAAC,EAAE;QAAEC,UAAU,EAAE,CAAC;MAAG,CAAC,CAAC;MACrDS,MAAM,EAAE;IACV;EACF,CAAC,CAAC;AACJ,CAAC;AAACE,OAAA,CAAAhC,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -36,11 +36,12 @@ function MediaViewer({
|
|
|
36
36
|
const listRef = (0, _react.useRef)(null);
|
|
37
37
|
const videoRef = (0, _react.useRef)(null);
|
|
38
38
|
const [current, setCurrent] = (0, _react.useState)(initialIndex);
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
39
|
+
// The sound setting belongs to the viewing session, not to one frame: the
|
|
40
|
+
// first video opens unmuted and swiping carries whatever the viewer last
|
|
41
|
+
// chose. Re-defaulting each new frame to muted meant a swipe silenced a
|
|
42
|
+
// session the viewer never muted, since opening unmuted is a default rather
|
|
43
|
+
// than an explicit choice.
|
|
42
44
|
const [muted, setMuted] = (0, _react.useState)(false);
|
|
43
|
-
const keepUnmutedRef = (0, _react.useRef)(false);
|
|
44
45
|
|
|
45
46
|
// --- playback controls (ported from web VideoPlayerControls) ---
|
|
46
47
|
const [userPaused, setUserPaused] = (0, _react.useState)(false);
|
|
@@ -77,7 +78,6 @@ function MediaViewer({
|
|
|
77
78
|
}
|
|
78
79
|
setCurrent(initialIndex);
|
|
79
80
|
setMuted(false);
|
|
80
|
-
keepUnmutedRef.current = false;
|
|
81
81
|
resetPlayback();
|
|
82
82
|
revealControls();
|
|
83
83
|
}, [visible, initialIndex, resetPlayback, revealControls, clearHideTimer]);
|
|
@@ -86,17 +86,12 @@ function MediaViewer({
|
|
|
86
86
|
const idx = Math.round(e.nativeEvent.contentOffset.x / width);
|
|
87
87
|
if (idx !== current) {
|
|
88
88
|
setCurrent(idx);
|
|
89
|
-
setMuted(!keepUnmutedRef.current);
|
|
90
89
|
resetPlayback();
|
|
91
90
|
revealControls();
|
|
92
91
|
}
|
|
93
92
|
}, [width, current, resetPlayback, revealControls]);
|
|
94
93
|
const toggleMute = (0, _react.useCallback)(() => {
|
|
95
|
-
setMuted(prev =>
|
|
96
|
-
const next = !prev;
|
|
97
|
-
keepUnmutedRef.current = !next; // user unmuted -> keep unmuted afterwards
|
|
98
|
-
return next;
|
|
99
|
-
});
|
|
94
|
+
setMuted(prev => !prev);
|
|
100
95
|
revealControls();
|
|
101
96
|
}, [revealControls]);
|
|
102
97
|
const togglePlay = (0, _react.useCallback)(() => {
|
|
@@ -204,8 +199,13 @@ function MediaViewer({
|
|
|
204
199
|
},
|
|
205
200
|
style: styles.media,
|
|
206
201
|
resizeMode: "contain",
|
|
207
|
-
paused: index !== current || !visible || userPaused
|
|
208
|
-
|
|
202
|
+
paused: index !== current || !visible || userPaused
|
|
203
|
+
// Only the frame on screen may be audible. `paused` alone is
|
|
204
|
+
// not a reliable gag on an off-screen native player, so an
|
|
205
|
+
// unmuted session must not leave a neighbouring frame able to
|
|
206
|
+
// emit sound.
|
|
207
|
+
,
|
|
208
|
+
muted: muted || index !== current,
|
|
209
209
|
repeat: true,
|
|
210
210
|
playInBackground: false,
|
|
211
211
|
playWhenInactive: false,
|