agora-appbuilder-core 4.0.21-beta.2 → 4.0.21-beta.3
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/package.json +1 -1
- package/template/customization-api/typeDefinition.ts +8 -4
- package/template/customization-api/types.ts +1 -1
- package/template/src/app-state/useVirtualBackground.ts +41 -10
- package/template/src/components/virtual-background/VBCard.native.tsx +6 -8
- package/template/src/components/virtual-background/VBCard.tsx +5 -8
- package/template/src/components/virtual-background/VBPanel.tsx +1 -2
- package/template/src/components/virtual-background/VButils.native.ts +1 -1
- package/template/src/components/virtual-background/VButils.ts +1 -1
- package/template/src/components/virtual-background/imagePaths.ts +15 -20
- package/template/src/components/virtual-background/useVB.native.tsx +2 -4
- package/template/src/components/virtual-background/useVB.tsx +2 -9
- package/template/src/language/default-labels/precallScreenLabels.ts +18 -9
- package/template/src/subComponents/chat/ChatEmoji.tsx +1 -0
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@ export interface PreCallInterface extends BeforeAndAfterInterface {
|
|
|
38
38
|
deviceSelect?: React.ComponentType;
|
|
39
39
|
joinButton?: React.ComponentType;
|
|
40
40
|
textBox?: React.ComponentType;
|
|
41
|
-
virtualBackgroundPanel?: React.ComponentType
|
|
41
|
+
virtualBackgroundPanel?: React.ComponentType<VBPanelProps>;
|
|
42
42
|
}
|
|
43
43
|
export interface ChatCmpInterface {
|
|
44
44
|
//commented for v1 release
|
|
@@ -59,6 +59,10 @@ export interface LayoutItem {
|
|
|
59
59
|
component: LayoutComponent;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
export interface VBPanelProps {
|
|
63
|
+
isOnPrecall?: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
62
66
|
export type ToolbarType = React.ComponentType | Array<ToolbarCustomItem>;
|
|
63
67
|
export interface VideoCallInterface extends BeforeAndAfterInterface {
|
|
64
68
|
// commented for v1 release
|
|
@@ -71,7 +75,7 @@ export interface VideoCallInterface extends BeforeAndAfterInterface {
|
|
|
71
75
|
chat?: ChatCmpInterface;
|
|
72
76
|
captionPanel?: React.ComponentType;
|
|
73
77
|
transcriptPanel?: React.ComponentType;
|
|
74
|
-
virtualBackgroundPanel?: React.ComponentType
|
|
78
|
+
virtualBackgroundPanel?: React.ComponentType<VBPanelProps>;
|
|
75
79
|
customLayout?: (layouts: LayoutItem[]) => LayoutItem[];
|
|
76
80
|
wrapper?: React.ComponentType;
|
|
77
81
|
invitePopup?: {
|
|
@@ -86,13 +90,13 @@ export type ComponentsInterface = {
|
|
|
86
90
|
*/
|
|
87
91
|
appRoot?: React.ComponentType;
|
|
88
92
|
// commented for v1 release
|
|
89
|
-
precall?: PreCallInterface
|
|
93
|
+
precall?: PreCallInterface;
|
|
90
94
|
preferenceWrapper?: React.ComponentType;
|
|
91
95
|
//precall?: React.ComponentType;
|
|
92
96
|
//create?: React.ComponentType;
|
|
93
97
|
//share?: React.ComponentType;
|
|
94
98
|
//join?: React.ComponentType;
|
|
95
|
-
videoCall?: VideoCallInterface
|
|
99
|
+
videoCall?: VideoCallInterface;
|
|
96
100
|
};
|
|
97
101
|
|
|
98
102
|
export interface CustomRoutesInterface {
|
|
@@ -34,6 +34,6 @@ export {UploadStatus} from '../src/components/chat-ui/useChatUIControls';
|
|
|
34
34
|
export {type VBPanelProps} from '../src/components/virtual-background/VBPanel';
|
|
35
35
|
export {
|
|
36
36
|
type VBMode,
|
|
37
|
-
type Option,
|
|
37
|
+
type Option as VBOption,
|
|
38
38
|
} from '../src/components/virtual-background/useVB';
|
|
39
39
|
export {type VBCardProps} from '../src/components/virtual-background/VBCard';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {useEffect, useRef} from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
convertBlobToBase64,
|
|
4
|
+
retrieveImagesFromStorage,
|
|
5
|
+
} from '../../src/components/virtual-background/VButils';
|
|
3
6
|
import {
|
|
4
7
|
Option,
|
|
5
8
|
useVB,
|
|
@@ -21,8 +24,9 @@ export interface virtualBackgroundInterface {
|
|
|
21
24
|
addVirtualBackgrounds: (options: Option[]) => void;
|
|
22
25
|
setVBPreview: (type: VBMode, path: string) => void;
|
|
23
26
|
applyVirtualBackground: () => void;
|
|
24
|
-
|
|
27
|
+
isVirtualBackgroundPanelOpen: boolean;
|
|
25
28
|
hideVirtualBackgroundPanel: () => void;
|
|
29
|
+
showVirtualBackgroundPanel: () => void;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export const useVirtualBackground: () => virtualBackgroundInterface = () => {
|
|
@@ -43,17 +47,17 @@ export const useVirtualBackground: () => virtualBackgroundInterface = () => {
|
|
|
43
47
|
const {setSidePanel} = useSidePanel();
|
|
44
48
|
|
|
45
49
|
const updateVBOptions = async (options: Option[]) => {
|
|
46
|
-
console.warn('Sdsd');
|
|
47
50
|
const vbOptions = [];
|
|
48
51
|
for (let i = 0; i < options.length; i++) {
|
|
49
52
|
const option = options[i];
|
|
50
53
|
|
|
51
|
-
if (option.type === 'image'
|
|
54
|
+
if (option.type === 'image') {
|
|
52
55
|
const imgObj = {
|
|
53
56
|
type: 'image',
|
|
54
57
|
icon: 'vb',
|
|
55
58
|
path: '',
|
|
56
59
|
id: `VBOption_${i + 1}`,
|
|
60
|
+
isSelected: false,
|
|
57
61
|
};
|
|
58
62
|
try {
|
|
59
63
|
imgObj.path = await convertBlobToBase64(option.path);
|
|
@@ -65,14 +69,27 @@ export const useVirtualBackground: () => virtualBackgroundInterface = () => {
|
|
|
65
69
|
}
|
|
66
70
|
vbOptions.push(imgObj);
|
|
67
71
|
if (option?.isSelected && !selectedImage) {
|
|
72
|
+
imgObj.isSelected = true;
|
|
68
73
|
setSelectedImage(imgObj.path);
|
|
69
74
|
setVBmode('image');
|
|
70
75
|
}
|
|
71
76
|
} else {
|
|
77
|
+
option.isSelected = false;
|
|
72
78
|
vbOptions.push(option);
|
|
73
79
|
}
|
|
74
80
|
}
|
|
75
|
-
|
|
81
|
+
|
|
82
|
+
const customImages = await retrieveImagesFromStorage();
|
|
83
|
+
const savedImagesArr = customImages?.map(
|
|
84
|
+
base64Data =>
|
|
85
|
+
({
|
|
86
|
+
type: 'image',
|
|
87
|
+
icon: 'vb',
|
|
88
|
+
path: base64Data,
|
|
89
|
+
} as Option),
|
|
90
|
+
);
|
|
91
|
+
// also fetch from db
|
|
92
|
+
setOptions([...vbOptions, ...savedImagesArr]);
|
|
76
93
|
};
|
|
77
94
|
|
|
78
95
|
const setVBPreview = (type: VBMode, path: string) => {
|
|
@@ -83,20 +100,33 @@ export const useVirtualBackground: () => virtualBackgroundInterface = () => {
|
|
|
83
100
|
}
|
|
84
101
|
setVBmode(type);
|
|
85
102
|
setSaveVB(false);
|
|
103
|
+
// update selected options
|
|
104
|
+
// Update selected options
|
|
105
|
+
options.forEach(option => {
|
|
106
|
+
// Reset isSelected for all options
|
|
107
|
+
option.isSelected = false;
|
|
108
|
+
|
|
109
|
+
// Set isSelected for the matching option
|
|
110
|
+
if (type === 'image' && path && option.path === path) {
|
|
111
|
+
option.isSelected = true;
|
|
112
|
+
} else if (type !== 'image' && type === option.type) {
|
|
113
|
+
option.isSelected = true;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
86
116
|
};
|
|
87
117
|
|
|
88
118
|
const applyVirtualBackground = () => {
|
|
89
119
|
setSaveVB(true);
|
|
90
120
|
};
|
|
91
121
|
|
|
92
|
-
const isVirtualBackgroundSelected = (type: VBMode, path: string) => {
|
|
93
|
-
return path ? path === selectedImage : type === vbMode;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
122
|
const hideVirtualBackgroundPanel = () => {
|
|
97
123
|
setSidePanel(SidePanelType.None);
|
|
98
124
|
setIsVBActive(false);
|
|
99
125
|
};
|
|
126
|
+
const showVirtualBackgroundPanel = () => {
|
|
127
|
+
setSidePanel(SidePanelType.VirtualBackground);
|
|
128
|
+
setIsVBActive(true);
|
|
129
|
+
};
|
|
100
130
|
|
|
101
131
|
//TODO: later
|
|
102
132
|
// const applyVirtualBackground = (config: VBConfig) => {
|
|
@@ -111,7 +141,8 @@ export const useVirtualBackground: () => virtualBackgroundInterface = () => {
|
|
|
111
141
|
addVirtualBackgrounds: updateVBOptions,
|
|
112
142
|
setVBPreview,
|
|
113
143
|
applyVirtualBackground,
|
|
114
|
-
|
|
144
|
+
isVirtualBackgroundPanelOpen: isVBActive,
|
|
115
145
|
hideVirtualBackgroundPanel,
|
|
146
|
+
showVirtualBackgroundPanel,
|
|
116
147
|
};
|
|
117
148
|
};
|
|
@@ -15,7 +15,7 @@ import DocumentPicker from 'react-native-document-picker';
|
|
|
15
15
|
import Toast from '../../../react-native-toast-message';
|
|
16
16
|
import RNFS from 'react-native-fs';
|
|
17
17
|
import {saveImagesToAsyncStorage} from './VButils.native';
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
import {useString} from '../../../src/utils/useString';
|
|
20
20
|
import {
|
|
21
21
|
vbPanelImageSizeLimitErrorToastHeading,
|
|
@@ -25,14 +25,14 @@ import {
|
|
|
25
25
|
vbPanelImageUploadErrorToastHeading,
|
|
26
26
|
vbPanelImageUploadErrorToastSubHeading,
|
|
27
27
|
} from '../../../src/language/default-labels/videoCallScreenLabels';
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
import {vbOptionText} from '../../../src/language/default-labels/precallScreenLabels';
|
|
29
30
|
|
|
30
31
|
interface VBCardProps {
|
|
31
32
|
type: VBMode;
|
|
32
33
|
icon: keyof IconsInterface;
|
|
33
34
|
path?: ImageSourcePropType;
|
|
34
35
|
label?: string;
|
|
35
|
-
translationKey?: keyof TextDataInterface;
|
|
36
36
|
position?: number;
|
|
37
37
|
isOnPrecall?: boolean;
|
|
38
38
|
isMobile?: boolean;
|
|
@@ -61,7 +61,6 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
61
61
|
position,
|
|
62
62
|
isOnPrecall,
|
|
63
63
|
isMobile,
|
|
64
|
-
translationKey,
|
|
65
64
|
}) => {
|
|
66
65
|
const {
|
|
67
66
|
setVBmode,
|
|
@@ -83,7 +82,7 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
83
82
|
const uploadErrorSubHeading = useString(
|
|
84
83
|
vbPanelImageUploadErrorToastSubHeading,
|
|
85
84
|
)();
|
|
86
|
-
const
|
|
85
|
+
const vbOptionLabel = useString<VBMode>(vbOptionText);
|
|
87
86
|
|
|
88
87
|
const isSelected = path ? path == selectedImage : vbMode === type;
|
|
89
88
|
|
|
@@ -136,7 +135,6 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
136
135
|
type: 'image' as VBMode,
|
|
137
136
|
icon: 'vb' as keyof IconsInterface,
|
|
138
137
|
path: base64Data,
|
|
139
|
-
id: getUniqueID(),
|
|
140
138
|
};
|
|
141
139
|
|
|
142
140
|
setOptions(prevOptions => {
|
|
@@ -201,7 +199,7 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
201
199
|
name={icon}
|
|
202
200
|
tintColor={$config.SECONDARY_ACTION_COLOR}
|
|
203
201
|
/>
|
|
204
|
-
{label
|
|
202
|
+
{label ? (
|
|
205
203
|
<View>
|
|
206
204
|
<Text
|
|
207
205
|
style={{
|
|
@@ -211,7 +209,7 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
211
209
|
color: $config.SECONDARY_ACTION_COLOR,
|
|
212
210
|
paddingVertical: 4,
|
|
213
211
|
}}>
|
|
214
|
-
{
|
|
212
|
+
{vbOptionLabel(type)}
|
|
215
213
|
</Text>
|
|
216
214
|
</View>
|
|
217
215
|
) : (
|
|
@@ -6,9 +6,8 @@ import {IconsInterface} from '../../atoms/CustomIcon';
|
|
|
6
6
|
import Toast from '../../../react-native-toast-message';
|
|
7
7
|
import {saveImagesToIndexDB, convertBlobToBase64} from './VButils';
|
|
8
8
|
import ImageIcon from '../../atoms/ImageIcon';
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
import {useString} from '../../../src/utils/useString';
|
|
11
|
-
import {TextDataInterface} from '../../../src/language/default-labels';
|
|
12
11
|
import {
|
|
13
12
|
vbPanelImageSizeLimitErrorToastHeading,
|
|
14
13
|
vbPanelImageSizeLimitErrorToastSubHeading,
|
|
@@ -18,12 +17,12 @@ import {
|
|
|
18
17
|
vbPanelImageUploadErrorToastSubHeading,
|
|
19
18
|
} from '../../../src/language/default-labels/videoCallScreenLabels';
|
|
20
19
|
import {LogSource, logger} from '../../logger/AppBuilderLogger';
|
|
20
|
+
import {vbOptionText} from '../../../src/language/default-labels/precallScreenLabels';
|
|
21
21
|
|
|
22
22
|
export interface VBCardProps {
|
|
23
23
|
type: VBMode;
|
|
24
24
|
icon: keyof IconsInterface;
|
|
25
25
|
path?: string & {default?: string};
|
|
26
|
-
translationKey?: keyof TextDataInterface;
|
|
27
26
|
label?: string;
|
|
28
27
|
position?: number;
|
|
29
28
|
isOnPrecall?: boolean;
|
|
@@ -53,7 +52,6 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
53
52
|
position,
|
|
54
53
|
isOnPrecall,
|
|
55
54
|
isMobile,
|
|
56
|
-
translationKey,
|
|
57
55
|
}) => {
|
|
58
56
|
const {
|
|
59
57
|
setVBmode,
|
|
@@ -76,8 +74,8 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
76
74
|
vbPanelImageUploadErrorToastSubHeading,
|
|
77
75
|
)();
|
|
78
76
|
|
|
79
|
-
const translation = useString(translationKey)();
|
|
80
77
|
const fileInputRef = useRef<HTMLInputElement | null>(null);
|
|
78
|
+
const vbOptionLabel = useString<VBMode>(vbOptionText);
|
|
81
79
|
|
|
82
80
|
const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
83
81
|
logger.log(
|
|
@@ -138,7 +136,6 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
138
136
|
type: 'image',
|
|
139
137
|
icon: 'vb',
|
|
140
138
|
path: base64Data,
|
|
141
|
-
id: getUniqueID(),
|
|
142
139
|
};
|
|
143
140
|
setOptions(prevOptions => {
|
|
144
141
|
const updatedOptions = [...prevOptions];
|
|
@@ -232,7 +229,7 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
232
229
|
name={icon}
|
|
233
230
|
tintColor={$config.SECONDARY_ACTION_COLOR}
|
|
234
231
|
/>
|
|
235
|
-
{label
|
|
232
|
+
{label ? (
|
|
236
233
|
<Text
|
|
237
234
|
style={{
|
|
238
235
|
fontSize: ThemeConfig.FontSize.tiny,
|
|
@@ -241,7 +238,7 @@ const VBCard: React.FC<VBCardProps> = ({
|
|
|
241
238
|
color: $config.SECONDARY_ACTION_COLOR,
|
|
242
239
|
paddingVertical: 4,
|
|
243
240
|
}}>
|
|
244
|
-
{
|
|
241
|
+
{vbOptionLabel(type)}
|
|
245
242
|
</Text>
|
|
246
243
|
) : (
|
|
247
244
|
<></>
|
|
@@ -167,12 +167,11 @@ const VBPanel = (props?: VBPanelProps) => {
|
|
|
167
167
|
decelerationRate={0}>
|
|
168
168
|
{options.map((item, index) => (
|
|
169
169
|
<VBCard
|
|
170
|
-
key={
|
|
170
|
+
key={`VBOption_${index + 1}`}
|
|
171
171
|
type={item.type}
|
|
172
172
|
icon={item.icon}
|
|
173
173
|
path={item.path}
|
|
174
174
|
label={item?.label}
|
|
175
|
-
translationKey={item?.translationKey}
|
|
176
175
|
position={index + 1}
|
|
177
176
|
isOnPrecall={isOnPrecall}
|
|
178
177
|
isMobile={isMobile}
|
|
@@ -24,7 +24,7 @@ export const saveImagesToAsyncStorage = async (
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export const
|
|
27
|
+
export const retrieveImagesFromStorage = async (): Promise<string[]> => {
|
|
28
28
|
try {
|
|
29
29
|
const keys = await AsyncStorage.getAllKeys();
|
|
30
30
|
|
|
@@ -72,7 +72,7 @@ export const saveImagesToIndexDB = async (
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
export const
|
|
75
|
+
export const retrieveImagesFromStorage = async (): Promise<string[]> => {
|
|
76
76
|
return new Promise<string[]>(async (resolve, reject) => {
|
|
77
77
|
try {
|
|
78
78
|
const db = await openIndexedDB('vb-image-db', 1);
|
|
@@ -1,86 +1,81 @@
|
|
|
1
1
|
import {Option} from './useVB';
|
|
2
2
|
import images from './images';
|
|
3
|
-
import {
|
|
4
|
-
vbPanelOptionBlurText,
|
|
5
|
-
vbPanelOptionCustomText,
|
|
6
|
-
vbPanelOptionNoneText,
|
|
7
|
-
} from '../../language/default-labels/precallScreenLabels';
|
|
8
3
|
|
|
9
4
|
const imagePathsArray: Option[] = [
|
|
10
5
|
{
|
|
11
6
|
type: 'none',
|
|
12
7
|
icon: 'remove',
|
|
13
8
|
label: 'None',
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
|
|
10
|
+
isSelected: false,
|
|
16
11
|
},
|
|
17
12
|
{
|
|
18
13
|
type: 'blur',
|
|
19
14
|
icon: 'blur',
|
|
20
15
|
label: 'Blur',
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
|
|
17
|
+
isSelected: false,
|
|
23
18
|
},
|
|
24
19
|
{
|
|
25
20
|
type: 'custom',
|
|
26
21
|
icon: 'upload-new',
|
|
27
22
|
label: 'Custom',
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
|
|
24
|
+
isSelected: false,
|
|
30
25
|
},
|
|
31
26
|
{
|
|
32
27
|
type: 'image',
|
|
33
28
|
icon: 'vb',
|
|
34
29
|
path: images.bookImageBase64,
|
|
35
|
-
|
|
30
|
+
isSelected: false,
|
|
36
31
|
},
|
|
37
32
|
{
|
|
38
33
|
type: 'image',
|
|
39
34
|
icon: 'vb',
|
|
40
35
|
path: images.beachImageBase64,
|
|
41
|
-
|
|
36
|
+
isSelected: false,
|
|
42
37
|
},
|
|
43
38
|
{
|
|
44
39
|
type: 'image',
|
|
45
40
|
icon: 'vb',
|
|
46
41
|
path: images.office1ImageBase64,
|
|
47
|
-
|
|
42
|
+
isSelected: false,
|
|
48
43
|
},
|
|
49
44
|
{
|
|
50
45
|
type: 'image',
|
|
51
46
|
icon: 'vb',
|
|
52
47
|
path: images.bedroomImageBase64,
|
|
53
|
-
|
|
48
|
+
isSelected: false,
|
|
54
49
|
},
|
|
55
50
|
{
|
|
56
51
|
type: 'image',
|
|
57
52
|
icon: 'vb',
|
|
58
53
|
path: images.officeImageBase64,
|
|
59
|
-
|
|
54
|
+
isSelected: false,
|
|
60
55
|
},
|
|
61
56
|
{
|
|
62
57
|
type: 'image',
|
|
63
58
|
icon: 'vb',
|
|
64
59
|
path: images.earthImageBase64,
|
|
65
|
-
|
|
60
|
+
isSelected: false,
|
|
66
61
|
},
|
|
67
62
|
{
|
|
68
63
|
type: 'image',
|
|
69
64
|
icon: 'vb',
|
|
70
65
|
path: images.mountainsImageBase64,
|
|
71
|
-
|
|
66
|
+
isSelected: false,
|
|
72
67
|
},
|
|
73
68
|
{
|
|
74
69
|
type: 'image',
|
|
75
70
|
icon: 'vb',
|
|
76
71
|
path: images.plantsImageBase64,
|
|
77
|
-
|
|
72
|
+
isSelected: false,
|
|
78
73
|
},
|
|
79
74
|
{
|
|
80
75
|
type: 'image',
|
|
81
76
|
icon: 'vb',
|
|
82
77
|
path: images.wallImageBase64,
|
|
83
|
-
|
|
78
|
+
isSelected: false,
|
|
84
79
|
},
|
|
85
80
|
];
|
|
86
81
|
|
|
@@ -2,7 +2,7 @@ import {createHook} from 'customization-implementation';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import {IconsInterface} from '../../atoms/CustomIcon';
|
|
4
4
|
import {ILocalVideoTrack} from 'agora-rtc-sdk-ng';
|
|
5
|
-
import {
|
|
5
|
+
import {retrieveImagesFromStorage} from './VButils.native';
|
|
6
6
|
|
|
7
7
|
import RtcEngine, {
|
|
8
8
|
BackgroundBlurDegree,
|
|
@@ -13,7 +13,6 @@ import {useLocalUserInfo, useRtc} from 'customization-api';
|
|
|
13
13
|
import RNFS from 'react-native-fs';
|
|
14
14
|
import {ImageSourcePropType} from 'react-native/types';
|
|
15
15
|
import imagePathsArray from './imagePaths';
|
|
16
|
-
import getUniqueID from '../../../src/utils/getUniqueID';
|
|
17
16
|
import {LogSource, logger} from '../../logger/AppBuilderLogger';
|
|
18
17
|
import {ToggleState} from '../../../agora-rn-uikit';
|
|
19
18
|
|
|
@@ -96,7 +95,7 @@ const VBProvider: React.FC = ({children}) => {
|
|
|
96
95
|
React.useEffect(() => {
|
|
97
96
|
const fetchData = async () => {
|
|
98
97
|
try {
|
|
99
|
-
const customImages = await
|
|
98
|
+
const customImages = await retrieveImagesFromStorage();
|
|
100
99
|
logger.debug(
|
|
101
100
|
LogSource.Internals,
|
|
102
101
|
'VIRTUAL_BACKGROUND',
|
|
@@ -111,7 +110,6 @@ const VBProvider: React.FC = ({children}) => {
|
|
|
111
110
|
type: 'image',
|
|
112
111
|
icon: 'vb',
|
|
113
112
|
path: base64Data,
|
|
114
|
-
id: getUniqueID(),
|
|
115
113
|
} as Option),
|
|
116
114
|
) || []),
|
|
117
115
|
]);
|
|
@@ -15,11 +15,8 @@ import wasm1 from '../../wasms/agora-virtual-background.wasm';
|
|
|
15
15
|
import {IconsInterface} from '../../atoms/CustomIcon';
|
|
16
16
|
import {PropsContext, ToggleState} from '../../../agora-rn-uikit';
|
|
17
17
|
import {isMobileUA} from '../../utils/common';
|
|
18
|
-
import {
|
|
18
|
+
import {retrieveImagesFromStorage} from './VButils';
|
|
19
19
|
import imagePathsArray from './imagePaths';
|
|
20
|
-
import getUniqueID from '../../../src/utils/getUniqueID';
|
|
21
|
-
import {TextDataInterface} from '../../../src/language/default-labels';
|
|
22
|
-
//@ts-ignore
|
|
23
20
|
|
|
24
21
|
export type VBMode = 'blur' | 'image' | 'custom' | 'none';
|
|
25
22
|
|
|
@@ -28,9 +25,6 @@ export type Option = {
|
|
|
28
25
|
icon?: keyof IconsInterface;
|
|
29
26
|
path?: string & {default?: string};
|
|
30
27
|
label?: string;
|
|
31
|
-
id?: string;
|
|
32
|
-
translationKey?: keyof TextDataInterface;
|
|
33
|
-
isBase64Image?: boolean;
|
|
34
28
|
isSelected?: boolean;
|
|
35
29
|
};
|
|
36
30
|
|
|
@@ -156,7 +150,7 @@ const VBProvider: React.FC = ({children}) => {
|
|
|
156
150
|
React.useEffect(() => {
|
|
157
151
|
const fetchData = async () => {
|
|
158
152
|
try {
|
|
159
|
-
const customImages = await
|
|
153
|
+
const customImages = await retrieveImagesFromStorage();
|
|
160
154
|
setOptions((prevOptions: Option[]) => [
|
|
161
155
|
...prevOptions,
|
|
162
156
|
...(customImages?.map(
|
|
@@ -165,7 +159,6 @@ const VBProvider: React.FC = ({children}) => {
|
|
|
165
159
|
type: 'image',
|
|
166
160
|
icon: 'vb',
|
|
167
161
|
path: base64Data,
|
|
168
|
-
id: getUniqueID(),
|
|
169
162
|
} as Option),
|
|
170
163
|
) || []),
|
|
171
164
|
]);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {ClientRoleType} from '../../../agora-rn-uikit';
|
|
2
2
|
import {I18nBaseType, I18nConditionalType} from '../i18nTypes';
|
|
3
|
+
import {VBMode} from '../../components/virtual-background/useVB';
|
|
3
4
|
|
|
4
5
|
export interface PrecallJoinBtnTextInterface {
|
|
5
6
|
ready: boolean;
|
|
@@ -45,9 +46,8 @@ export const precallInputGettingName = 'precallInputGettingName';
|
|
|
45
46
|
|
|
46
47
|
export const vbPanelHeading = 'vbPanelHeading';
|
|
47
48
|
export const vbPanelInfo = 'vbPanelInfo';
|
|
48
|
-
|
|
49
|
-
export const
|
|
50
|
-
export const vbPanelOptionCustomText = 'vbPanelOptionCustomText';
|
|
49
|
+
|
|
50
|
+
export const vbOptionText = 'vbOptionText';
|
|
51
51
|
|
|
52
52
|
export interface I18nPrecallScreenLabelsInterface {
|
|
53
53
|
[permissionPopupHeading]?: I18nBaseType;
|
|
@@ -81,9 +81,8 @@ export interface I18nPrecallScreenLabelsInterface {
|
|
|
81
81
|
|
|
82
82
|
[vbPanelHeading]?: I18nBaseType;
|
|
83
83
|
[vbPanelInfo]?: I18nConditionalType;
|
|
84
|
-
|
|
85
|
-
[
|
|
86
|
-
[vbPanelOptionCustomText]?: I18nBaseType;
|
|
84
|
+
|
|
85
|
+
[vbOptionText]?: I18nBaseType<VBMode>;
|
|
87
86
|
|
|
88
87
|
[precallInputGettingName]?: I18nBaseType;
|
|
89
88
|
}
|
|
@@ -151,7 +150,17 @@ export const PrecallScreenLabels: I18nPrecallScreenLabelsInterface = {
|
|
|
151
150
|
isCamOn
|
|
152
151
|
? 'Camera is currently off. Selected background will be applied as soon as your camera turns on.'
|
|
153
152
|
: 'Your camera is switched off. Save a background to apply once it’s turned on.',
|
|
154
|
-
|
|
155
|
-
[
|
|
156
|
-
|
|
153
|
+
|
|
154
|
+
[vbOptionText]: mode => {
|
|
155
|
+
switch (mode) {
|
|
156
|
+
case 'none':
|
|
157
|
+
return 'None';
|
|
158
|
+
case 'custom':
|
|
159
|
+
return 'Custom';
|
|
160
|
+
case 'blur':
|
|
161
|
+
return 'Blur';
|
|
162
|
+
default:
|
|
163
|
+
return '';
|
|
164
|
+
}
|
|
165
|
+
},
|
|
157
166
|
};
|