@amityco/react-native-social-uikit 4.0.0-RC10 → 4.0.0-RC11
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/lib/commonjs/components/Toast/Toast.js +2 -1
- package/lib/commonjs/components/Toast/Toast.js.map +1 -1
- package/lib/commonjs/providers/file-provider.js +38 -19
- package/lib/commonjs/providers/file-provider.js.map +1 -1
- package/lib/commonjs/svg/svg-xml-list.js +6 -1
- package/lib/commonjs/svg/svg-xml-list.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +37 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityViewStoryPage/Components/AmityViewStoryItem.js +54 -21
- package/lib/commonjs/v4/PublicApi/Pages/AmityViewStoryPage/Components/AmityViewStoryItem.js.map +1 -1
- package/lib/commonjs/v4/PublicApi/Pages/AmityViewStoryPage/styles.js +24 -2
- package/lib/commonjs/v4/PublicApi/Pages/AmityViewStoryPage/styles.js.map +1 -1
- package/lib/commonjs/v4/assets/icons/toast.js +6 -6
- package/lib/commonjs/v4/assets/icons/toast.js.map +1 -1
- package/lib/commonjs/v4/component/CommunityStories/index.js +9 -4
- package/lib/commonjs/v4/component/CommunityStories/index.js.map +1 -1
- package/lib/commonjs/v4/component/CommunityStories/styles.js +7 -2
- package/lib/commonjs/v4/component/CommunityStories/styles.js.map +1 -1
- package/lib/commonjs/v4/component/LoadingImage/index.js +22 -25
- package/lib/commonjs/v4/component/LoadingImage/index.js.map +1 -1
- package/lib/commonjs/v4/component/LoadingImage/styles.js +19 -2
- package/lib/commonjs/v4/component/LoadingImage/styles.js.map +1 -1
- package/lib/commonjs/v4/component/LoadingVideo/index.js +12 -6
- package/lib/commonjs/v4/component/LoadingVideo/index.js.map +1 -1
- package/lib/commonjs/v4/component/MyStories/StoryCircleItem.js +11 -4
- package/lib/commonjs/v4/component/MyStories/StoryCircleItem.js.map +1 -1
- package/lib/commonjs/v4/component/MyStories/styles.js +5 -0
- package/lib/commonjs/v4/component/MyStories/styles.js.map +1 -1
- package/lib/module/components/Toast/Toast.js +2 -1
- package/lib/module/components/Toast/Toast.js.map +1 -1
- package/lib/module/providers/file-provider.js +38 -19
- package/lib/module/providers/file-provider.js.map +1 -1
- package/lib/module/svg/svg-xml-list.js +4 -0
- package/lib/module/svg/svg-xml-list.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js +37 -1
- package/lib/module/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityViewStoryPage/Components/AmityViewStoryItem.js +54 -21
- package/lib/module/v4/PublicApi/Pages/AmityViewStoryPage/Components/AmityViewStoryItem.js.map +1 -1
- package/lib/module/v4/PublicApi/Pages/AmityViewStoryPage/styles.js +24 -2
- package/lib/module/v4/PublicApi/Pages/AmityViewStoryPage/styles.js.map +1 -1
- package/lib/module/v4/assets/icons/toast.js +6 -6
- package/lib/module/v4/assets/icons/toast.js.map +1 -1
- package/lib/module/v4/component/CommunityStories/index.js +10 -5
- package/lib/module/v4/component/CommunityStories/index.js.map +1 -1
- package/lib/module/v4/component/CommunityStories/styles.js +7 -2
- package/lib/module/v4/component/CommunityStories/styles.js.map +1 -1
- package/lib/module/v4/component/LoadingImage/index.js +22 -24
- package/lib/module/v4/component/LoadingImage/index.js.map +1 -1
- package/lib/module/v4/component/LoadingImage/styles.js +19 -2
- package/lib/module/v4/component/LoadingImage/styles.js.map +1 -1
- package/lib/module/v4/component/LoadingVideo/index.js +12 -6
- package/lib/module/v4/component/LoadingVideo/index.js.map +1 -1
- package/lib/module/v4/component/MyStories/StoryCircleItem.js +13 -6
- package/lib/module/v4/component/MyStories/StoryCircleItem.js.map +1 -1
- package/lib/module/v4/component/MyStories/styles.js +5 -0
- package/lib/module/v4/component/MyStories/styles.js.map +1 -1
- package/lib/typescript/src/components/Toast/Toast.d.ts.map +1 -1
- package/lib/typescript/src/providers/file-provider.d.ts.map +1 -1
- package/lib/typescript/src/svg/svg-xml-list.d.ts +1 -0
- package/lib/typescript/src/svg/svg-xml-list.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityViewStoryPage/Components/AmityViewStoryItem.d.ts.map +1 -1
- package/lib/typescript/src/v4/PublicApi/Pages/AmityViewStoryPage/styles.d.ts +22 -0
- package/lib/typescript/src/v4/PublicApi/Pages/AmityViewStoryPage/styles.d.ts.map +1 -1
- package/lib/typescript/src/v4/assets/icons/toast.d.ts +3 -3
- package/lib/typescript/src/v4/assets/icons/toast.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/CommunityStories/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/CommunityStories/styles.d.ts +5 -0
- package/lib/typescript/src/v4/component/CommunityStories/styles.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/LoadingImage/index.d.ts +2 -1
- package/lib/typescript/src/v4/component/LoadingImage/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/LoadingImage/styles.d.ts +21 -0
- package/lib/typescript/src/v4/component/LoadingImage/styles.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/LoadingVideo/index.d.ts +2 -1
- package/lib/typescript/src/v4/component/LoadingVideo/index.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/MyStories/StoryCircleItem.d.ts.map +1 -1
- package/lib/typescript/src/v4/component/MyStories/styles.d.ts +5 -0
- package/lib/typescript/src/v4/component/MyStories/styles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Toast/Toast.tsx +1 -0
- package/src/providers/file-provider.tsx +42 -20
- package/src/svg/svg-xml-list.ts +6 -0
- package/src/v4/PublicApi/Pages/AmityPostComposerPage/AmityPostComposerPage.tsx +46 -0
- package/src/v4/PublicApi/Pages/AmityViewStoryPage/Components/AmityViewStoryItem.tsx +122 -57
- package/src/v4/PublicApi/Pages/AmityViewStoryPage/styles.ts +23 -1
- package/src/v4/assets/icons/toast.tsx +12 -9
- package/src/v4/component/CommunityStories/index.tsx +26 -17
- package/src/v4/component/CommunityStories/styles.ts +7 -2
- package/src/v4/component/LoadingImage/index.tsx +28 -25
- package/src/v4/component/LoadingImage/styles.ts +17 -0
- package/src/v4/component/LoadingVideo/index.tsx +13 -7
- package/src/v4/component/MyStories/StoryCircleItem.tsx +19 -12
- package/src/v4/component/MyStories/styles.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/CommunityStories/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/CommunityStories/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAsBtE,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;+EAEqD,iBAAiB;AAyLvE,wBAAsC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/CommunityStories/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/CommunityStories/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GrB,CAAC"}
|
|
@@ -3,6 +3,7 @@ interface OverlayImageProps {
|
|
|
3
3
|
source: string;
|
|
4
4
|
onClose?: (originalPath: string, field?: string, postId?: string) => void;
|
|
5
5
|
onLoadFinish?: (fileId: string, fileUrl: string, fileName: string, index: number, originalPath: string) => void;
|
|
6
|
+
onUploadError?: (hasError: boolean, source: string) => void;
|
|
6
7
|
index?: number;
|
|
7
8
|
isUploaded: boolean;
|
|
8
9
|
fileId?: string;
|
|
@@ -11,6 +12,6 @@ interface OverlayImageProps {
|
|
|
11
12
|
postId?: string;
|
|
12
13
|
setIsUploading?: (arg: boolean) => void;
|
|
13
14
|
}
|
|
14
|
-
declare const LoadingImage: ({ source, onClose, index, onLoadFinish, isUploaded, fileId, isEditMode, fileCount, postId, setIsUploading, }: OverlayImageProps) => React.JSX.Element;
|
|
15
|
+
declare const LoadingImage: ({ source, onClose, index, onLoadFinish, onUploadError, isUploaded, fileId, isEditMode, fileCount, postId, setIsUploading, }: OverlayImageProps) => React.JSX.Element;
|
|
15
16
|
export default LoadingImage;
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/LoadingImage/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/LoadingImage/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAWhE,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,YAAY,CAAC,EAAE,CACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,KACjB,IAAI,CAAC;IACV,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AACD,QAAA,MAAM,YAAY,GAAI,6HAYnB,iBAAiB,sBAiInB,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -14,6 +14,7 @@ export declare const useStyles: () => {
|
|
|
14
14
|
height: "100%";
|
|
15
15
|
resizeMode: "cover";
|
|
16
16
|
borderRadius: number;
|
|
17
|
+
position: "relative";
|
|
17
18
|
};
|
|
18
19
|
overlay: {
|
|
19
20
|
justifyContent: "center";
|
|
@@ -24,6 +25,25 @@ export declare const useStyles: () => {
|
|
|
24
25
|
top: 0;
|
|
25
26
|
bottom: 0;
|
|
26
27
|
};
|
|
28
|
+
failedOverlay: {
|
|
29
|
+
justifyContent: "center";
|
|
30
|
+
alignItems: "center";
|
|
31
|
+
backgroundColor: string;
|
|
32
|
+
borderRadius: number;
|
|
33
|
+
position: "absolute";
|
|
34
|
+
left: 0;
|
|
35
|
+
right: 0;
|
|
36
|
+
top: 0;
|
|
37
|
+
bottom: 0;
|
|
38
|
+
};
|
|
39
|
+
errorOverlay: {
|
|
40
|
+
position: "absolute";
|
|
41
|
+
top: "50%";
|
|
42
|
+
left: number;
|
|
43
|
+
right: number;
|
|
44
|
+
alignItems: "center";
|
|
45
|
+
justifyContent: "center";
|
|
46
|
+
};
|
|
27
47
|
progressBar: {
|
|
28
48
|
marginVertical: number;
|
|
29
49
|
};
|
|
@@ -40,6 +60,7 @@ export declare const useStyles: () => {
|
|
|
40
60
|
padding: number;
|
|
41
61
|
backgroundColor: string;
|
|
42
62
|
borderRadius: number;
|
|
63
|
+
zIndex: number;
|
|
43
64
|
};
|
|
44
65
|
};
|
|
45
66
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/LoadingImage/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/LoadingImage/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DrB,CAAC"}
|
|
@@ -3,6 +3,7 @@ interface OverlayImageProps {
|
|
|
3
3
|
source: string;
|
|
4
4
|
onClose?: (originalPath: string, fileId?: string, postId?: string) => void;
|
|
5
5
|
onLoadFinish?: (fileId: string, fileUrl: string, fileName: string, index: number, originalPath: string, thumbNail: string) => void;
|
|
6
|
+
onUploadError?: (hasError: boolean, source: string) => void;
|
|
6
7
|
index?: number;
|
|
7
8
|
isUploaded: boolean;
|
|
8
9
|
fileId?: string;
|
|
@@ -13,6 +14,6 @@ interface OverlayImageProps {
|
|
|
13
14
|
postId?: string;
|
|
14
15
|
setIsUploading?: (arg: boolean) => void;
|
|
15
16
|
}
|
|
16
|
-
declare const LoadingVideo: ({ source, onClose, index, onLoadFinish, isUploaded, thumbNail, onPlay, fileId, isEditMode, fileCount, postId, setIsUploading, }: OverlayImageProps) => React.JSX.Element;
|
|
17
|
+
declare const LoadingVideo: ({ source, onClose, index, onLoadFinish, onUploadError, isUploaded, thumbNail, onPlay, fileId, isEditMode, fileCount, postId, setIsUploading, }: OverlayImageProps) => React.JSX.Element;
|
|
17
18
|
export default LoadingVideo;
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/LoadingVideo/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/LoadingVideo/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAuBhE,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E,YAAY,CAAC,EAAE,CACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,KACd,IAAI,CAAC;IACV,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AACD,QAAA,MAAM,YAAY,GAAI,gJAcnB,iBAAiB,sBA4KnB,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoryCircleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/MyStories/StoryCircleItem.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StoryCircleItem.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/MyStories/StoryCircleItem.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAgBvD,UAAU,gBAAgB;IACxB,gBAAgB,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC;CAChC;AAED,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,gBAAgB,CAmFzC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/MyStories/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/v4/component/MyStories/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuGrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -38,29 +38,51 @@ export async function uploadImageFile(
|
|
|
38
38
|
perCentCallback?: (percent: number) => void
|
|
39
39
|
): Promise<Amity.File<'image'>[]> {
|
|
40
40
|
return await new Promise(async (resolve, reject) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
try {
|
|
42
|
+
const formData = new FormData();
|
|
43
|
+
const parts = filePath.split('/');
|
|
44
|
+
const fileName = parts[parts.length - 1];
|
|
45
|
+
const fileType = Platform.OS === 'ios' ? 'image/jpeg' : 'image/jpg';
|
|
46
|
+
const uri =
|
|
47
|
+
Platform.OS === 'android' ? filePath : filePath.replace('file://', '');
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
formData.append('files', {
|
|
50
|
+
name: fileName,
|
|
51
|
+
type: fileType,
|
|
52
|
+
uri: uri,
|
|
53
|
+
});
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
const { data: file } = await FileRepository.uploadImage(
|
|
56
|
+
formData,
|
|
57
|
+
(percent) => {
|
|
58
|
+
perCentCallback && perCentCallback(percent);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (file) {
|
|
63
|
+
resolve(file);
|
|
64
|
+
} else {
|
|
65
|
+
reject({ message: 'Upload failed - no file data returned' });
|
|
66
|
+
}
|
|
67
|
+
} catch (error: any) {
|
|
68
|
+
if (
|
|
69
|
+
error?.message?.includes('INVALID_IMAGE') ||
|
|
70
|
+
error?.message?.includes('Inappropriate')
|
|
71
|
+
) {
|
|
72
|
+
reject({
|
|
73
|
+
message: 'Inappropriate image',
|
|
74
|
+
details: 'Please choose a different image to upload.',
|
|
75
|
+
code: 'INVALID_IMAGE',
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
reject({
|
|
79
|
+
message: 'Upload failed',
|
|
80
|
+
details:
|
|
81
|
+
error?.message ||
|
|
82
|
+
"We couldn't complete your upload. Please try again.",
|
|
83
|
+
originalError: error,
|
|
84
|
+
});
|
|
58
85
|
}
|
|
59
|
-
);
|
|
60
|
-
if (file) {
|
|
61
|
-
resolve(file);
|
|
62
|
-
} else {
|
|
63
|
-
reject('Upload error');
|
|
64
86
|
}
|
|
65
87
|
});
|
|
66
88
|
}
|
package/src/svg/svg-xml-list.ts
CHANGED
|
@@ -429,3 +429,9 @@ export const infoIcon = (
|
|
|
429
429
|
): string => `<svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
430
430
|
<path d="M8 2.25006C4.25 2.25006 1.25 5.28131 1.25 9.00006C1.25 12.7501 4.25 15.7501 8 15.7501C11.7188 15.7501 14.75 12.7501 14.75 9.00006C14.75 5.28131 11.6875 2.25006 8 2.25006ZM8 1.25006C12.25 1.25006 15.75 4.75006 15.75 9.00006C15.75 13.2813 12.25 16.7501 8 16.7501C3.71875 16.7501 0.25 13.2813 0.25 9.00006C0.25 4.75006 3.71875 1.25006 8 1.25006ZM6.875 12.0001H7.25V8.25006H6.875C6.65625 8.25006 6.5 8.09381 6.5 7.87506V7.62506C6.5 7.43756 6.65625 7.25006 6.875 7.25006H8.375C8.5625 7.25006 8.75 7.43756 8.75 7.62506V12.0001H9.125C9.3125 12.0001 9.5 12.1876 9.5 12.3751V12.6251C9.5 12.8438 9.3125 13.0001 9.125 13.0001H6.875C6.65625 13.0001 6.5 12.8438 6.5 12.6251V12.3751C6.5 12.1876 6.65625 12.0001 6.875 12.0001ZM8 4.50006C8.53125 4.50006 9 4.96881 9 5.50006C9 6.06256 8.53125 6.50006 8 6.50006C7.4375 6.50006 7 6.06256 7 5.50006C7 4.96881 7.4375 4.50006 8 4.50006Z" fill="${color}"/>
|
|
431
431
|
</svg>`;
|
|
432
|
+
export const errorIcon = (
|
|
433
|
+
color: string = '#fff'
|
|
434
|
+
): string => `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
435
|
+
<circle cx="8" cy="8" r="7.25" fill="#FA4D30" stroke="#fff" strokeWidth="1.5"></circle>
|
|
436
|
+
<path d="M9.25 10.75C9.25 11.453 8.687 12 8 12c-.703 0-1.25-.547-1.25-1.25 0-.688.547-1.25 1.25-1.25.688 0 1.25.563 1.25 1.25zM6.89 4.406A.378.378 0 017.267 4h1.453c.219 0 .39.188.375.406l-.203 4.25A.387.387 0 018.516 9H7.469a.387.387 0 01-.375-.344l-.203-4.25z" fill="${color}"/>
|
|
437
|
+
</svg>`;
|
|
@@ -107,12 +107,16 @@ const AmityPostComposerPage: FC<AmityPostComposerPageType> = ({
|
|
|
107
107
|
const [deletedPostIds, setDeletedPostIds] = useState<string[]>([]);
|
|
108
108
|
const [isUploading, setIsUploading] = useState(false);
|
|
109
109
|
const [hasChangedAttachment, setHasChangedAttachment] = useState(false);
|
|
110
|
+
const [imageErrors, setImageErrors] = useState<Set<string>>(new Set());
|
|
111
|
+
const [videoErrors, setVideoErrors] = useState<Set<string>>(new Set());
|
|
110
112
|
const privateCommunityId = !community?.isPublic && community?.communityId;
|
|
111
113
|
const title = isEditMode
|
|
112
114
|
? 'Edit Post'
|
|
113
115
|
: community?.displayName ?? 'My Timeline';
|
|
114
116
|
const isInputValid =
|
|
115
117
|
!isUploading &&
|
|
118
|
+
imageErrors.size === 0 &&
|
|
119
|
+
videoErrors.size === 0 &&
|
|
116
120
|
inputMessage.trim().length <= MAXIMUM_POST_CHARACTERS &&
|
|
117
121
|
(inputMessage.trim().length > 0 ||
|
|
118
122
|
displayImages.length > 0 ||
|
|
@@ -598,10 +602,45 @@ const AmityPostComposerPage: FC<AmityPostComposerPageType> = ({
|
|
|
598
602
|
}
|
|
599
603
|
}, [displayVideos.length, processMedia]);
|
|
600
604
|
|
|
605
|
+
const handleImageUploadError = useCallback(
|
|
606
|
+
(hasError: boolean, source: string) => {
|
|
607
|
+
setImageErrors((prev) => {
|
|
608
|
+
const newSet = new Set(prev);
|
|
609
|
+
if (hasError) {
|
|
610
|
+
newSet.add(source);
|
|
611
|
+
} else {
|
|
612
|
+
newSet.delete(source);
|
|
613
|
+
}
|
|
614
|
+
return newSet;
|
|
615
|
+
});
|
|
616
|
+
},
|
|
617
|
+
[]
|
|
618
|
+
);
|
|
619
|
+
|
|
620
|
+
const handleVideoUploadError = useCallback(
|
|
621
|
+
(hasError: boolean, source: string) => {
|
|
622
|
+
setVideoErrors((prev) => {
|
|
623
|
+
const newSet = new Set(prev);
|
|
624
|
+
if (hasError) {
|
|
625
|
+
newSet.add(source);
|
|
626
|
+
} else {
|
|
627
|
+
newSet.delete(source);
|
|
628
|
+
}
|
|
629
|
+
return newSet;
|
|
630
|
+
});
|
|
631
|
+
},
|
|
632
|
+
[]
|
|
633
|
+
);
|
|
634
|
+
|
|
601
635
|
const handleOnCloseImage = useCallback(
|
|
602
636
|
(originalPath: string, _, postId: string) => {
|
|
603
637
|
setHasChangedAttachment(true);
|
|
604
638
|
setDeletedPostIds((prev) => [...prev, postId]);
|
|
639
|
+
setImageErrors((prev) => {
|
|
640
|
+
const newSet = new Set(prev);
|
|
641
|
+
newSet.delete(originalPath);
|
|
642
|
+
return newSet;
|
|
643
|
+
});
|
|
605
644
|
setDisplayImages((prevData) => {
|
|
606
645
|
const newData = prevData.filter(
|
|
607
646
|
(item: IDisplayImage) => item.url !== originalPath
|
|
@@ -615,6 +654,11 @@ const AmityPostComposerPage: FC<AmityPostComposerPageType> = ({
|
|
|
615
654
|
(originalPath: string, _, postId: string) => {
|
|
616
655
|
setHasChangedAttachment(true);
|
|
617
656
|
setDeletedPostIds((prev) => [...prev, postId]);
|
|
657
|
+
setVideoErrors((prev) => {
|
|
658
|
+
const newSet = new Set(prev);
|
|
659
|
+
newSet.delete(originalPath);
|
|
660
|
+
return newSet;
|
|
661
|
+
});
|
|
618
662
|
setDisplayVideos((prevData) => {
|
|
619
663
|
const newData = prevData.filter(
|
|
620
664
|
(item: IDisplayImage) => item.url !== originalPath
|
|
@@ -760,6 +804,7 @@ const AmityPostComposerPage: FC<AmityPostComposerPageType> = ({
|
|
|
760
804
|
onClose={handleOnCloseImage}
|
|
761
805
|
index={index} //TODO: Fix this without index
|
|
762
806
|
onLoadFinish={handleOnFinishImage}
|
|
807
|
+
onUploadError={handleImageUploadError}
|
|
763
808
|
isUploaded={item.isUploaded}
|
|
764
809
|
fileId={item.fileId}
|
|
765
810
|
fileCount={displayImages.length}
|
|
@@ -783,6 +828,7 @@ const AmityPostComposerPage: FC<AmityPostComposerPageType> = ({
|
|
|
783
828
|
onClose={handleOnCloseVideo}
|
|
784
829
|
index={index} //TODO: Fix this without index
|
|
785
830
|
onLoadFinish={handleOnFinishVideo}
|
|
831
|
+
onUploadError={handleVideoUploadError}
|
|
786
832
|
isUploaded={item.isUploaded}
|
|
787
833
|
fileId={item.fileId}
|
|
788
834
|
thumbNail={item.thumbNail as string}
|
|
@@ -43,6 +43,8 @@ import { Typography } from '../../../../component/Typography/Typography';
|
|
|
43
43
|
import { useTheme } from 'react-native-paper';
|
|
44
44
|
import { MyMD3Theme } from '../../../../../providers/amity-ui-kit-provider';
|
|
45
45
|
import { useUIKitDispatch } from '../../../../../redux/store';
|
|
46
|
+
import { informative } from '~/v4/assets/icons/toast';
|
|
47
|
+
import { close as closeIcon } from '../../../../assets/icons';
|
|
46
48
|
|
|
47
49
|
interface IAmityViewStoryItem {
|
|
48
50
|
communityData: Amity.Community;
|
|
@@ -96,7 +98,6 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
|
|
|
96
98
|
const [isLiked, setIsLiked] = useState<boolean>(myReactions?.length > 0);
|
|
97
99
|
const [openCommentSheet, setOpenCommentSheet] = useState(false);
|
|
98
100
|
const [load, setLoad] = useState(true);
|
|
99
|
-
const [error, setError] = useState(false);
|
|
100
101
|
const [loading, setLoading] = useState(false);
|
|
101
102
|
const dispatch = useUIKitDispatch();
|
|
102
103
|
const { showToastMessage } = uiSlice.actions;
|
|
@@ -248,10 +249,20 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
|
|
|
248
249
|
);
|
|
249
250
|
if (deleted) {
|
|
250
251
|
current === 0 && previous();
|
|
251
|
-
dispatch(
|
|
252
|
+
dispatch(
|
|
253
|
+
showToastMessage({
|
|
254
|
+
toastMessage: 'Story deleted',
|
|
255
|
+
isSuccessToast: true,
|
|
256
|
+
})
|
|
257
|
+
);
|
|
252
258
|
}
|
|
253
259
|
} catch (err) {
|
|
254
|
-
dispatch(
|
|
260
|
+
dispatch(
|
|
261
|
+
showToastMessage({
|
|
262
|
+
toastMessage: 'Failed to delete story. Please try again.',
|
|
263
|
+
isSuccessToast: false,
|
|
264
|
+
})
|
|
265
|
+
);
|
|
255
266
|
} finally {
|
|
256
267
|
setLoading(false);
|
|
257
268
|
sheetRef?.current?.close();
|
|
@@ -288,6 +299,30 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
|
|
|
288
299
|
sheetRef.current?.open();
|
|
289
300
|
}, [progress]);
|
|
290
301
|
|
|
302
|
+
const onPressMenuButtonFailed = useCallback(() => {
|
|
303
|
+
progress.stopAnimation(() => setPressed(true));
|
|
304
|
+
Alert.alert(
|
|
305
|
+
'Failed to upload story',
|
|
306
|
+
'Would you like to discard uploading?',
|
|
307
|
+
[
|
|
308
|
+
{ text: 'Cancel', onPress: () => sheetRef?.current?.close() },
|
|
309
|
+
{ text: 'Delete', style: 'destructive', onPress: deleteStory },
|
|
310
|
+
]
|
|
311
|
+
);
|
|
312
|
+
}, [deleteStory, progress]);
|
|
313
|
+
|
|
314
|
+
const isFailedImageUpload =
|
|
315
|
+
currentStory?.dataType === 'image' &&
|
|
316
|
+
(currentStory?.syncState === 'error' ||
|
|
317
|
+
currentStory?.syncState === 'syncing' ||
|
|
318
|
+
!currentStory?.imageData?.fileUrl);
|
|
319
|
+
|
|
320
|
+
const isFailedVideoUpload =
|
|
321
|
+
currentStory?.dataType === 'video' &&
|
|
322
|
+
(currentStory?.syncState === 'error' ||
|
|
323
|
+
currentStory?.syncState === 'syncing' ||
|
|
324
|
+
!currentStory?.videoData?.fileUrl);
|
|
325
|
+
|
|
291
326
|
return (
|
|
292
327
|
<View style={[styles.container]}>
|
|
293
328
|
<SafeAreaView>
|
|
@@ -296,7 +331,13 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
|
|
|
296
331
|
<Video
|
|
297
332
|
onLoadStart={() => setLoad(true)}
|
|
298
333
|
onProgress={({ currentTime }) => setCurrentSeek(currentTime)}
|
|
299
|
-
source={{
|
|
334
|
+
source={{
|
|
335
|
+
uri:
|
|
336
|
+
currentStory?.videoData?.fileUrl ||
|
|
337
|
+
(typeof currentStory?.data?.fileData === 'string'
|
|
338
|
+
? currentStory?.data?.fileData
|
|
339
|
+
: ''),
|
|
340
|
+
}}
|
|
300
341
|
style={styles.video}
|
|
301
342
|
resizeMode="contain"
|
|
302
343
|
controls={false}
|
|
@@ -308,12 +349,15 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
|
|
|
308
349
|
) : currentStory?.dataType === 'image' ? (
|
|
309
350
|
<Image
|
|
310
351
|
onLoadStart={() => setLoad(true)}
|
|
311
|
-
onError={({ nativeEvent: { error: err } }) =>
|
|
312
|
-
err && setError(true)
|
|
313
|
-
}
|
|
314
352
|
onLoadEnd={() => start()}
|
|
315
|
-
source={{
|
|
316
|
-
|
|
353
|
+
source={{
|
|
354
|
+
uri:
|
|
355
|
+
currentStory?.imageData?.fileUrl ||
|
|
356
|
+
(typeof currentStory?.data?.fileData === 'string'
|
|
357
|
+
? currentStory?.data?.fileData
|
|
358
|
+
: ''),
|
|
359
|
+
}}
|
|
360
|
+
style={[styles.image, isFailedImageUpload && { opacity: 0.6 }]}
|
|
317
361
|
resizeMode="contain"
|
|
318
362
|
/>
|
|
319
363
|
) : null}
|
|
@@ -322,11 +366,6 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
|
|
|
322
366
|
<ActivityIndicator size="large" color={'white'} />
|
|
323
367
|
</View>
|
|
324
368
|
)}
|
|
325
|
-
{error && (
|
|
326
|
-
<View style={styles.spinnerContainer}>
|
|
327
|
-
<Text style={styles.error}>Story load error</Text>
|
|
328
|
-
</View>
|
|
329
|
-
)}
|
|
330
369
|
</View>
|
|
331
370
|
</SafeAreaView>
|
|
332
371
|
<GestureRecognizer onSwipeUp={onPressComment} style={styles.flexCol}>
|
|
@@ -399,7 +438,12 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
|
|
|
399
438
|
</TouchableOpacity>
|
|
400
439
|
)}
|
|
401
440
|
<TouchableOpacity hitSlop={5} onPress={() => onClose()}>
|
|
402
|
-
<
|
|
441
|
+
<SvgXml
|
|
442
|
+
xml={closeIcon()}
|
|
443
|
+
width="28"
|
|
444
|
+
height="28"
|
|
445
|
+
color="white"
|
|
446
|
+
/>
|
|
403
447
|
</TouchableOpacity>
|
|
404
448
|
</View>
|
|
405
449
|
</View>
|
|
@@ -465,49 +509,70 @@ const AmityViewStoryItem: FC<IAmityViewStoryItem> = ({
|
|
|
465
509
|
</TouchableOpacity>
|
|
466
510
|
)}
|
|
467
511
|
</GestureRecognizer>
|
|
468
|
-
|
|
469
|
-
{
|
|
470
|
-
<
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
>
|
|
476
|
-
|
|
477
|
-
<
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
styles.iconContainer,
|
|
486
|
-
{ backgroundColor: storyCommentBgColor },
|
|
487
|
-
]}
|
|
488
|
-
onPress={onPressComment}
|
|
489
|
-
>
|
|
490
|
-
<SvgXml xml={storyCommentIcon()} width="25" height="25" />
|
|
491
|
-
<Text style={styles.seen}>{commentsCounts}</Text>
|
|
492
|
-
</TouchableOpacity>
|
|
493
|
-
<TouchableOpacity
|
|
494
|
-
style={[
|
|
495
|
-
styles.iconContainer,
|
|
496
|
-
{
|
|
497
|
-
backgroundColor: storyReactionBgColor,
|
|
498
|
-
},
|
|
499
|
-
]}
|
|
500
|
-
onPress={onPressReaction}
|
|
501
|
-
>
|
|
502
|
-
<SvgXml
|
|
503
|
-
xml={isLiked ? storyLikedIcon : storyLikeIcon}
|
|
504
|
-
width="25"
|
|
505
|
-
height="25"
|
|
506
|
-
/>
|
|
507
|
-
<Text style={styles.seen}>{totalReaction}</Text>
|
|
508
|
-
</TouchableOpacity>
|
|
512
|
+
{(isFailedImageUpload || isFailedVideoUpload) && hasStoryPermission ? (
|
|
513
|
+
<View style={styles.errorContainer}>
|
|
514
|
+
<View style={styles.errorContainerLeft}>
|
|
515
|
+
<SvgXml xml={informative('white')} width="20" height="20" />
|
|
516
|
+
<Typography.Body style={styles.errorText}>
|
|
517
|
+
Failed to upload story
|
|
518
|
+
</Typography.Body>
|
|
519
|
+
</View>
|
|
520
|
+
{
|
|
521
|
+
<TouchableOpacity
|
|
522
|
+
hitSlop={5}
|
|
523
|
+
style={styles.threeDotsMenu}
|
|
524
|
+
onPress={onPressMenuButtonFailed}
|
|
525
|
+
>
|
|
526
|
+
<SvgXml xml={storyThreedotsMenu()} width="20" height="20" />
|
|
527
|
+
</TouchableOpacity>
|
|
528
|
+
}
|
|
509
529
|
</View>
|
|
510
|
-
|
|
530
|
+
) : (
|
|
531
|
+
<View style={styles.footer}>
|
|
532
|
+
{hasStoryImpressionPermission ? (
|
|
533
|
+
<TouchableOpacity
|
|
534
|
+
style={[
|
|
535
|
+
styles.seenContainer,
|
|
536
|
+
{ backgroundColor: storyViewerBgColor },
|
|
537
|
+
]}
|
|
538
|
+
>
|
|
539
|
+
<SvgXml xml={seenIcon()} width="25" height="25" />
|
|
540
|
+
<Text style={styles.seen}>{reachCount}</Text>
|
|
541
|
+
</TouchableOpacity>
|
|
542
|
+
) : (
|
|
543
|
+
<View style={styles.seenContainer} />
|
|
544
|
+
)}
|
|
545
|
+
<View style={styles.seenContainer}>
|
|
546
|
+
<TouchableOpacity
|
|
547
|
+
style={[
|
|
548
|
+
styles.iconContainer,
|
|
549
|
+
{ backgroundColor: storyCommentBgColor },
|
|
550
|
+
]}
|
|
551
|
+
onPress={onPressComment}
|
|
552
|
+
>
|
|
553
|
+
<SvgXml xml={storyCommentIcon()} width="25" height="25" />
|
|
554
|
+
<Text style={styles.seen}>{commentsCounts}</Text>
|
|
555
|
+
</TouchableOpacity>
|
|
556
|
+
<TouchableOpacity
|
|
557
|
+
style={[
|
|
558
|
+
styles.iconContainer,
|
|
559
|
+
{
|
|
560
|
+
backgroundColor: storyReactionBgColor,
|
|
561
|
+
},
|
|
562
|
+
]}
|
|
563
|
+
onPress={onPressReaction}
|
|
564
|
+
>
|
|
565
|
+
<SvgXml
|
|
566
|
+
xml={isLiked ? storyLikedIcon : storyLikeIcon}
|
|
567
|
+
width="25"
|
|
568
|
+
height="25"
|
|
569
|
+
/>
|
|
570
|
+
<Text style={styles.seen}>{totalReaction}</Text>
|
|
571
|
+
</TouchableOpacity>
|
|
572
|
+
</View>
|
|
573
|
+
</View>
|
|
574
|
+
)}
|
|
575
|
+
|
|
511
576
|
{openCommentSheet && (
|
|
512
577
|
<Modal
|
|
513
578
|
style={styles.bottomSheet}
|
|
@@ -14,6 +14,7 @@ export const useStyles = () => {
|
|
|
14
14
|
flex: 1,
|
|
15
15
|
width: width,
|
|
16
16
|
backgroundColor: '#000',
|
|
17
|
+
position: 'relative',
|
|
17
18
|
},
|
|
18
19
|
flex: {
|
|
19
20
|
flex: 1,
|
|
@@ -73,7 +74,7 @@ export const useStyles = () => {
|
|
|
73
74
|
fontSize: 14,
|
|
74
75
|
},
|
|
75
76
|
avatarSubText: {
|
|
76
|
-
color:
|
|
77
|
+
color: 'white',
|
|
77
78
|
fontSize: 12,
|
|
78
79
|
},
|
|
79
80
|
closeIconContainer: {
|
|
@@ -219,6 +220,27 @@ export const useStyles = () => {
|
|
|
219
220
|
color: theme.colors.base,
|
|
220
221
|
fontSize: 14,
|
|
221
222
|
},
|
|
223
|
+
errorContainer: {
|
|
224
|
+
width: '100%',
|
|
225
|
+
position: 'absolute',
|
|
226
|
+
bottom: 120,
|
|
227
|
+
left: 0,
|
|
228
|
+
backgroundColor: theme.colors.alert,
|
|
229
|
+
flexDirection: 'row',
|
|
230
|
+
alignItems: 'center',
|
|
231
|
+
justifyContent: 'space-between',
|
|
232
|
+
paddingVertical: 12,
|
|
233
|
+
paddingHorizontal: 16,
|
|
234
|
+
},
|
|
235
|
+
errorContainerLeft: {
|
|
236
|
+
display: 'flex',
|
|
237
|
+
flexDirection: 'row',
|
|
238
|
+
alignItems: 'center',
|
|
239
|
+
gap: 4,
|
|
240
|
+
},
|
|
241
|
+
errorText: {
|
|
242
|
+
color: 'white',
|
|
243
|
+
},
|
|
222
244
|
});
|
|
223
245
|
|
|
224
246
|
return styles;
|