agora-appbuilder-core 4.0.27 → 4.0.28-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/package.json +2 -2
  2. package/template/_package-lock.json +10 -7
  3. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +9 -0
  4. package/template/bridge/rtm/web/index.ts +44 -26
  5. package/template/customization-api/app-state.ts +1 -0
  6. package/template/customization-api/atoms.ts +8 -0
  7. package/template/customization-api/index.ts +1 -0
  8. package/template/customization-api/sub-components.ts +4 -1
  9. package/template/customization-api/temp.ts +1 -2
  10. package/template/customization-api/typeDefinition.ts +8 -0
  11. package/template/customization-api/types.ts +3 -0
  12. package/template/customization-api/utils.ts +10 -1
  13. package/template/defaultConfig.js +2 -2
  14. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +102 -50
  15. package/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/ScreenSharing.xcscheme +95 -0
  16. package/template/ios/Podfile +1 -1
  17. package/template/ios/Podfile.lock +200 -44
  18. package/template/ios/ScreenSharing/SampleHandler.h +2 -6
  19. package/template/ios/ScreenSharing/SampleHandler.m +17 -48
  20. package/template/package-lock.json +10 -7
  21. package/template/package.json +1 -1
  22. package/template/src/AppWrapper.tsx +2 -2
  23. package/template/src/assets/selection.json +3491 -1
  24. package/template/src/atoms/ActionMenu.tsx +96 -113
  25. package/template/src/atoms/LinkButton.tsx +4 -3
  26. package/template/src/atoms/ToolbarItem.tsx +36 -22
  27. package/template/src/atoms/ToolbarPreset.tsx +18 -3
  28. package/template/src/components/Controls.tsx +72 -49
  29. package/template/src/components/CustomSidePanel.tsx +82 -0
  30. package/template/src/components/EventsConfigure.tsx +11 -27
  31. package/template/src/components/Navbar.tsx +51 -86
  32. package/template/src/components/NavbarMobile.tsx +27 -3
  33. package/template/src/components/PinnedVideo.tsx +9 -0
  34. package/template/src/components/RTMConfigure.tsx +69 -1
  35. package/template/src/components/Settings.tsx +6 -29
  36. package/template/src/components/chat/chatConfigure.native.tsx +123 -119
  37. package/template/src/components/chat/chatConfigure.tsx +59 -46
  38. package/template/src/components/chat-messages/useChatMessages.tsx +5 -4
  39. package/template/src/components/chat-ui/useChatUIControls.tsx +4 -1
  40. package/template/src/components/livestream/views/LiveStreamControls.tsx +2 -1
  41. package/template/src/components/participants/UserActionMenuOptions.tsx +10 -10
  42. package/template/src/components/virtual-background/VBButton.tsx +5 -7
  43. package/template/src/language/default-labels/videoCallScreenLabels.ts +9 -2
  44. package/template/src/language/i18nTypes.ts +1 -1
  45. package/template/src/pages/video-call/ActionSheet.native.tsx +110 -34
  46. package/template/src/pages/video-call/ActionSheet.tsx +109 -27
  47. package/template/src/pages/video-call/ActionSheetContent.tsx +67 -49
  48. package/template/src/pages/video-call/ActionSheetHandle.tsx +12 -2
  49. package/template/src/pages/video-call/SidePanelHeader.tsx +28 -2
  50. package/template/src/pages/video-call/VideoCallScreen.tsx +70 -16
  51. package/template/src/pages/video-call/VideoRenderer.tsx +1 -0
  52. package/template/src/rtm-events-api/Events.ts +37 -3
  53. package/template/src/rtm-events-api/LocalEvents.ts +1 -0
  54. package/template/src/rtm-events-api/types.ts +5 -0
  55. package/template/src/subComponents/ChatBubble.tsx +15 -1
  56. package/template/src/subComponents/ChatInput.tsx +18 -7
  57. package/template/src/subComponents/CopyJoinInfo.tsx +5 -13
  58. package/template/src/subComponents/LayoutIconButton.tsx +6 -14
  59. package/template/src/subComponents/LocalAudioMute.tsx +7 -11
  60. package/template/src/subComponents/LocalEndCall.tsx +6 -4
  61. package/template/src/subComponents/LocalSwitchCamera.tsx +5 -4
  62. package/template/src/subComponents/LocalVideoMute.tsx +10 -36
  63. package/template/src/subComponents/Recording.tsx +4 -10
  64. package/template/src/subComponents/ScreenShareNotice.tsx +3 -0
  65. package/template/src/subComponents/SidePanelEnum.tsx +6 -6
  66. package/template/src/subComponents/caption/CaptionContainer.tsx +2 -2
  67. package/template/src/subComponents/caption/CaptionIcon.tsx +21 -17
  68. package/template/src/subComponents/caption/TranscriptIcon.tsx +6 -3
  69. package/template/src/subComponents/chat/ChatActionMenu.tsx +3 -3
  70. package/template/src/subComponents/chat/ChatAttachment.tsx +107 -51
  71. package/template/src/subComponents/chat/ChatEmoji.tsx +8 -4
  72. package/template/src/subComponents/chat/ChatSendButton.tsx +52 -30
  73. package/template/src/subComponents/chat/ChatUploadStatus.tsx +22 -3
  74. package/template/src/subComponents/chat/ImagePopup.tsx +4 -4
  75. package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +14 -25
  76. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +8 -7
  77. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +333 -163
  78. package/template/src/utils/common.tsx +22 -9
  79. package/template/src/utils/useEndCall.ts +6 -4
  80. package/template/src/utils/useFullScreen.native.ts +12 -0
  81. package/template/src/utils/useOrientation.tsx +46 -46
  82. package/template/src/utils/useSidePanel.tsx +2 -2
  83. package/template/src/utils/useString.ts +6 -4
