@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,18 +1,21 @@
|
|
|
1
|
-
export const failed =
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export const failed = (
|
|
2
|
+
color: string = 'currentColor'
|
|
3
|
+
) => `<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path d="M12 3.53125C16.7812 3.53125 20.7188 7.46875 20.7188 12.25C20.7188 17.0664 16.7812 20.9688 12 20.9688C7.18359 20.9688 3.28125 17.0664 3.28125 12.25C3.28125 7.46875 7.18359 3.53125 12 3.53125ZM12 19.2812C15.8672 19.2812 19.0312 16.1523 19.0312 12.25C19.0312 8.38281 15.8672 5.21875 12 5.21875C8.09766 5.21875 4.96875 8.38281 4.96875 12.25C4.96875 16.1523 8.09766 19.2812 12 19.2812ZM13.4766 15.625C13.4766 16.4688 12.8086 17.1016 12 17.1016C11.1562 17.1016 10.5234 16.4688 10.5234 15.625C10.5234 14.8164 11.1562 14.1484 12 14.1484C12.8086 14.1484 13.4766 14.8164 13.4766 15.625ZM10.5938 8.20703C10.5938 7.96094 10.7695 7.75 11.0156 7.75H12.9492C13.1953 7.75 13.3711 7.96094 13.3711 8.20703L13.125 12.9883C13.125 13.1992 12.9141 13.375 12.7031 13.375H11.2617C11.0508 13.375 10.8398 13.1992 10.8398 12.9883L10.5938 8.20703Z" fill=${color}/>
|
|
4
5
|
</svg>
|
|
5
6
|
|
|
6
7
|
`;
|
|
7
8
|
|
|
8
|
-
export const success =
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export const success = (
|
|
10
|
+
color: string = 'currentColor'
|
|
11
|
+
) => `<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
12
|
+
<path d="M12 3.53125C16.7812 3.53125 20.7188 7.46875 20.7188 12.25C20.7188 17.0664 16.7812 20.9688 12 20.9688C7.18359 20.9688 3.28125 17.0664 3.28125 12.25C3.28125 7.46875 7.18359 3.53125 12 3.53125ZM12 5.21875C8.09766 5.21875 4.96875 8.38281 4.96875 12.25C4.96875 16.1523 8.09766 19.2812 12 19.2812C15.8672 19.2812 19.0312 16.1523 19.0312 12.25C19.0312 8.38281 15.8672 5.21875 12 5.21875ZM16.9219 9.82422C17.0625 9.96484 17.0625 10.2461 16.9219 10.4219L10.8398 16.4336C10.6641 16.6094 10.418 16.6094 10.2422 16.4336L7.04297 13.1992C6.90234 13.0586 6.90234 12.7773 7.04297 12.6016L7.85156 11.8281C8.02734 11.6523 8.27344 11.6523 8.44922 11.8281L10.5586 13.9375L15.5156 9.01562C15.6914 8.83984 15.9727 8.83984 16.1133 9.01562L16.9219 9.82422Z" fill=${color}/>
|
|
11
13
|
</svg>
|
|
12
14
|
`;
|
|
13
15
|
|
|
14
|
-
export const informative =
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
export const informative = (
|
|
17
|
+
color: string = 'currentColor'
|
|
18
|
+
) => `<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
19
|
+
<path d="M12 3.53125C16.7812 3.53125 20.7188 7.46875 20.7188 12.25C20.7188 17.0664 16.7812 20.9688 12 20.9688C7.18359 20.9688 3.28125 17.0664 3.28125 12.25C3.28125 7.46875 7.18359 3.53125 12 3.53125ZM12 19.2812C15.8672 19.2812 19.0312 16.1523 19.0312 12.25C19.0312 8.38281 15.8672 5.21875 12 5.21875C8.09766 5.21875 4.96875 8.38281 4.96875 12.25C4.96875 16.1523 8.09766 19.2812 12 19.2812ZM12 7.39844C12.8086 7.39844 13.4766 8.06641 13.4766 8.875C13.4766 9.71875 12.8086 10.3516 12 10.3516C11.1562 10.3516 10.5234 9.71875 10.5234 8.875C10.5234 8.06641 11.1562 7.39844 12 7.39844ZM13.9688 16.3281C13.9688 16.5742 13.7578 16.75 13.5469 16.75H10.4531C10.207 16.75 10.0312 16.5742 10.0312 16.3281V15.4844C10.0312 15.2734 10.207 15.0625 10.4531 15.0625H10.875V12.8125H10.4531C10.207 12.8125 10.0312 12.6367 10.0312 12.3906V11.5469C10.0312 11.3359 10.207 11.125 10.4531 11.125H12.7031C12.9141 11.125 13.125 11.3359 13.125 11.5469V15.0625H13.5469C13.7578 15.0625 13.9688 15.2734 13.9688 15.4844V16.3281Z" fill=${color}/>
|
|
17
20
|
</svg>
|
|
18
21
|
`;
|
|
@@ -5,6 +5,7 @@ import { useStory } from '../../hook/useStory';
|
|
|
5
5
|
import { useFocusEffect, useNavigation } from '@react-navigation/native';
|
|
6
6
|
import { SvgXml } from 'react-native-svg';
|
|
7
7
|
import {
|
|
8
|
+
errorIcon,
|
|
8
9
|
storyCircleCreatePlusIcon,
|
|
9
10
|
storyRing,
|
|
10
11
|
} from '../../../svg/svg-xml-list';
|
|
@@ -34,17 +35,18 @@ const CommunityStories = ({ communityId, community }: ICommunityStories) => {
|
|
|
34
35
|
const { getImage } = useFile();
|
|
35
36
|
const [avatarUrl, setAvatarUrl] = useState(undefined);
|
|
36
37
|
const [viewStory, setViewStory] = useState(false);
|
|
37
|
-
const storyRingColor: string[] =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
const storyRingColor: string[] =
|
|
39
|
+
hasStoryPermission && storyTarget?.failedStoriesCount > 0
|
|
40
|
+
? ['#DE1029', '#DE1029']
|
|
41
|
+
: storyTarget?.hasUnseen
|
|
42
|
+
? (getUiKitConfig({
|
|
43
|
+
page: PageID.StoryPage,
|
|
44
|
+
component: ComponentID.StoryTab,
|
|
45
|
+
element: ElementID.StoryRing,
|
|
46
|
+
})?.progress_color as string[]) ?? ['#e2e2e2', '#e2e2e2']
|
|
47
|
+
: stories.length > 0
|
|
48
|
+
? ['#e2e2e2', '#ffffff']
|
|
49
|
+
: ['#ffffff', '#ffffff'];
|
|
48
50
|
|
|
49
51
|
useEffect(() => {
|
|
50
52
|
(async () => {
|
|
@@ -86,6 +88,7 @@ const CommunityStories = ({ communityId, community }: ICommunityStories) => {
|
|
|
86
88
|
setViewStory(false);
|
|
87
89
|
onPressCreateStory();
|
|
88
90
|
}, [onPressCreateStory]);
|
|
91
|
+
|
|
89
92
|
const onPressCommunityName = useCallback(() => {
|
|
90
93
|
setViewStory(false);
|
|
91
94
|
navigation.navigate('CommunityProfilePage', {
|
|
@@ -121,12 +124,18 @@ const CommunityStories = ({ communityId, community }: ICommunityStories) => {
|
|
|
121
124
|
height={48}
|
|
122
125
|
xml={storyRing(storyRingColor[0], storyRingColor[1])}
|
|
123
126
|
/>
|
|
124
|
-
{hasStoryPermission
|
|
125
|
-
|
|
126
|
-
style={styles.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
{hasStoryPermission ? (
|
|
128
|
+
storyTarget?.failedStoriesCount > 0 ? (
|
|
129
|
+
<SvgXml style={styles.errorIcon} xml={errorIcon()} />
|
|
130
|
+
) : (
|
|
131
|
+
<TouchableOpacity onPress={() => onPressCreateStory()}>
|
|
132
|
+
<SvgXml
|
|
133
|
+
style={styles.storyCreateIcon}
|
|
134
|
+
xml={storyCircleCreatePlusIcon()}
|
|
135
|
+
/>
|
|
136
|
+
</TouchableOpacity>
|
|
137
|
+
)
|
|
138
|
+
) : null}
|
|
130
139
|
</TouchableOpacity>
|
|
131
140
|
<Typography.Caption style={styles.base}>Story</Typography.Caption>
|
|
132
141
|
</>
|
|
@@ -91,10 +91,15 @@ export const useStyles = () => {
|
|
|
91
91
|
alignItems: 'center',
|
|
92
92
|
width: 68,
|
|
93
93
|
},
|
|
94
|
+
errorIcon: {
|
|
95
|
+
position: 'absolute',
|
|
96
|
+
right: 8,
|
|
97
|
+
bottom: 0,
|
|
98
|
+
},
|
|
94
99
|
storyCreateIcon: {
|
|
95
100
|
position: 'absolute',
|
|
96
|
-
left:
|
|
97
|
-
top:
|
|
101
|
+
left: 8,
|
|
102
|
+
top: -16,
|
|
98
103
|
},
|
|
99
104
|
base: {
|
|
100
105
|
color: theme.colors.base,
|
|
@@ -8,10 +8,6 @@ import {
|
|
|
8
8
|
} from '../../../providers/file-provider';
|
|
9
9
|
import { closeIcon, toastIcon } from '../../../svg/svg-xml-list';
|
|
10
10
|
import { useStyles } from './styles';
|
|
11
|
-
import { useTheme } from 'react-native-paper';
|
|
12
|
-
import type { MyMD3Theme } from '../../../providers/amity-ui-kit-provider';
|
|
13
|
-
import uiSlice from '../../../redux/slices/uiSlice';
|
|
14
|
-
import { useUIKitDispatch } from '../../../redux/store';
|
|
15
11
|
|
|
16
12
|
interface OverlayImageProps {
|
|
17
13
|
source: string;
|
|
@@ -23,6 +19,7 @@ interface OverlayImageProps {
|
|
|
23
19
|
index: number,
|
|
24
20
|
originalPath: string
|
|
25
21
|
) => void;
|
|
22
|
+
onUploadError?: (hasError: boolean, source: string) => void;
|
|
26
23
|
index?: number;
|
|
27
24
|
isUploaded: boolean;
|
|
28
25
|
fileId?: string;
|
|
@@ -36,6 +33,7 @@ const LoadingImage = ({
|
|
|
36
33
|
onClose,
|
|
37
34
|
index,
|
|
38
35
|
onLoadFinish,
|
|
36
|
+
onUploadError,
|
|
39
37
|
isUploaded = false,
|
|
40
38
|
fileId = '',
|
|
41
39
|
isEditMode = false,
|
|
@@ -43,9 +41,6 @@ const LoadingImage = ({
|
|
|
43
41
|
postId,
|
|
44
42
|
setIsUploading,
|
|
45
43
|
}: OverlayImageProps) => {
|
|
46
|
-
const theme = useTheme() as MyMD3Theme;
|
|
47
|
-
const dispatch = useUIKitDispatch();
|
|
48
|
-
const { showToastMessage } = uiSlice.actions;
|
|
49
44
|
const [loading, setLoading] = useState(true);
|
|
50
45
|
const [progress, setProgress] = useState(0);
|
|
51
46
|
const [isProcess, setIsProcess] = useState<boolean>(false);
|
|
@@ -84,33 +79,39 @@ const LoadingImage = ({
|
|
|
84
79
|
source
|
|
85
80
|
);
|
|
86
81
|
} else {
|
|
82
|
+
setIsUploading(false);
|
|
87
83
|
handleLoadEnd();
|
|
88
|
-
|
|
84
|
+
setIsProcess(false);
|
|
89
85
|
setIsUploadError(true);
|
|
86
|
+
onUploadError?.(true, source);
|
|
90
87
|
}
|
|
91
88
|
} catch (error) {
|
|
92
89
|
handleLoadEnd();
|
|
93
|
-
|
|
90
|
+
setIsProcess(false);
|
|
91
|
+
setIsUploading(false);
|
|
94
92
|
setIsUploadError(true);
|
|
93
|
+
onUploadError?.(true, source);
|
|
95
94
|
}
|
|
96
95
|
}, [
|
|
97
|
-
dispatch,
|
|
98
96
|
handleLoadEnd,
|
|
99
97
|
index,
|
|
100
98
|
onLoadFinish,
|
|
99
|
+
onUploadError,
|
|
101
100
|
setIsUploading,
|
|
102
|
-
showToastMessage,
|
|
103
101
|
source,
|
|
104
102
|
]);
|
|
105
103
|
|
|
106
104
|
const handleDelete = async () => {
|
|
107
|
-
if (!
|
|
108
|
-
if (!isEditMode) {
|
|
105
|
+
if (fileId && !isEditMode) {
|
|
109
106
|
await deleteAmityFile(fileId);
|
|
110
107
|
}
|
|
111
108
|
onClose && onClose(source, fileId, postId);
|
|
112
109
|
};
|
|
113
110
|
useEffect(() => {
|
|
111
|
+
setIsUploadError(false);
|
|
112
|
+
onUploadError?.(false, source);
|
|
113
|
+
setProgress(0);
|
|
114
|
+
setIsProcess(false);
|
|
114
115
|
if (isUploaded) {
|
|
115
116
|
setLoading(false);
|
|
116
117
|
} else {
|
|
@@ -151,19 +152,21 @@ const LoadingImage = ({
|
|
|
151
152
|
)}
|
|
152
153
|
</View>
|
|
153
154
|
)}
|
|
154
|
-
{!loading && isUploadError
|
|
155
|
-
<
|
|
156
|
-
<
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
style={styles.closeButton}
|
|
161
|
-
disabled={loading || isProcess}
|
|
162
|
-
onPress={handleDelete}
|
|
163
|
-
>
|
|
164
|
-
<SvgXml xml={closeIcon(theme.colors.base)} width="12" height="12" />
|
|
165
|
-
</TouchableOpacity>
|
|
155
|
+
{!loading && isUploadError && (
|
|
156
|
+
<View style={styles.failedOverlay}>
|
|
157
|
+
<TouchableOpacity style={styles.errorOverlay} onPress={onRetryUpload}>
|
|
158
|
+
<SvgXml xml={toastIcon()} width="28" height="28" />
|
|
159
|
+
</TouchableOpacity>
|
|
160
|
+
</View>
|
|
166
161
|
)}
|
|
162
|
+
|
|
163
|
+
<TouchableOpacity
|
|
164
|
+
style={styles.closeButton}
|
|
165
|
+
disabled={(loading || isProcess) && !isUploadError}
|
|
166
|
+
onPress={handleDelete}
|
|
167
|
+
>
|
|
168
|
+
<SvgXml xml={closeIcon('white')} width="12" height="12" />
|
|
169
|
+
</TouchableOpacity>
|
|
167
170
|
</View>
|
|
168
171
|
);
|
|
169
172
|
};
|
|
@@ -18,12 +18,28 @@ export const useStyles = () => {
|
|
|
18
18
|
height: '100%',
|
|
19
19
|
resizeMode: 'cover',
|
|
20
20
|
borderRadius: 5,
|
|
21
|
+
position: 'relative',
|
|
21
22
|
},
|
|
22
23
|
overlay: {
|
|
23
24
|
...StyleSheet.absoluteFillObject,
|
|
24
25
|
justifyContent: 'center',
|
|
25
26
|
alignItems: 'center',
|
|
26
27
|
},
|
|
28
|
+
failedOverlay: {
|
|
29
|
+
...StyleSheet.absoluteFillObject,
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
backgroundColor: 'rgba(0, 0, 0, 0.4)',
|
|
33
|
+
borderRadius: 5,
|
|
34
|
+
},
|
|
35
|
+
errorOverlay: {
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
top: '50%',
|
|
38
|
+
left: 0,
|
|
39
|
+
right: 0,
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
},
|
|
27
43
|
progressBar: {
|
|
28
44
|
marginVertical: 10,
|
|
29
45
|
},
|
|
@@ -40,6 +56,7 @@ export const useStyles = () => {
|
|
|
40
56
|
padding: 7,
|
|
41
57
|
backgroundColor: 'rgba(0, 0, 0, 0.4)',
|
|
42
58
|
borderRadius: 72,
|
|
59
|
+
zIndex: 10,
|
|
43
60
|
},
|
|
44
61
|
});
|
|
45
62
|
};
|
|
@@ -18,8 +18,6 @@ import { useStyles } from './styles';
|
|
|
18
18
|
import Video from 'react-native-video';
|
|
19
19
|
import { useNavigation } from '@react-navigation/native';
|
|
20
20
|
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
21
|
-
import { useTheme } from 'react-native-paper';
|
|
22
|
-
import type { MyMD3Theme } from '../../../providers/amity-ui-kit-provider';
|
|
23
21
|
import uiSlice from '../../../redux/slices/uiSlice';
|
|
24
22
|
import { createVideoThumbnail } from 'react-native-compressor';
|
|
25
23
|
import { useUIKitDispatch } from '../../../redux/store';
|
|
@@ -35,6 +33,7 @@ interface OverlayImageProps {
|
|
|
35
33
|
originalPath: string,
|
|
36
34
|
thumbNail: string
|
|
37
35
|
) => void;
|
|
36
|
+
onUploadError?: (hasError: boolean, source: string) => void;
|
|
38
37
|
index?: number;
|
|
39
38
|
isUploaded: boolean;
|
|
40
39
|
fileId?: string;
|
|
@@ -50,6 +49,7 @@ const LoadingVideo = ({
|
|
|
50
49
|
onClose,
|
|
51
50
|
index,
|
|
52
51
|
onLoadFinish,
|
|
52
|
+
onUploadError,
|
|
53
53
|
isUploaded = false,
|
|
54
54
|
thumbNail,
|
|
55
55
|
onPlay,
|
|
@@ -59,7 +59,6 @@ const LoadingVideo = ({
|
|
|
59
59
|
postId,
|
|
60
60
|
setIsUploading,
|
|
61
61
|
}: OverlayImageProps) => {
|
|
62
|
-
const theme = useTheme() as MyMD3Theme;
|
|
63
62
|
const dispatch = useUIKitDispatch();
|
|
64
63
|
const { showToastMessage } = uiSlice.actions;
|
|
65
64
|
const [loading, setLoading] = useState(true);
|
|
@@ -129,23 +128,30 @@ const LoadingVideo = ({
|
|
|
129
128
|
} else {
|
|
130
129
|
handleLoadEnd();
|
|
131
130
|
dispatch(showToastMessage({ toastMessage: 'Failed to upload file' }));
|
|
131
|
+
setIsProcess(false);
|
|
132
132
|
setIsUploadError(true);
|
|
133
|
+
onUploadError?.(true, source);
|
|
133
134
|
}
|
|
134
135
|
} catch (error) {
|
|
135
136
|
handleLoadEnd();
|
|
136
137
|
dispatch(showToastMessage({ toastMessage: 'Failed to upload file' }));
|
|
138
|
+
setIsProcess(false);
|
|
137
139
|
setIsUploadError(true);
|
|
140
|
+
onUploadError?.(true, source);
|
|
138
141
|
}
|
|
139
142
|
}, [source]);
|
|
140
143
|
|
|
141
144
|
const handleDelete = async () => {
|
|
142
|
-
if (!
|
|
143
|
-
if (!isEditMode) {
|
|
145
|
+
if (fileId && !isEditMode) {
|
|
144
146
|
await deleteAmityFile(fileId);
|
|
145
147
|
}
|
|
146
148
|
onClose && onClose(source, fileId, postId);
|
|
147
149
|
};
|
|
148
150
|
useEffect(() => {
|
|
151
|
+
setIsUploadError(false);
|
|
152
|
+
onUploadError?.(false, source);
|
|
153
|
+
setProgress(0);
|
|
154
|
+
setIsProcess(false);
|
|
149
155
|
if (isUploaded) {
|
|
150
156
|
setLoading(false);
|
|
151
157
|
} else {
|
|
@@ -216,10 +222,10 @@ const LoadingVideo = ({
|
|
|
216
222
|
) : (
|
|
217
223
|
<TouchableOpacity
|
|
218
224
|
style={styles.closeButton}
|
|
219
|
-
disabled={loading || isProcess}
|
|
225
|
+
disabled={(loading || isProcess) && !isUploadError}
|
|
220
226
|
onPress={handleDelete}
|
|
221
227
|
>
|
|
222
|
-
<SvgXml xml={closeIcon(
|
|
228
|
+
<SvgXml xml={closeIcon('white')} width="12" height="12" />
|
|
223
229
|
</TouchableOpacity>
|
|
224
230
|
)}
|
|
225
231
|
</View>
|
|
@@ -2,12 +2,13 @@ import { Image, Text, TouchableOpacity, View } from 'react-native';
|
|
|
2
2
|
import React, { FC, useEffect, useState } from 'react';
|
|
3
3
|
import { SvgXml } from 'react-native-svg';
|
|
4
4
|
import {
|
|
5
|
+
errorIcon,
|
|
5
6
|
officialIcon,
|
|
6
7
|
privateIcon,
|
|
7
8
|
storyRing,
|
|
8
9
|
} from '../../../svg/svg-xml-list';
|
|
9
10
|
import { ComponentID, ElementID, ImageSizeState, PageID } from '../../enum';
|
|
10
|
-
import { useFile } from '../../hook';
|
|
11
|
+
import { useFile, useStoryPermission } from '../../hook';
|
|
11
12
|
import useConfig from '../../hook/useConfig';
|
|
12
13
|
import { useStyles } from './styles';
|
|
13
14
|
import { CommunityRepository } from '@amityco/ts-sdk-react-native';
|
|
@@ -26,18 +27,20 @@ const StoryCircleItem: FC<IStoryCircleItem> = ({
|
|
|
26
27
|
const theme = useTheme() as MyMD3Theme;
|
|
27
28
|
const [avatarUrl, setAvatarUrl] = useState(null);
|
|
28
29
|
const [communityData, setCommunityData] = useState<Amity.Community>(null);
|
|
30
|
+
const hasStoryPermission = useStoryPermission(storyTarget.targetId);
|
|
29
31
|
const { getImage } = useFile();
|
|
30
32
|
const { getUiKitConfig } = useConfig();
|
|
31
33
|
const styles = useStyles();
|
|
32
|
-
const storyRingColor: string[] =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
const storyRingColor: string[] =
|
|
35
|
+
hasStoryPermission && storyTarget?.failedStoriesCount > 0
|
|
36
|
+
? ['#DE1029', '#DE1029']
|
|
37
|
+
: storyTarget?.hasUnseen
|
|
38
|
+
? (getUiKitConfig({
|
|
39
|
+
page: PageID.StoryPage,
|
|
40
|
+
component: ComponentID.StoryTab,
|
|
41
|
+
element: ElementID.StoryRing,
|
|
42
|
+
})?.progress_color as string[]) ?? ['#e2e2e2', '#e2e2e2']
|
|
43
|
+
: ['#e2e2e2', '#e2e2e2'];
|
|
41
44
|
|
|
42
45
|
useEffect(() => {
|
|
43
46
|
if (storyTarget.targetType !== 'community') return;
|
|
@@ -80,12 +83,16 @@ const StoryCircleItem: FC<IStoryCircleItem> = ({
|
|
|
80
83
|
height={68}
|
|
81
84
|
xml={storyRing(storyRingColor[0], storyRingColor[1])}
|
|
82
85
|
/>
|
|
83
|
-
{
|
|
86
|
+
{hasStoryPermission && storyTarget?.failedStoriesCount > 0 ? (
|
|
87
|
+
<View style={styles.errorIcon}>
|
|
88
|
+
<SvgXml width={16} height={16} xml={errorIcon()} />
|
|
89
|
+
</View>
|
|
90
|
+
) : communityData?.isOfficial ? (
|
|
84
91
|
<SvgXml
|
|
85
92
|
style={styles.officialIcon}
|
|
86
93
|
xml={officialIcon(theme.colors.primary)}
|
|
87
94
|
/>
|
|
88
|
-
)}
|
|
95
|
+
) : null}
|
|
89
96
|
<View style={styles.textRow}>
|
|
90
97
|
{!communityData?.isPublic && (
|
|
91
98
|
<SvgXml width={17} height={17} xml={privateIcon(theme.colors.base)} />
|