agora-appbuilder-core 4.1.0-beta-11 → 4.1.0-beta-12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.1.0-beta-11",
3
+ "version": "4.1.0-beta-12",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -76,8 +76,8 @@ const DefaultConfig = {
76
76
  CHAT_ORG_NAME: '',
77
77
  CHAT_APP_NAME: '',
78
78
  CHAT_URL: '',
79
- CLI_VERSION: '3.1.0-beta-11',
80
- CORE_VERSION: '4.1.0-beta-11',
79
+ CLI_VERSION: '3.1.0-beta-12',
80
+ CORE_VERSION: '4.1.0-beta-12',
81
81
  DISABLE_LANDSCAPE_MODE: false,
82
82
  STT_AUTO_START: false,
83
83
  CLOUD_RECORDING_AUTO_START: false,
@@ -9,6 +9,7 @@ import {
9
9
  useRoomInfo,
10
10
  Toast,
11
11
  useRtc,
12
+ isWebInternal,
12
13
  } from 'customization-api';
13
14
  import LocalEventEmitter, {
14
15
  LocalEventsEnum,
@@ -81,34 +82,6 @@ export const AgentContext = createContext<AgentContextInterface>({
81
82
  clearChatHistory: () => {},
82
83
  });
83
84
 
84
- /**
85
- * Helper function to find the correct insertion index for a new item using binary search.
86
- * Ensures that the array remains sorted by the `time` property after insertion.
87
- *
88
- * @param array The array to search within.
89
- * @param time The `time` value of the new item to insert.
90
- * @returns The index where the new item should be inserted.
91
- */
92
- const findInsertionIndex = (array: ChatItem[], time: number): number => {
93
- let low = 0;
94
- let high = array.length;
95
-
96
- // Perform binary search to find the insertion index
97
- while (low < high) {
98
- const mid = Math.floor((low + high) / 2);
99
-
100
- // If the middle item's time is less than the new time, search the upper half
101
- if (array[mid].time < time) {
102
- low = mid + 1;
103
- } else {
104
- // Otherwise, search the lower half
105
- high = mid;
106
- }
107
- }
108
-
109
- return low; // The correct index for insertion
110
- };
111
-
112
85
  export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
113
86
  children,
114
87
  }) => {
@@ -152,7 +125,11 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
152
125
  React.useEffect(() => {
153
126
  if (!isSubscribedForStreams) {
154
127
  RtcEngineUnsafe.addListener('onStreamMessage', (...args: any[]) => {
155
- messageService?.handleStreamMessage(args[1]);
128
+ if (isWebInternal()) {
129
+ messageService?.handleStreamMessage(args[1]);
130
+ } else {
131
+ messageService?.handleStreamMessage(args[3]);
132
+ }
156
133
  });
157
134
  setIsSubscribedForStreams(true);
158
135
  }
@@ -3,6 +3,7 @@ import {LogSource, logger} from '../../../logger/AppBuilderLogger';
3
3
  import LocalEventEmitter, {
4
4
  LocalEventsEnum,
5
5
  } from '../../../rtm-events-api/LocalEvents';
6
+ import {Buffer} from 'buffer';
6
7
 
7
8
  const DEFAULT_MESSAGE_CACHE_TIMEOUT = 1000 * 60 * 5; // 5 minutes
8
9
  const DEFAULT_INTERVAL = 200; // milliseconds
@@ -669,7 +670,10 @@ export class MessageEngine {
669
670
  // atob(message),
670
671
  // );
671
672
 
672
- const decodedMessage = JSON.parse(Base64.atob(message));
673
+ // const decodedMessage = JSON.parse(atob(message));
674
+ const decodedMessage = JSON.parse(
675
+ Buffer.from(message, 'base64').toString('utf-8'),
676
+ );
673
677
 
674
678
  // logger.debug(
675
679
  // LogSource.AgoraSDK,
@@ -982,7 +986,10 @@ export let messageService: MessageEngine | null = null;
982
986
  * @returns {MessageEngine} Singleton instance of MessageEngine
983
987
  */
984
988
  export function initializeMessageEngine(): MessageEngine {
989
+ console.log('debguggingnew initializeMessageEngine getting here');
985
990
  if (!messageService) {
991
+ console.log('debuggingnew getting here');
992
+
986
993
  messageService = new MessageEngine(EMessageEngineMode.AUTO, chatHistory => {
987
994
  LocalEventEmitter.emit(LocalEventsEnum.AGENT_TRANSCRIPT_CHANGE, {
988
995
  data: {
@@ -992,6 +999,7 @@ export function initializeMessageEngine(): MessageEngine {
992
999
  });
993
1000
  });
994
1001
  }
1002
+ console.log('debguggingnew messageService', messageService);
995
1003
  return messageService;
996
1004
  }
997
1005