@@ -18,10 +18,10 @@ import ThemeConfig from '../theme';
18
18
  import {isWebInternal} from '../utils/common';
19
19
  import hexadecimalTransparency from '../utils/hexadecimalTransparency';
20
20
  import Toggle from './Toggle';
21
- import {Either} from '../../agora-rn-uikit/src/Controls/types';
22
- import {ToolbarItemHide, ToolbarMoreMenuCustomItem} from './ToolbarPreset';
21
+ import {ToolbarItemHide} from './ToolbarPreset';
23
22
 
24
23
  export interface ActionMenuItem {
24
+ component?: React.ComponentType;
25
25
  componentName?: string;
26
26
  order?: number;
27
27
  isExternalIcon?: boolean;
@@ -32,8 +32,9 @@ export interface ActionMenuItem {
32
32
  iconColor: string;
33
33
  textColor: string;
34
34
  title: string;
35
+ label?: string;
35
36
  toggleStatus?: boolean;
36
- callback: () => void;
37
+ onPress: () => void;
37
38
  onHoverCallback?: (isHovered: boolean) => void;
38
39
  onHoverContent?: JSX.Element;
39
40
  disabled?: boolean;
@@ -50,7 +51,7 @@ export interface ActionMenuProps {
50
51
  left?: number;
51
52
  bottom?: number;
52
53
  };
53
- items: Either<ActionMenuItem[], ToolbarMoreMenuCustomItem[]>;
54
+ items: ActionMenuItem[];
54
55
  hoverMode?: boolean;
55
56
  onHover?: (hover: boolean) => void;
56
57
  containerStyle?: ViewStyle;
@@ -68,9 +69,7 @@ const ActionMenu = (props: ActionMenuProps) => {
68
69
 
69
70
  const renderItems = () => {
70
71
  return items?.map((item, index) => {
71
- //rendering the custom item with default UI
72
- const {title, onPress, iconBase64, componentName, hide = false} = item;
73
-
72
+ const {hide = false} = item;
74
73
  if (typeof hide === 'boolean' && hide) {
75
74
  return null;
76
75
  }
@@ -81,16 +80,37 @@ const ActionMenu = (props: ActionMenuProps) => {
81
80
  }
82
81
  } catch (error) {}
83
82
 
84
- if (title && onPress) {
85
- return (
86
- <PlatformWrapper key={props.from + '_' + componentName + index}>
87
- {(isHovered: boolean) => (
88
- <>
83
+ const {
84
+ title,
85
+ label = null,
86
+ component: CustomActionItem = null,
87
+ icon = '',
88
+ onHoverIcon,
89
+ isBase64Icon = false,
90
+ isExternalIcon = false,
91
+ externalIconString = '',
92
+ toggleStatus,
93
+ onPress = () => {},
94
+ iconColor,
95
+ textColor,
96
+ disabled = false,
97
+ onHoverCallback = undefined,
98
+ onHoverContent = undefined,
99
+ iconSize = 20,
100
+ } = item;
101
+ return (
102
+ <PlatformWrapper key={props.from + '_' + title + index}>
103
+ {(isHovered: boolean) => (
104
+ <>
105
+ {/* {onHoverCallback && onHoverCallback(isHovered)} */}
106
+ {isHovered ? onHoverContent ? onHoverContent : <></> : <></>}
107
+ {CustomActionItem ? (
89
108
  <TouchableOpacity
90
- disabled={false}
109
+ disabled={disabled}
110
+ onPress={onPress}
91
111
  style={[
92
112
  styles.row,
93
- isHovered && !false
113
+ isHovered && !disabled
94
114
  ? //first item should have border-radius on top left and top right
95
115
  index === 0
96
116
  ? styles.rowHoveredFirstChild
@@ -100,118 +120,77 @@ const ActionMenu = (props: ActionMenuProps) => {
100
120
  : //middle items don't need any border-radius
101
121
  styles.rowHoveredMiddleItems
102
122
  : {},
103
- false ? {opacity: 0.4} : {},
123
+ disabled ? {opacity: 0.4} : {},
124
+ items?.length - 1 === index
125
+ ? {borderBottomColor: 'transparent'}
126
+ : {},
127
+ ]}>
128
+ <CustomActionItem />
129
+ </TouchableOpacity>
130
+ ) : (
131
+ <TouchableOpacity
132
+ disabled={disabled}
133
+ style={[
134
+ styles.row,
135
+ isHovered && !disabled
136
+ ? //first item should have border-radius on top left and top right
137
+ index === 0
138
+ ? styles.rowHoveredFirstChild
139
+ : //last item should have border-radius on bottom left and top right
140
+ items?.length - 1 === index
141
+ ? styles.rowHoveredLastChild
142
+ : //middle items don't need any border-radius
143
+ styles.rowHoveredMiddleItems
144
+ : {},
145
+ disabled ? {opacity: 0.4} : {},
104
146
  items?.length - 1 === index
105
147
  ? {borderBottomColor: 'transparent'}
106
148
  : {},
107
149
  ]}
108
150
  onPress={onPress}
109
- key={componentName + index}>
110
- {iconBase64 ? (
111
- <View style={styles.iconContainer}>
151
+ key={icon + index}>
152
+ <View style={styles.iconContainer}>
153
+ {isExternalIcon ? (
112
154
  <ImageIcon
113
- base64={false}
114
- base64TintColor={$config.SECONDARY_ACTION_COLOR}
155
+ base64={isBase64Icon}
156
+ base64TintColor={iconColor}
115
157
  iconType="plain"
116
- iconSize={24}
117
- icon={iconBase64}
118
- tintColor={$config.SECONDARY_ACTION_COLOR}
158
+ iconSize={iconSize}
159
+ icon={externalIconString}
160
+ tintColor={iconColor}
161
+ />
162
+ ) : (
163
+ <ImageIcon
164
+ base64={isBase64Icon}
165
+ base64TintColor={iconColor}
166
+ iconType="plain"
167
+ iconSize={iconSize}
168
+ name={
169
+ isHovered && onHoverIcon && !disabled
170
+ ? onHoverIcon
171
+ : icon
172
+ }
173
+ tintColor={iconColor}
174
+ />
175
+ )}
176
+ </View>
177
+ <Text
178
+ style={[styles.text, textColor ? {color: textColor} : {}]}>
179
+ {label || title}
180
+ </Text>
181
+ {toggleStatus !== undefined && toggleStatus !== null ? (
182
+ <View style={styles.toggleContainer}>
183
+ <Toggle
184
+ disabled={disabled}
185
+ isEnabled={toggleStatus}
186
+ toggleSwitch={onPress}
119
187
  />
120
188
  </View>
121
189
  ) : (
122
190
  <></>
123
191
  )}
124
- <Text style={[styles.text]}>{title}</Text>
125
192
  </TouchableOpacity>
126
- </>
127
- )}
128
- </PlatformWrapper>
129
- );
130
- }
131
-
132
- const {
133
- icon = '',
134
- onHoverIcon,
135
- isBase64Icon = false,
136
- isExternalIcon = false,
137
- externalIconString = '',
138
- toggleStatus,
139
- callback,
140
- iconColor,
141
- textColor,
142
- disabled = false,
143
- onHoverCallback = undefined,
144
- onHoverContent = undefined,
145
- iconSize = 20,
146
- } = item;
147
- return (
148
- <PlatformWrapper key={props.from + '_' + title + index}>
149
- {(isHovered: boolean) => (
150
- <>
151
- {/* {onHoverCallback && onHoverCallback(isHovered)} */}
152
- {isHovered ? onHoverContent ? onHoverContent : <></> : <></>}
153
- <TouchableOpacity
154
- disabled={disabled}
155
- style={[
156
- styles.row,
157
- isHovered && !disabled
158
- ? //first item should have border-radius on top left and top right
159
- index === 0
160
- ? styles.rowHoveredFirstChild
161
- : //last item should have border-radius on bottom left and top right
162
- items?.length - 1 === index
163
- ? styles.rowHoveredLastChild
164
- : //middle items don't need any border-radius
165
- styles.rowHoveredMiddleItems
166
- : {},
167
- disabled ? {opacity: 0.4} : {},
168
- items?.length - 1 === index
169
- ? {borderBottomColor: 'transparent'}
170
- : {},
171
- ]}
172
- onPress={callback}
173
- key={icon + index}>
174
- <View style={styles.iconContainer}>
175
- {isExternalIcon ? (
176
- <ImageIcon
177
- base64={isBase64Icon}
178
- base64TintColor={iconColor}
179
- iconType="plain"
180
- iconSize={iconSize}
181
- icon={externalIconString}
182
- tintColor={iconColor}
183
- />
184
- ) : (
185
- <ImageIcon
186
- base64={isBase64Icon}
187
- base64TintColor={iconColor}
188
- iconType="plain"
189
- iconSize={iconSize}
190
- name={
191
- isHovered && onHoverIcon && !disabled
192
- ? onHoverIcon
193
- : icon
194
- }
195
- tintColor={iconColor}
196
- />
197
- )}
198
- </View>
199
- <Text
200
- style={[styles.text, textColor ? {color: textColor} : {}]}>
201
- {title}
202
- </Text>
203
- {toggleStatus !== undefined && toggleStatus !== null ? (
204
- <View style={styles.toggleContainer}>
205
- <Toggle
206
- disabled={disabled}
207
- isEnabled={toggleStatus}
208
- toggleSwitch={callback}
209
- />
210
- </View>
211
- ) : (
212
- <></>
213
- )}
214
- </TouchableOpacity>
193
+ )}
215
194
  </>
216
195
  )}
217
196
  </PlatformWrapper>
@@ -311,8 +290,12 @@ const styles = StyleSheet.create({
311
290
  borderBottomWidth: 1,
312
291
  borderBottomColor: $config.CARD_LAYER_3_COLOR,
313
292
  flexDirection: 'row',
293
+ display: 'flex',
294
+ alignItems: 'center',
295
+ justifyContent: 'flex-start',
314
296
  },
315
297
  iconContainer: {
298
+ display: 'flex',
316
299
  justifyContent: 'center',
317
300
  alignItems: 'center',
318
301
  marginRight: 8,
@@ -1,16 +1,17 @@
1
- import {StyleSheet, Text, TouchableOpacity} from 'react-native';
1
+ import {StyleSheet, Text, TouchableOpacity, TextStyle} from 'react-native';
2
2
  import React from 'react';
3
3
  import ThemeConfig from '../theme';
4
4
 
5
5
  interface LinkButtonProps {
6
6
  onPress: () => void;
7
7
  text: string;
8
+ textStyle?: TextStyle;
8
9
  }
9
10
 
10
- const LinkButton = ({onPress, text}: LinkButtonProps) => {
11
+ const LinkButton = ({onPress, text, textStyle = {}}: LinkButtonProps) => {
11
12
  return (
12
13
  <TouchableOpacity onPress={onPress}>
13
- <Text style={styles.text}> {text} </Text>
14
+ <Text style={(styles.text, textStyle)}> {text} </Text>
14
15
  </TouchableOpacity>
15
16
  );
16
17
  };
@@ -2,11 +2,21 @@ import React from 'react';
2
2
  import {View, ViewProps, ViewStyle, StyleSheet} from 'react-native';
3
3
  import {ToolbarPosition, useToolbar} from '../utils/useToolbar';
4
4
  import {isMobileUA, isWebInternal} from '../utils/common';
5
+ import {createHook} from 'customization-implementation';
5
6
 
6
7
  export interface ToolbarItemProps extends ViewProps {
7
8
  style?: ViewStyle;
8
9
  children: React.ReactNode;
10
+ toolbarProps?: {
11
+ [key: string]: any;
12
+ };
9
13
  }
14
+
15
+ export const ToolbarPropsContext = React.createContext<
16
+ ToolbarItemProps['toolbarProps']
17
+ >({});
18
+ export const useToolbarProps = createHook(ToolbarPropsContext);
19
+
10
20
  const ToolbarItem = (props: ToolbarItemProps) => {
11
21
  const {isHorizontal, position} = useToolbar();
12
22
  //isHorizontal true -> top/bottom bar
@@ -17,31 +27,35 @@ const ToolbarItem = (props: ToolbarItemProps) => {
17
27
  //action sheet
18
28
  if (isMobileUA() && position === ToolbarPosition.bottom) {
19
29
  return (
20
- <View {...props} style={[props?.style, toolbarItemStyles.iconWithText]}>
21
- {props?.children}
22
- </View>
30
+ <ToolbarPropsContext.Provider value={props?.toolbarProps || {}}>
31
+ <View {...props} style={[props?.style, toolbarItemStyles.iconWithText]}>
32
+ {props?.children}
33
+ </View>
34
+ </ToolbarPropsContext.Provider>
23
35
  );
24
36
  } else {
25
37
  return (
26
- <View
27
- {...props}
28
- style={[
29
- props?.style,
30
- // isHorizontal ? {flexDirection: 'column'} : {flexDirection: 'row'},
31
- position === ToolbarPosition.left
32
- ? toolbarItemStyles.leftBarItemStyle
33
- : position === ToolbarPosition.right
34
- ? toolbarItemStyles.rightBarItemStyle
35
- : position === ToolbarPosition.bottom
36
- ? toolbarItemStyles.bottomBarItemStyle
37
- : isWebInternal() && position === ToolbarPosition.top
38
- ? toolbarItemStyles.topBarItemNonNativeStyle
39
- : !isWebInternal() && position === ToolbarPosition.top
40
- ? toolbarItemStyles.topBarItemNativeStyle
41
- : {},
42
- ]}>
43
- {props?.children}
44
- </View>
38
+ <ToolbarPropsContext.Provider value={props?.toolbarProps || {}}>
39
+ <View
40
+ {...props}
41
+ style={[
42
+ props?.style,
43
+ // isHorizontal ? {flexDirection: 'column'} : {flexDirection: 'row'},
44
+ position === ToolbarPosition.left
45
+ ? toolbarItemStyles.leftBarItemStyle
46
+ : position === ToolbarPosition.right
47
+ ? toolbarItemStyles.rightBarItemStyle
48
+ : position === ToolbarPosition.bottom
49
+ ? toolbarItemStyles.bottomBarItemStyle
50
+ : isWebInternal() && position === ToolbarPosition.top
51
+ ? toolbarItemStyles.topBarItemNonNativeStyle
52
+ : !isWebInternal() && position === ToolbarPosition.top
53
+ ? toolbarItemStyles.topBarItemNativeStyle
54
+ : {},
55
+ ]}>
56
+ {props?.children}
57
+ </View>
58
+ </ToolbarPropsContext.Provider>
45
59
  );
46
60
  }
47
61
  };
@@ -45,10 +45,21 @@ export type TopToolbarDefaultKeys =
45
45
  | 'participant'
46
46
  | 'settings';
47
47
 
48
- export type ToolbarMoreButtonFields = {
48
+ export type ToolbarMoreButtonDefaultFields = {
49
49
  [key in MoreButtonDefaultKeys]?: {
50
50
  hide?: ToolbarItemHide;
51
51
  order?: number;
52
+ component?: React.ComponentType;
53
+ label?: ToolbarItemLabel;
54
+ onPress?: () => void;
55
+ };
56
+ };
57
+ export type ToolbarMoreButtonCustomFields = {
58
+ [key: string]: {
59
+ hide?: ToolbarItemHide;
60
+ order?: number;
61
+ component?: React.ComponentType;
62
+ onPress?: () => void;
52
63
  };
53
64
  };
54
65
 
@@ -56,14 +67,18 @@ export type ToolbarItemAlign = 'start' | 'center' | 'end';
56
67
  export type ToolbarHideCallback = (width: number, height: number) => boolean;
57
68
  export type ToolbarItemHide = boolean | ToolbarHideCallback;
58
69
 
70
+ export type ToolbarItemLabelCallback = (languageCode: string) => string;
71
+ export type ToolbarItemLabel = string | ToolbarItemLabelCallback;
59
72
  export interface ToolbarDefaultItem {
60
- component?: () => JSX.Element;
73
+ component?: (props?: any) => JSX.Element;
61
74
  align?: ToolbarItemAlign;
62
75
  hide?: ToolbarItemHide;
63
76
  order?: number;
77
+ label?: ToolbarItemLabel;
78
+ onPress?: () => void;
64
79
  }
65
80
  export interface ToolbarMoreDefaultItem extends ToolbarDefaultItem {
66
- fields?: ToolbarMoreButtonFields;
81
+ fields?: ToolbarMoreButtonDefaultFields | ToolbarMoreButtonCustomFields;
67
82
  }
68
83
 
69
84
  export type ToolbarPresetAlign = 'top' | 'bottom' | 'right' | 'left';