quickblox-react-ui-kit 0.4.6-beta.4 → 0.4.7
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/dist/CommonTypes/CommonTypes.d.ts +12 -0
- package/dist/Data/source/remote/RemoteDataSource.d.ts +5 -0
- package/dist/Presentation/Views/Dialog/ForwardMessageFlow/DialogsWithSearch/DialogListItem/DialogListItem.d.ts +1 -1
- package/dist/Presentation/Views/Flow/CreateDialog/CreateDialog.d.ts +1 -0
- package/dist/Presentation/ui-components/DialogItemPreview/DialogItemPreview.d.ts +3 -3
- package/dist/Presentation/ui-components/Header/Header.d.ts +1 -1
- package/dist/index-ui.d.ts +47 -3
- package/dist/index-ui.js +25470 -17586
- package/dist/index-ui.js.map +1 -1
- package/global.d.ts +3 -202
- package/package.json +1 -1
- package/src/App.scss +5 -0
- package/src/App.tsx +58 -33
- package/src/CommonTypes/CommonTypes.ts +13 -0
- package/src/Data/DefaultConfigurations.ts +4 -0
- package/src/Data/source/remote/RemoteDataSource.ts +210 -148
- package/src/Domain/use_cases/CreateDialogUseCase.ts +0 -1
- package/src/Domain/use_cases/ForwardMessagesUseCase.ts +0 -1
- package/src/Domain/use_cases/GetAllDialogsUseCase.ts +0 -1
- package/src/Domain/use_cases/GetAllDialogsUseCaseWithMock.ts +0 -2
- package/src/Domain/use_cases/GetAllMessagesForDialog.ts +0 -1
- package/src/Domain/use_cases/GetAllUsersUseCase.ts +0 -1
- package/src/Domain/use_cases/GetDialogByIdUseCase.ts +0 -2
- package/src/Domain/use_cases/GetUsersByIdsUseCase.ts +0 -1
- package/src/Domain/use_cases/LeaveDialogUseCase.ts +0 -1
- package/src/Domain/use_cases/RemoveUsersFromTheDialogUseCase.ts +0 -1
- package/src/Domain/use_cases/ReplyMessagesUseCase.ts +0 -2
- package/src/Domain/use_cases/SendTextMessageUseCase.ts +0 -3
- package/src/Domain/use_cases/SubscribeToDialogEventsUseCase.ts +0 -26
- package/src/Domain/use_cases/SubscribeToDialogsUpdatesUseCase.ts +0 -1
- package/src/Domain/use_cases/SyncDialogsUseCase.ts +1 -2
- package/src/Domain/use_cases/UpdateCurrentDialogInDataSourceUseCase.ts +0 -2
- package/src/Domain/use_cases/UpdateDialogUseCase.ts +0 -2
- package/src/Domain/use_cases/UploadFileUseCase.ts +0 -2
- package/src/Domain/use_cases/UserTypingMessageUseCase.ts +0 -2
- package/src/Domain/use_cases/ai/AIAnswerAssistUseCase.ts +0 -2
- package/src/Domain/use_cases/ai/AIAnswerAssistWithProxyUseCase.ts +0 -3
- package/src/Domain/use_cases/ai/AIAnswerAssistWithSDKUseCase.ts +0 -2
- package/src/Domain/use_cases/ai/AIRephraseUseCase.ts +0 -3
- package/src/Domain/use_cases/ai/AIRephraseWithProxyUseCase.ts +0 -3
- package/src/Domain/use_cases/ai/AITranslateUseCase.ts +0 -2
- package/src/Domain/use_cases/ai/AITranslateWithProxyUseCase.ts +0 -3
- package/src/Domain/use_cases/ai/AITranslateWithSDKUseCase.ts +0 -3
- package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +0 -1
- package/src/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.tsx +1 -1
- package/src/Presentation/Views/Dialog/AIWidgets/AIWidgetActions/AIWidgetActions.scss +12 -6
- package/src/Presentation/Views/Dialog/AIWidgets/AIWidgetActions/AIWidgetActions.tsx +4 -2
- package/src/Presentation/Views/Dialog/Dialog.scss +7 -1
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/DialogsWithSearch/DialogListItem/DialogListItem.scss +17 -29
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/DialogsWithSearch/DialogListItem/DialogListItem.tsx +8 -13
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/ForwardMessageFlow.scss +9 -9
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.scss +11 -0
- package/src/Presentation/Views/Dialog/MessageContextMenu/MessageContextMenu.tsx +3 -2
- package/src/Presentation/Views/Dialog/useDialogViewModel.ts +10 -21
- package/src/Presentation/Views/DialogInfo/DialogInfo.scss +19 -25
- package/src/Presentation/Views/DialogInfo/DialogInfo.tsx +2 -2
- package/src/Presentation/Views/DialogInfo/DialogMemberButton/DialogMembersButton.scss +0 -17
- package/src/Presentation/Views/DialogInfo/MembersList/MembersList.scss +9 -1
- package/src/Presentation/Views/DialogInfo/UsersList/SingleUser/SingleUser.scss +0 -1
- package/src/Presentation/Views/DialogInfo/UsersList/useUsersListViewModel.ts +2 -4
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +0 -1
- package/src/Presentation/Views/EditDialog/EditDialog.scss +1 -38
- package/src/Presentation/Views/Flow/CreateDialog/CreateDialog.scss +17 -42
- package/src/Presentation/Views/Flow/CreateDialog/CreateDialog.tsx +45 -39
- package/src/Presentation/Views/Flow/CreateDialogFlow/CreateNewDialogFlow.tsx +6 -2
- package/src/Presentation/Views/InviteMembers/InviteMembers.scss +4 -33
- package/src/Presentation/Views/InviteMembers/InviteMembers.tsx +23 -4
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.scss +8 -0
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.tsx +8 -5
- package/src/Presentation/components/UI/Buttons/MainButton/MainButton.css +5 -10
- package/src/Presentation/components/UI/Placeholders/ErrorComponent/ErrorComponent.scss +0 -5
- package/src/Presentation/components/containers/ColumnContainer/ColumnContainer.scss +1 -10
- package/src/Presentation/layouts/TestStage/LoginView/Login.scss +6 -3
- package/src/Presentation/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.tsx +1 -33
- package/src/Presentation/themes/styles/_theme_colors_scheme.scss +1 -1
- package/src/Presentation/themes/styles/_theme_dark.scss +5 -4
- package/src/Presentation/themes/styles/_theme_light.scss +3 -2
- package/src/Presentation/ui-components/Avatar/Avatar.scss +8 -5
- package/src/Presentation/ui-components/Avatar/Avatar.tsx +2 -1
- package/src/Presentation/ui-components/Badge/Badge.tsx +1 -0
- package/src/Presentation/ui-components/Button/Button.scss +5 -6
- package/src/Presentation/ui-components/Button/Button.tsx +7 -2
- package/src/Presentation/ui-components/CheckBox/CheckBox.scss +23 -0
- package/src/Presentation/ui-components/CheckBox/CheckBox.tsx +19 -7
- package/src/Presentation/ui-components/DialogBanner/DialogBanner.tsx +1 -0
- package/src/Presentation/ui-components/DialogItemPreview/DialogItemPreview.scss +3 -3
- package/src/Presentation/ui-components/DialogItemPreview/DialogItemPreview.tsx +3 -3
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.scss +7 -4
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.tsx +1 -1
- package/src/Presentation/ui-components/Dropdown/Dropdown.tsx +1 -1
- package/src/Presentation/ui-components/Dropdown/DropdownOption.tsx +2 -1
- package/src/Presentation/ui-components/Header/Header.scss +9 -2
- package/src/Presentation/ui-components/Header/Header.tsx +1 -1
- package/src/Presentation/ui-components/Loader/Loader.tsx +1 -0
- package/src/Presentation/ui-components/Message/Bubble/AudioBubble/AudioBubble.scss +1 -0
- package/src/Presentation/ui-components/Message/Bubble/FileBubble/FileBubble.tsx +1 -0
- package/src/Presentation/ui-components/Message/Bubble/ImageBubble/ImageBubble.tsx +1 -0
- package/src/Presentation/ui-components/Message/Bubble/TextBubble/TextBubble.scss +13 -3
- package/src/Presentation/ui-components/Message/Bubble/TextBubble/TextBubble.tsx +1 -0
- package/src/Presentation/ui-components/Message/Bubble/VideoBubble/VideoBubble.tsx +1 -0
- package/src/Presentation/ui-components/Message/FileUrl/FileUrl.scss +0 -3
- package/src/Presentation/ui-components/Message/FileUrl/FileUrl.tsx +1 -0
- package/src/Presentation/ui-components/Message/Message.scss +5 -1
- package/src/Presentation/ui-components/MessageInput/MessageInput.scss +5 -1
- package/src/Presentation/ui-components/MessageInput/MessageInput.tsx +1 -1
- package/src/Presentation/ui-components/MessageInput/VoiceRecordingProgress/VoiceRecordingProgress.tsx +1 -1
- package/src/Presentation/ui-components/MessageSeparator/MessageSeparator.scss +13 -13
- package/src/Presentation/ui-components/Placeholder/Placeholder.scss +5 -0
- package/src/Presentation/ui-components/Placeholder/Placeholder.tsx +1 -1
- package/src/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.scss +4 -1
- package/src/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.tsx +1 -0
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.scss +5 -1
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.tsx +1 -1
- package/src/Presentation/ui-components/TextField/TextField.scss +5 -3
- package/src/Presentation/ui-components/Toast/Toast.scss +3 -3
- package/src/Presentation/ui-components/Toast/ToastProvider.tsx +2 -2
- package/src/Presentation/ui-components/UserListItem/UserListItem.scss +11 -3
- package/src/Presentation/ui-components/UserListItem/UserListItem.tsx +1 -0
- package/src/QBconfig.ts +2 -0
- package/src/hooks/useQuickBloxUIKit.ts +101 -18
- package/src/index-ui.ts +111 -18
- package/src/qb-api-calls/index.ts +52 -3
- package/storybook-static/{217.3c66ff1e.iframe.bundle.js → 217.07d5c7a3.iframe.bundle.js} +3 -3
- package/storybook-static/{217.3c66ff1e.iframe.bundle.js.map → 217.07d5c7a3.iframe.bundle.js.map} +1 -1
- package/storybook-static/735.6ee62079.iframe.bundle.js +2 -0
- package/storybook-static/{844.6041e1a5.iframe.bundle.js → 844.e8bfd664.iframe.bundle.js} +3 -3
- package/storybook-static/{844.6041e1a5.iframe.bundle.js.map → 844.e8bfd664.iframe.bundle.js.map} +1 -1
- package/storybook-static/{961.c94da456.iframe.bundle.js → 961.d47fc2bc.iframe.bundle.js} +2 -2
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.a5ba7608.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-Badge-Badge-stories.c8824861.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-Button-Button-stories.fa2aa72c.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.b6998344.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.a724643f.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.a03feb06.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-Header-Header-stories.978f0af5.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.4e80520d.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-Message-Message-stories.213a90f6.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.be8aa2d9.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.e7f5a274.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.969cfe2e.iframe.bundle.js +2 -0
- package/storybook-static/Presentation-ui-components-Toast-Toast-stories.4f00432b.iframe.bundle.js +1 -0
- package/storybook-static/Presentation-ui-components-UserListItem-UserListItem-stories.1713eab7.iframe.bundle.js +2 -0
- package/storybook-static/iframe.html +2 -2
- package/storybook-static/project.json +1 -1
- package/storybook-static/{runtime~main.5a7ba727.iframe.bundle.js → runtime~main.17766d00.iframe.bundle.js} +1 -1
- package/storybook-static/sb-manager/globals-runtime.js +1 -1
- package/storybook-static/735.82f96f8a.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.b363e9a1.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-Badge-Badge-stories.85dd97b0.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-Button-Button-stories.1e4ae2b4.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.4e25a94d.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.e22e8be5.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.8321872b.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-Header-Header-stories.1cff200a.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.7391dde4.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-Message-Message-stories.49f0dbbf.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.4aa88de3.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.d74853ab.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.19812f7d.iframe.bundle.js +0 -2
- package/storybook-static/Presentation-ui-components-Toast-Toast-stories.5e19f10e.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-UserListItem-UserListItem-stories.d2f60e13.iframe.bundle.js +0 -2
- /package/storybook-static/{217.3c66ff1e.iframe.bundle.js.LICENSE.txt → 217.07d5c7a3.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{735.82f96f8a.iframe.bundle.js.LICENSE.txt → 735.6ee62079.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{844.6041e1a5.iframe.bundle.js.LICENSE.txt → 844.e8bfd664.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{961.c94da456.iframe.bundle.js.LICENSE.txt → 961.d47fc2bc.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-Avatar-avatar-stories.b363e9a1.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-Avatar-avatar-stories.a5ba7608.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-Badge-Badge-stories.85dd97b0.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-Badge-Badge-stories.c8824861.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-Button-Button-stories.1e4ae2b4.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-Button-Button-stories.fa2aa72c.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.4e25a94d.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.b6998344.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-DialogWindow-DialogWindow-stories.e22e8be5.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-DialogWindow-DialogWindow-stories.a724643f.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-Dropdown-Dropdown-stories.8321872b.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-Dropdown-Dropdown-stories.a03feb06.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-Header-Header-stories.1cff200a.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-Header-Header-stories.978f0af5.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-Loader-Loader-stories.7391dde4.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-Loader-Loader-stories.4e80520d.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-Message-Message-stories.49f0dbbf.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-Message-Message-stories.213a90f6.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-SettingsItem-SettingsItem-stories.d74853ab.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-SettingsItem-SettingsItem-stories.e7f5a274.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-TextField-TextField-stories.19812f7d.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-TextField-TextField-stories.969cfe2e.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{Presentation-ui-components-UserListItem-UserListItem-stories.d2f60e13.iframe.bundle.js.LICENSE.txt → Presentation-ui-components-UserListItem-UserListItem-stories.1713eab7.iframe.bundle.js.LICENSE.txt} +0 -0
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
QBSession,
|
|
14
14
|
QBSystemMessage,
|
|
15
15
|
QBUser,
|
|
16
|
-
QBMessageStatusParams,
|
|
17
16
|
AIChatHistory,
|
|
18
17
|
AIAnswerResponse,
|
|
19
18
|
} from 'quickblox/quickblox';
|
|
@@ -40,7 +39,6 @@ import {
|
|
|
40
39
|
QBChatConnect,
|
|
41
40
|
QBChatDisconnect,
|
|
42
41
|
qbChatGetMessagesExtended,
|
|
43
|
-
QBChatMarkMessageDelivered,
|
|
44
42
|
QBChatMarkMessageRead,
|
|
45
43
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
46
44
|
// QBChatMarkMessageRead,
|
|
@@ -128,8 +126,8 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
128
126
|
private _authProcessed: boolean;
|
|
129
127
|
|
|
130
128
|
get authProcessed(): boolean {
|
|
131
|
-
const QB = getQB();
|
|
132
129
|
const auth = this._authProcessed;
|
|
130
|
+
const QB = getQB();
|
|
133
131
|
const chatConnection = QB && QB.chat && QB.chat.isConnected;
|
|
134
132
|
|
|
135
133
|
if (chatConnection) return true;
|
|
@@ -180,9 +178,52 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
180
178
|
return dialogDTOMapper;
|
|
181
179
|
}
|
|
182
180
|
|
|
181
|
+
//
|
|
182
|
+
private startUserCachePreload(): void {
|
|
183
|
+
if (this.userCachePreloadInterval) return;
|
|
184
|
+
|
|
185
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
186
|
+
this.userCachePreloadInterval = setInterval(async () => {
|
|
187
|
+
try {
|
|
188
|
+
const pagination = new Pagination(1, 100); // Пагинация по 100 пользователей
|
|
189
|
+
let hasMoreUsers = true;
|
|
190
|
+
|
|
191
|
+
while (hasMoreUsers) {
|
|
192
|
+
// eslint-disable-next-line no-await-in-loop
|
|
193
|
+
const { ResultData, PaginationResult } = await this.getAllUsers(
|
|
194
|
+
pagination,
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
198
|
+
for (const user of ResultData) {
|
|
199
|
+
if (!this.userCache.has(user.id)) {
|
|
200
|
+
this.userCache.set(user.id, user);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (
|
|
205
|
+
PaginationResult.getCurrentPage() >= PaginationResult.totalPages
|
|
206
|
+
) {
|
|
207
|
+
hasMoreUsers = false;
|
|
208
|
+
} else {
|
|
209
|
+
pagination.setCurrentPage(pagination.getCurrentPage() + 1);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
console.log(
|
|
214
|
+
`User cache preload complete. Loaded ${this.userCache.size} users.`,
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
clearInterval(this.userCachePreloadInterval!);
|
|
218
|
+
this.userCachePreloadInterval = null;
|
|
219
|
+
} catch (error) {
|
|
220
|
+
console.error('Error during user cache preload:', error);
|
|
221
|
+
}
|
|
222
|
+
}, 4500); // Интервал 10 секунд
|
|
223
|
+
}
|
|
224
|
+
|
|
183
225
|
//
|
|
184
226
|
constructor() {
|
|
185
|
-
console.log('CONSTRUCTOR RemoteDataSourceMock');
|
|
186
227
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
187
228
|
// @ts-ignore
|
|
188
229
|
console.log('QB inside RemoteDataSource:', window.QB);
|
|
@@ -207,6 +248,8 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
207
248
|
new SubscriptionPerformer<RemoteMessageDTO>();
|
|
208
249
|
this.subscriptionOnSystemMessages[NotificationTypes.NEW_DIALOG] =
|
|
209
250
|
new SubscriptionPerformer<RemoteMessageDTO>();
|
|
251
|
+
|
|
252
|
+
// this.startUserCachePreload(); //TODO: uncomment this line after test [CSAMPLES-4065] is done
|
|
210
253
|
}
|
|
211
254
|
|
|
212
255
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -227,42 +270,6 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
227
270
|
return QBTranslate(smartChatAssistantId, text, languageCode);
|
|
228
271
|
}
|
|
229
272
|
|
|
230
|
-
// async updateCurrentDialog(dto: RemoteDialogDTO, qbConfig: QBUIKitConfig): Promise<void> {
|
|
231
|
-
// this.currentDialog = dto;
|
|
232
|
-
// //
|
|
233
|
-
// //
|
|
234
|
-
// const dialogsDTOtoEntityMapper: IMapper = new DialogRemoteDTOMapper();
|
|
235
|
-
//
|
|
236
|
-
// const dialogEntity: DialogEntity = await dialogsDTOtoEntityMapper.toEntity(
|
|
237
|
-
// this.currentDialog,
|
|
238
|
-
// );
|
|
239
|
-
// const userId = this._authInformation?.userId || -1;
|
|
240
|
-
// const dialogId = this.currentDialog.id;
|
|
241
|
-
// const messageId = this.currentDialog.lastMessageId;
|
|
242
|
-
// //
|
|
243
|
-
// //
|
|
244
|
-
// const resultMessage: DialogEventInfo = {
|
|
245
|
-
// eventMessageType: EventMessageType.LocalMessage,
|
|
246
|
-
// dialogInfo: dialogEntity,
|
|
247
|
-
// messageInfo: undefined,
|
|
248
|
-
// messageStatus: {
|
|
249
|
-
// isTyping: false,
|
|
250
|
-
// userId,
|
|
251
|
-
// dialogId,
|
|
252
|
-
// messageId,
|
|
253
|
-
// deliveryStatus: 'delivered',
|
|
254
|
-
// },
|
|
255
|
-
// notificationTypes: undefined,
|
|
256
|
-
// };
|
|
257
|
-
//
|
|
258
|
-
// this.subscriptionOnMessageStatus.informSubscribers(
|
|
259
|
-
// resultMessage,
|
|
260
|
-
// EventMessageType.LocalMessage,
|
|
261
|
-
// );
|
|
262
|
-
// //
|
|
263
|
-
//
|
|
264
|
-
// //
|
|
265
|
-
// }
|
|
266
273
|
async updateCurrentDialog(
|
|
267
274
|
dto: RemoteDialogDTO,
|
|
268
275
|
qbConfig: QBUIKitConfig,
|
|
@@ -863,21 +870,12 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
863
870
|
//
|
|
864
871
|
//
|
|
865
872
|
this.initEventsHandlers();
|
|
866
|
-
//
|
|
867
|
-
//
|
|
868
|
-
console.log('USER DATA : ', userRequiredParams);
|
|
869
|
-
console.log('USER SESSION DATA : ', sessionResult);
|
|
870
|
-
console.log('Session token : ', sessionResult.token);
|
|
871
873
|
|
|
872
874
|
const session = sessionResult;
|
|
873
875
|
const sessionDataTmp = JSON.stringify(session);
|
|
874
876
|
|
|
875
877
|
const sessionData = JSON.parse(sessionDataTmp);
|
|
876
878
|
|
|
877
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
878
|
-
console.log(`user_id = ${sessionData.user_id}`);
|
|
879
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
880
|
-
console.log(`session token to chat init = ${sessionData.token}`);
|
|
881
879
|
const authInformation = {
|
|
882
880
|
userName: authParams.login,
|
|
883
881
|
userId: sessionData.user_id,
|
|
@@ -890,71 +888,113 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
890
888
|
password: authInformation.password,
|
|
891
889
|
};
|
|
892
890
|
|
|
893
|
-
console.log(paramsConnect);
|
|
894
|
-
//
|
|
895
891
|
const connectResult = await QBChatConnect(paramsConnect);
|
|
896
892
|
|
|
897
893
|
if (connectResult) {
|
|
898
894
|
//
|
|
899
895
|
this._authInformation = authInformation;
|
|
900
896
|
this.setAuthProcessedSuccessed();
|
|
901
|
-
console.log('CHAT CONNECTED. CAN WORK!');
|
|
902
|
-
console.log('CONNECTION DATA: ', JSON.stringify(authInformation));
|
|
903
|
-
// //
|
|
904
|
-
// this.initEventsHandlers();
|
|
905
|
-
// //
|
|
906
897
|
} else {
|
|
907
898
|
console.log('could not connect to chat');
|
|
908
899
|
}
|
|
909
900
|
|
|
910
901
|
//
|
|
911
902
|
}
|
|
903
|
+
// get dialogs flow
|
|
912
904
|
|
|
913
|
-
async
|
|
914
|
-
|
|
905
|
+
private async joinGroupDialog(dialogId: string): Promise<void> {
|
|
906
|
+
try {
|
|
907
|
+
await QBJoinGroupDialog(dialogId).catch(() => {
|
|
908
|
+
this.joinStatusMap.set(dialogId, false);
|
|
909
|
+
throw new RemoteDataSourceException(
|
|
910
|
+
INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_MESSAGE,
|
|
911
|
+
INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_CODE,
|
|
912
|
+
);
|
|
913
|
+
});
|
|
914
|
+
this.joinStatusMap.set(dialogId, true);
|
|
915
|
+
} catch (reason) {
|
|
916
|
+
console.log(`QBJoinGroupDialog error for dialog ${dialogId}:`, reason);
|
|
917
|
+
this.joinStatusMap.set(dialogId, false);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// version 0.5.0-beta.11,12,14
|
|
922
|
+
private startJoinRetryProcess(): void {
|
|
923
|
+
if (this.joinCheckInterval) return;
|
|
924
|
+
|
|
925
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
926
|
+
this.joinCheckInterval = setInterval(async () => {
|
|
927
|
+
const dialogsToRetry = Array.from(this.joinStatusMap.entries())
|
|
928
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
929
|
+
.filter(([_, isJoined]) => !isJoined)
|
|
930
|
+
.map(([id]) => id);
|
|
931
|
+
|
|
932
|
+
if (dialogsToRetry.length === 0) {
|
|
933
|
+
clearInterval(this.joinCheckInterval!);
|
|
934
|
+
this.joinCheckInterval = null;
|
|
935
|
+
console.log('All dialogs successfully joined. Stopping retry process.');
|
|
936
|
+
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
console.log(`Retrying join for ${dialogsToRetry.length} dialogs...`);
|
|
941
|
+
await this.processDialogs(dialogsToRetry);
|
|
942
|
+
}, 7000);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
private async processDialogsInBackground(dialogIds: string[]): Promise<void> {
|
|
946
|
+
const BATCH_SIZE = 12;
|
|
915
947
|
|
|
916
948
|
console.log(
|
|
917
|
-
|
|
918
|
-
JSON.stringify(pagination),
|
|
919
|
-
);
|
|
920
|
-
console.log(
|
|
921
|
-
'call getDialogs in RemoteDataSourceMock with result pagination: ',
|
|
922
|
-
JSON.stringify(currentPagination),
|
|
949
|
+
`Starting background processing for ${dialogIds.length} dialogs`,
|
|
923
950
|
);
|
|
924
|
-
const pageNumber = currentPagination.getCurrentPage() || 1;
|
|
925
951
|
|
|
926
|
-
|
|
952
|
+
for (let i = 0; i < dialogIds.length; i += BATCH_SIZE) {
|
|
953
|
+
const batch = dialogIds.slice(i, i + BATCH_SIZE);
|
|
954
|
+
|
|
955
|
+
console.log(`Processing batch ${i / BATCH_SIZE + 1}:`, batch);
|
|
956
|
+
|
|
957
|
+
// eslint-disable-next-line no-await-in-loop
|
|
958
|
+
await Promise.all(batch.map((id) => this.joinGroupDialog(id)));
|
|
959
|
+
console.log(`Batch ${i / BATCH_SIZE + 1} completed.`);
|
|
960
|
+
|
|
961
|
+
// eslint-disable-next-line
|
|
962
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
console.log('Background processing complete.');
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
private async processDialogs(dialogIds: string[]): Promise<void> {
|
|
969
|
+
await Promise.all(dialogIds.map((id) => this.joinGroupDialog(id)));
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
async getDialogs(pagination?: Pagination): Promise<RemoteDialogsDTO> {
|
|
973
|
+
let currentPagination: Pagination = pagination || new Pagination();
|
|
974
|
+
|
|
975
|
+
const pageNumber = currentPagination.getCurrentPage() || 1;
|
|
927
976
|
const perPage = currentPagination.perPage || 100;
|
|
928
977
|
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
created_at: {
|
|
932
|
-
lt: Date.now() / 1000,
|
|
933
|
-
},
|
|
934
|
-
// sort_desc: 'created_at',// artan 19.0.2024
|
|
978
|
+
const params: Dictionary<any> = {
|
|
979
|
+
created_at: { lt: Date.now() / 1000 },
|
|
935
980
|
sort_desc: 'updated_at',
|
|
936
981
|
page: pageNumber,
|
|
937
982
|
limit: perPage,
|
|
938
|
-
// type: {
|
|
939
|
-
// in: [2, 3],
|
|
940
|
-
// },
|
|
983
|
+
// type: { in: [2, 3] },
|
|
941
984
|
};
|
|
942
985
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
986
|
+
// Conditionally filter dialog types unless public dialogs should be shown
|
|
987
|
+
if (!QBConfig.appConfig?.showPublicDialogsInList) {
|
|
988
|
+
params.type = {
|
|
989
|
+
in: [2, 3], // Only group and private dialogs
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
|
|
947
993
|
const dialogsDTO: Array<RemoteDialogDTO> = [];
|
|
994
|
+
const joinDialogIds: string[] = [];
|
|
948
995
|
const qbDialogs: QBGetDialogResult | undefined = await QBGetDialogs(params);
|
|
949
996
|
|
|
950
997
|
if (qbDialogs) {
|
|
951
|
-
console.log(
|
|
952
|
-
`request completed. have: total_entries ${
|
|
953
|
-
qbDialogs.total_entries
|
|
954
|
-
}, limit: ${qbDialogs.limit}, skip: ${
|
|
955
|
-
qbDialogs.skip
|
|
956
|
-
} items: ${JSON.stringify(qbDialogs.items)}`,
|
|
957
|
-
);
|
|
958
998
|
currentPagination = new Pagination(0, perPage);
|
|
959
999
|
currentPagination.totalPages = qbDialogs.total_entries / perPage;
|
|
960
1000
|
currentPagination.setCurrentPage(pageNumber);
|
|
@@ -963,34 +1003,37 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
963
1003
|
for (const item of qbDialogs.items) {
|
|
964
1004
|
const qbEntity: QBChatDialog = item;
|
|
965
1005
|
|
|
1006
|
+
// eslint-disable-next-line no-continue
|
|
1007
|
+
if (!qbEntity) continue;
|
|
1008
|
+
|
|
966
1009
|
const newDTO: RemoteDialogDTO =
|
|
967
1010
|
// eslint-disable-next-line no-await-in-loop
|
|
968
1011
|
await this.getCurrentDialogDTOMapper().toTDO(qbEntity);
|
|
969
1012
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
);
|
|
979
|
-
}
|
|
1013
|
+
if (
|
|
1014
|
+
newDTO.type === DialogType.group &&
|
|
1015
|
+
!this.processedDialogs.has(newDTO.id)
|
|
1016
|
+
) {
|
|
1017
|
+
this.processedDialogs.add(newDTO.id);
|
|
1018
|
+
|
|
1019
|
+
if (!this.joinStatusMap.has(newDTO.id)) {
|
|
1020
|
+
this.joinStatusMap.set(newDTO.id, false);
|
|
1021
|
+
joinDialogIds.push(newDTO.id);
|
|
1022
|
+
}
|
|
980
1023
|
}
|
|
981
1024
|
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
const statusMessageParams: QBMessageStatusParams = {
|
|
985
|
-
userId: newDTO.lastMessageUserId || currentUserId,
|
|
986
|
-
dialogId: newDTO.id,
|
|
987
|
-
messageId: newDTO.lastMessageId,
|
|
988
|
-
};
|
|
1025
|
+
dialogsDTO.push(newDTO);
|
|
1026
|
+
}
|
|
989
1027
|
|
|
990
|
-
|
|
991
|
-
QBChatMarkMessageDelivered(statusMessageParams);
|
|
1028
|
+
const firstBatch = joinDialogIds.slice(0, 24);
|
|
992
1029
|
|
|
993
|
-
|
|
1030
|
+
await this.processDialogs(firstBatch);
|
|
1031
|
+
|
|
1032
|
+
const remainingDialogs = joinDialogIds.slice(24);
|
|
1033
|
+
|
|
1034
|
+
if (remainingDialogs.length) {
|
|
1035
|
+
await this.processDialogsInBackground(remainingDialogs);
|
|
1036
|
+
this.startJoinRetryProcess();
|
|
994
1037
|
}
|
|
995
1038
|
}
|
|
996
1039
|
|
|
@@ -1049,8 +1092,6 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1049
1092
|
if (qbEntity.name && qbEntity.name.length > 0) {
|
|
1050
1093
|
data = {
|
|
1051
1094
|
name: qbEntity.name,
|
|
1052
|
-
// photo: qbEntity.photo,
|
|
1053
|
-
// photo: 'null',
|
|
1054
1095
|
...data,
|
|
1055
1096
|
};
|
|
1056
1097
|
}
|
|
@@ -1181,6 +1222,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1181
1222
|
),
|
|
1182
1223
|
);
|
|
1183
1224
|
}
|
|
1225
|
+
|
|
1184
1226
|
let dtoUser: RemoteUserDTO | undefined;
|
|
1185
1227
|
|
|
1186
1228
|
try {
|
|
@@ -1226,7 +1268,6 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1226
1268
|
return Promise.resolve(new RemoteUsersDTO(usersDTO, new Pagination()));
|
|
1227
1269
|
}
|
|
1228
1270
|
|
|
1229
|
-
//
|
|
1230
1271
|
// eslint-disable-next-line class-methods-use-this
|
|
1231
1272
|
public async getAllUsers(
|
|
1232
1273
|
pagination: Pagination,
|
|
@@ -1312,8 +1353,6 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1312
1353
|
|
|
1313
1354
|
return { ResultData: users, PaginationResult: resultPagination };
|
|
1314
1355
|
}
|
|
1315
|
-
//
|
|
1316
|
-
//
|
|
1317
1356
|
|
|
1318
1357
|
// eslint-disable-next-line @typescript-eslint/require-await,class-methods-use-this,@typescript-eslint/no-unused-vars,@typescript-eslint/ban-ts-comment
|
|
1319
1358
|
// @ts-ignore
|
|
@@ -1337,11 +1376,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1337
1376
|
),
|
|
1338
1377
|
);
|
|
1339
1378
|
}
|
|
1340
|
-
console.log(
|
|
1341
|
-
`GET MESSAGES ${qbMessages.items.length} FROM SERVER: ${JSON.stringify(
|
|
1342
|
-
qbMessages,
|
|
1343
|
-
)} `,
|
|
1344
|
-
);
|
|
1379
|
+
console.log(`GET MESSAGES ${qbMessages.items.length} FROM SERVER.`);
|
|
1345
1380
|
const currentUserId = this._authInformation?.userId;
|
|
1346
1381
|
|
|
1347
1382
|
await Promise.all(
|
|
@@ -1385,12 +1420,9 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1385
1420
|
await this.getCurrentDialogDTOMapper().fromDTO(dialogDTO);
|
|
1386
1421
|
|
|
1387
1422
|
if (dialogDTO.type === DialogType.group) {
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_CODE,
|
|
1392
|
-
);
|
|
1393
|
-
});
|
|
1423
|
+
if (!this.joinStatusMap.has(dialogDTO.id)) {
|
|
1424
|
+
await this.joinGroupDialog(dialogDTO.id);
|
|
1425
|
+
}
|
|
1394
1426
|
}
|
|
1395
1427
|
|
|
1396
1428
|
QBSendIsTypingStatus(qbEntity, senderId);
|
|
@@ -1414,31 +1446,46 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1414
1446
|
// eslint-disable-next-line @typescript-eslint/require-await,class-methods-use-this,@typescript-eslint/no-unused-vars
|
|
1415
1447
|
async sendMessage(dto: RemoteMessageDTO): Promise<RemoteMessageDTO> {
|
|
1416
1448
|
console.log('call sendMessage');
|
|
1417
|
-
//
|
|
1418
1449
|
const QB = getQB();
|
|
1419
|
-
//
|
|
1420
1450
|
const messageText = dto.message;
|
|
1421
1451
|
|
|
1452
|
+
const extension: Partial<QBUIKitChatNewMessage['extension']> = {
|
|
1453
|
+
save_to_history: 1,
|
|
1454
|
+
dialog_id: dto.dialogId,
|
|
1455
|
+
};
|
|
1456
|
+
|
|
1457
|
+
if (dto.notification_type) {
|
|
1458
|
+
extension.notification_type = dto.notification_type;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
if (dto.sender_id || dto.recipient_id) {
|
|
1462
|
+
extension.sender_id = dto.sender_id || dto.recipient_id;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
if (dto.qb_message_action) {
|
|
1466
|
+
extension.qb_message_action = dto.qb_message_action;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
if (dto.origin_sender_name) {
|
|
1470
|
+
extension.origin_sender_name = dto.origin_sender_name;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
const originalMessages = MessageDTOMapper.translateOriginalDataToJSON(
|
|
1474
|
+
MessageDTOMapper.convertToQBChatNewMessage(
|
|
1475
|
+
dto.qb_original_messages || [],
|
|
1476
|
+
) || [],
|
|
1477
|
+
);
|
|
1478
|
+
|
|
1479
|
+
if (originalMessages && originalMessages.length > 0) {
|
|
1480
|
+
extension.qb_original_messages = originalMessages;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1422
1483
|
const qbEntity: QBUIKitChatNewMessage = {
|
|
1423
1484
|
type: dto.dialog_type === DialogType.private ? 'chat' : 'groupchat',
|
|
1424
1485
|
body: messageText || '',
|
|
1425
|
-
notification_type: dto.notification_type,
|
|
1426
1486
|
dialog_id: dto.dialogId,
|
|
1427
|
-
extension:
|
|
1428
|
-
save_to_history: 1,
|
|
1429
|
-
dialog_id: dto.dialogId,
|
|
1430
|
-
notification_type: dto.notification_type,
|
|
1431
|
-
sender_id: dto.sender_id || dto.recipient_id,
|
|
1432
|
-
qb_message_action: dto.qb_message_action, // 'forward' 'reply'
|
|
1433
|
-
origin_sender_name: dto.origin_sender_name,
|
|
1434
|
-
qb_original_messages: MessageDTOMapper.translateOriginalDataToJSON(
|
|
1435
|
-
MessageDTOMapper.convertToQBChatNewMessage(
|
|
1436
|
-
dto.qb_original_messages || [],
|
|
1437
|
-
) || [],
|
|
1438
|
-
),
|
|
1439
|
-
},
|
|
1487
|
+
extension: extension as QBUIKitChatNewMessage['extension'],
|
|
1440
1488
|
markable: 1,
|
|
1441
|
-
// markable: 0, // mark_as_read ??
|
|
1442
1489
|
};
|
|
1443
1490
|
|
|
1444
1491
|
if (dto.attachments?.length > 0) {
|
|
@@ -1455,20 +1502,35 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1455
1502
|
qbEntity.extension.attachments?.push(chatMessageAttachment);
|
|
1456
1503
|
});
|
|
1457
1504
|
}
|
|
1458
|
-
let qbMessageId: QBChatMessage['_id'];
|
|
1505
|
+
let qbMessageId: QBChatMessage['_id'] | undefined | null;
|
|
1459
1506
|
|
|
1460
1507
|
if (dto.dialog_type === DialogType.private) {
|
|
1461
1508
|
qbMessageId = await QBChatSendMessage(dto.recipient_id, qbEntity);
|
|
1462
1509
|
} else {
|
|
1463
|
-
await
|
|
1464
|
-
throw new RemoteDataSourceException(
|
|
1465
|
-
INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_MESSAGE,
|
|
1466
|
-
INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_CODE,
|
|
1467
|
-
);
|
|
1468
|
-
});
|
|
1510
|
+
await this.joinGroupDialog(dto.dialogId);
|
|
1469
1511
|
const dialogJid = QB.chat.helpers.getRoomJidFromDialogId(dto.dialogId);
|
|
1470
1512
|
|
|
1471
|
-
|
|
1513
|
+
try {
|
|
1514
|
+
qbMessageId = await QBChatSendMessage(dialogJid, qbEntity);
|
|
1515
|
+
console.log(
|
|
1516
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
1517
|
+
`Dialog joined status is ${this.joinStatusMap.has(
|
|
1518
|
+
dto.dialogId,
|
|
1519
|
+
)} and message was sent with Id: ${qbMessageId}`,
|
|
1520
|
+
);
|
|
1521
|
+
} catch (e) {
|
|
1522
|
+
qbMessageId = undefined;
|
|
1523
|
+
const errorMessage = `Error in DataSource: send message throw: ${stringifyError(
|
|
1524
|
+
e,
|
|
1525
|
+
)}`;
|
|
1526
|
+
|
|
1527
|
+
console.log('Error in DataSource: send message throw: ', errorMessage);
|
|
1528
|
+
console.warn('Error in DataSource: send message throw: ', errorMessage);
|
|
1529
|
+
console.error(
|
|
1530
|
+
'Error in DataSource: send message throw: ',
|
|
1531
|
+
errorMessage,
|
|
1532
|
+
);
|
|
1533
|
+
}
|
|
1472
1534
|
}
|
|
1473
1535
|
|
|
1474
1536
|
if (qbMessageId === null || qbMessageId === undefined) {
|
|
@@ -1479,7 +1541,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
1479
1541
|
),
|
|
1480
1542
|
);
|
|
1481
1543
|
}
|
|
1482
|
-
console.log(
|
|
1544
|
+
console.log(`DataSource: regular message was sent, id: ${qbMessageId}`);
|
|
1483
1545
|
// eslint-disable-next-line no-param-reassign
|
|
1484
1546
|
dto.id = qbMessageId;
|
|
1485
1547
|
|
|
@@ -23,7 +23,6 @@ export class CreateDialogUseCase implements IUseCase<void, DialogEntity> {
|
|
|
23
23
|
newDialog: GroupDialogEntity,
|
|
24
24
|
textInformationMessage: string,
|
|
25
25
|
) {
|
|
26
|
-
console.log('CONSTRUCTOR CreateDialogUseCase');
|
|
27
26
|
this.dialogRepository = dialogRepository;
|
|
28
27
|
this.newDialog = newDialog;
|
|
29
28
|
this.eventMessagesRepository = eventMessagesRepository;
|
|
@@ -23,7 +23,6 @@ export class ForwardMessagesUseCase implements IUseCase<void, boolean> {
|
|
|
23
23
|
relatedMessage: MessageEntity,
|
|
24
24
|
userName: string,
|
|
25
25
|
) {
|
|
26
|
-
console.log('CONSTRUCTOR ForwardMessagesUseCase');
|
|
27
26
|
this.messagesRepository = messagesRepository;
|
|
28
27
|
this.relatedMessage = relatedMessage;
|
|
29
28
|
this.targetDialogs = targetDialogs;
|
|
@@ -11,13 +11,11 @@ export class GetAllDialogsUseCaseWithMock
|
|
|
11
11
|
private readonly pagination: Pagination;
|
|
12
12
|
|
|
13
13
|
constructor(dialogRepository: DialogsRepository, pagination?: Pagination) {
|
|
14
|
-
console.log('CONSTRUCTOR GetAllDialogsUseCaseWithMock');
|
|
15
14
|
this.dialogRepository = dialogRepository;
|
|
16
15
|
this.pagination = pagination || new Pagination();
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async execute(): Promise<PaginatedResult<DialogEntity>> {
|
|
20
|
-
console.log('execute GetAllDialogsUseCaseWithMock');
|
|
21
19
|
const fromRemote: PaginatedResult<DialogEntity> =
|
|
22
20
|
await this.dialogRepository.getDialogsFromRemote(this.pagination);
|
|
23
21
|
|
|
@@ -17,7 +17,6 @@ export class GetAllMessagesForDialogMock
|
|
|
17
17
|
dialogId: string,
|
|
18
18
|
currentPagination: Pagination,
|
|
19
19
|
) {
|
|
20
|
-
console.log('CONSTRUCTOR GetAllMessagesForDialog');
|
|
21
20
|
this.messagesRepository = messagesRepository;
|
|
22
21
|
this.dialogId = dialogId;
|
|
23
22
|
this.currentPagination = currentPagination;
|
|
@@ -8,13 +8,11 @@ export class GetDialogByIdUseCase implements IUseCase<void, DialogEntity> {
|
|
|
8
8
|
private readonly dialogId: string;
|
|
9
9
|
|
|
10
10
|
constructor(dialogRepository: DialogsRepository, dialogId: string) {
|
|
11
|
-
console.log('CONSTRUCTOR GetDialogByIdUseCase');
|
|
12
11
|
this.dialogRepository = dialogRepository;
|
|
13
12
|
this.dialogId = dialogId;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
async execute(): Promise<DialogEntity> {
|
|
17
|
-
console.log('execute GetAllDialogsUseCaseWithMock');
|
|
18
16
|
const fromRemote: DialogEntity =
|
|
19
17
|
await this.dialogRepository.getDialogFromRemote(this.dialogId);
|
|
20
18
|
|
|
@@ -8,7 +8,6 @@ export class GetUsersByIdsUseCase implements IUseCase<void, Array<UserEntity>> {
|
|
|
8
8
|
private userIds: Array<number>;
|
|
9
9
|
|
|
10
10
|
constructor(usersRepository: UsersRepository, userIds: Array<number>) {
|
|
11
|
-
console.log('CONSTRUCTOR GetUsersByIdsUseCase');
|
|
12
11
|
this.usersRepository = usersRepository;
|
|
13
12
|
this.userIds = userIds;
|
|
14
13
|
}
|
|
@@ -36,7 +36,6 @@ export class LeaveDialogUseCase implements IUseCase<void, boolean> {
|
|
|
36
36
|
leaveType: DialogLeaveTypeArcheType,
|
|
37
37
|
textInformationMessage: string,
|
|
38
38
|
) {
|
|
39
|
-
console.log('CONSTRUCTOR LeaveDialogUseCase');
|
|
40
39
|
this.eventMessagesRepository = eventMessagesRepository;
|
|
41
40
|
this.dialogRepository = dialogRepository;
|
|
42
41
|
this.dialogToLeave = dialog;
|
|
@@ -30,7 +30,6 @@ export class RemoveUsersFromTheDialogUseCase
|
|
|
30
30
|
usersIds: Array<number>,
|
|
31
31
|
textInformationMessage: string,
|
|
32
32
|
) {
|
|
33
|
-
console.log('CONSTRUCTOR LeaveDialogUseCase');
|
|
34
33
|
this.eventMessagesRepository = eventMessagesRepository;
|
|
35
34
|
this.dialogRepository = dialogRepository;
|
|
36
35
|
this.dialogToLeave = dialog;
|
|
@@ -14,14 +14,12 @@ export class ReplyMessagesUseCase implements IUseCase<void, MessageEntity> {
|
|
|
14
14
|
messagesToReply: MessageEntity[],
|
|
15
15
|
relatedMessage: MessageEntity,
|
|
16
16
|
) {
|
|
17
|
-
console.log('CONSTRUCTOR ReplyMessagesUseCase');
|
|
18
17
|
this.messagesRepository = messagesRepository;
|
|
19
18
|
this.relatedMessage = relatedMessage;
|
|
20
19
|
this.messagesToReply = messagesToReply;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
async execute(): Promise<MessageEntity> {
|
|
24
|
-
console.log('execute ReplyMessagesUseCase');
|
|
25
23
|
this.relatedMessage.qb_original_messages = this.messagesToReply;
|
|
26
24
|
this.relatedMessage.qb_message_action = 'reply';
|
|
27
25
|
this.relatedMessage.origin_sender_name =
|
|
@@ -11,14 +11,11 @@ export class SendTextMessageUseCase implements IUseCase<void, MessageEntity> {
|
|
|
11
11
|
messagesRepository: MessagesRepository,
|
|
12
12
|
messageToSend: MessageEntity,
|
|
13
13
|
) {
|
|
14
|
-
console.log('CONSTRUCTOR SendTextMessageUseCase');
|
|
15
14
|
this.messagesRepository = messagesRepository;
|
|
16
15
|
this.messageToSend = messageToSend;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async execute(): Promise<MessageEntity> {
|
|
20
|
-
console.log('execute SendTextMessageUseCase');
|
|
21
|
-
|
|
22
19
|
const sentMessage: MessageEntity =
|
|
23
20
|
await this.messagesRepository.sendMessageToRemote(this.messageToSend);
|
|
24
21
|
|