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
@@ -1,59 +1,59 @@
1
1
  import {useState, useEffect} from 'react';
2
+ import {Keyboard, Platform} from 'react-native';
2
3
 
3
- const isPortrait = () => {
4
- try {
5
- if (
6
- window?.screen?.orientation?.type === 'portrait-primary' ||
7
- window?.screen?.orientation?.type === 'portrait-secondary'
8
- ) {
9
- return true;
10
- }
11
- return false;
12
- } catch (error) {
13
- console.log('screen orientation window api not supported error: ', error);
14
- return true;
15
- }
16
- };
17
-
18
- /**
19
- * A React Hook which updates when the orientation changes
20
- * @returns whether the user is in 'PORTRAIT' or 'LANDSCAPE'
21
- */
22
-
23
- export function useOrientation(): 'PORTRAIT' | 'LANDSCAPE' {
4
+ export function useOrientation() {
24
5
  const [orientation, setOrientation] = useState<'PORTRAIT' | 'LANDSCAPE'>(
25
- isPortrait() ? 'PORTRAIT' : 'LANDSCAPE',
6
+ window.matchMedia('(orientation: portrait)').matches
7
+ ? 'PORTRAIT'
8
+ : 'LANDSCAPE',
26
9
  );
10
+ const [keyboardVisible, setKeyboardVisible] = useState(false);
27
11
 
28
- const onOrientationChange = (event: any) => {
29
- try {
30
- console.log('screen orientation changed to -> ', event?.target?.type);
31
- if (
32
- event?.target?.type === 'portrait-primary' ||
33
- event?.target?.type === 'portrait-secondary'
34
- ) {
35
- setOrientation('PORTRAIT');
36
- } else {
37
- setOrientation('LANDSCAPE');
38
- }
39
- } catch (error) {
40
- console.log('screen orientation window api not supported error: ', error);
41
- setOrientation('PORTRAIT');
42
- }
43
- };
12
+ useEffect(() => {
13
+ console.log('screen orientation changed', orientation);
14
+ }, [orientation]);
44
15
 
45
16
  useEffect(() => {
46
- window?.screen?.orientation?.addEventListener(
47
- 'change',
48
- onOrientationChange,
17
+ const handleOrientationChange = () => {
18
+ if (keyboardVisible && Platform.OS === 'ios') {
19
+ return; // Avoid changing orientation if the keyboard is visible on iOS
20
+ }
21
+ setOrientation(
22
+ window.matchMedia('(orientation: portrait)').matches
23
+ ? 'PORTRAIT'
24
+ : 'LANDSCAPE',
25
+ );
26
+ };
27
+
28
+ const handleResize = () => {
29
+ if (!keyboardVisible) {
30
+ handleOrientationChange();
31
+ }
32
+ };
33
+
34
+ const keyboardDidShowListener = Keyboard.addListener(
35
+ 'keyboardDidShow',
36
+ () => {
37
+ setKeyboardVisible(true);
38
+ },
39
+ );
40
+
41
+ const keyboardDidHideListener = Keyboard.addListener(
42
+ 'keyboardDidHide',
43
+ () => {
44
+ setKeyboardVisible(false);
45
+ handleOrientationChange(); // Recheck orientation after the keyboard is hidden
46
+ },
49
47
  );
48
+
49
+ window.addEventListener('resize', handleResize);
50
+
50
51
  return () => {
51
- window?.screen.orientation?.removeEventListener(
52
- 'change',
53
- onOrientationChange,
54
- );
52
+ keyboardDidShowListener.remove();
53
+ keyboardDidHideListener.remove();
54
+ window.removeEventListener('resize', handleResize);
55
55
  };
56
- }, []);
56
+ }, [keyboardVisible]);
57
57
 
58
58
  return orientation;
59
59
  }
@@ -16,8 +16,8 @@ import {createHook} from 'customization-implementation';
16
16
  import {LogSource, logger} from '../logger/AppBuilderLogger';
17
17
 
18
18
  export interface SidePanelContextInterface {
19
- sidePanel: SidePanelType;
20
- setSidePanel: React.Dispatch<SetStateAction<SidePanelType>>;
19
+ sidePanel: SidePanelType | string;
20
+ setSidePanel: React.Dispatch<SetStateAction<SidePanelType | string>>;
21
21
  }
22
22
 
23
23
  const SidePanelContext = React.createContext<SidePanelContextInterface>({
@@ -41,23 +41,25 @@ export function usei18nData(
41
41
  }
42
42
  }
43
43
 
44
- export function useString<T = string>(
44
+ export function useString<T = any>(
45
45
  keyName: keyof TextDataInterface,
46
- ): (input?: T) => string {
46
+ ): (...args: T[]) => string {
47
47
  const lanCode = useLanguage(data => data.languageCode);
48
48
  const textData = usei18nData(lanCode);
49
- const getString = (input?: T) => {
49
+
50
+ const getString = (...args: T[]) => {
50
51
  let keyValue = textData ? textData[keyName] : undefined;
51
52
  if (!keyValue) {
52
53
  return '';
53
54
  } else if (typeof keyValue === 'function') {
54
- return keyValue(input);
55
+ return keyValue(...args);
55
56
  } else if (typeof keyValue === 'string') {
56
57
  return keyValue;
57
58
  } else {
58
59
  return '';
59
60
  }
60
61
  };
62
+
61
63
  return getString;
62
64
  }
63
65