quickblox-react-ui-kit 0.3.1-beta.1 → 0.3.1-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/dist/CommonTypes/CommonTypes.d.ts +1 -1
- package/dist/Data/Stubs.d.ts +1 -1
- package/dist/Data/dto/dialog/RemoteDialogDTO.d.ts +1 -1
- package/dist/Data/dto/user/LocalUserDTO.d.ts +1 -1
- package/dist/Data/dto/user/RemoteUserDTO.d.ts +1 -1
- package/dist/Data/source/remote/RemoteDataSource.d.ts +1 -1
- package/dist/Domain/entity/UserEntity.d.ts +1 -1
- package/dist/Presentation/ui-components/TextField/TextField.d.ts +1 -1
- package/dist/index-ui.js +147 -260
- package/dist/index-ui.js.map +1 -1
- package/dist/qb-api-calls/index.d.ts +2 -1
- package/global.d.ts +29 -29
- package/package.json +2 -2
- package/src/CommonTypes/CommonTypes.ts +1 -0
- package/src/Data/DefaultConfigurations.ts +4 -4
- package/src/Data/Stubs.ts +17 -18
- package/src/Data/dto/dialog/RemoteDialogDTO.ts +2 -2
- package/src/Data/dto/user/LocalUserDTO.ts +2 -2
- package/src/Data/dto/user/RemoteUserDTO.ts +2 -2
- package/src/Data/mapper/DialogRemoteDTOMapper.ts +13 -13
- package/src/Data/mapper/UserLocalDTOMapper.ts +2 -2
- package/src/Data/mapper/UserRemoteDTOMapper.ts +2 -2
- package/src/Data/source/remote/Mapper/DialogDTOMapper.ts +9 -9
- package/src/Data/source/remote/RemoteDataSource.ts +45 -2
- package/src/Domain/entity/UserEntity.ts +1 -1
- package/src/Presentation/Views/Dialog/MessageItem/MessageItem.tsx +2 -2
- package/src/Presentation/Views/Dialog/useDialogViewModel.ts +37 -151
- package/src/Presentation/Views/DialogInfo/DialogInfo.tsx +1 -0
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +3 -0
- package/src/Presentation/Views/InviteMembers/useInviteMembersViewModel.ts +11 -1
- package/src/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +11 -42
- package/src/QBconfig.ts +4 -4
- package/src/qb-api-calls/index.ts +5 -0
- package/storybook-static/{703.1137fb37.iframe.bundle.js → 703.2cbec951.iframe.bundle.js} +2 -2
- package/storybook-static/{703.1137fb37.iframe.bundle.js.map → 703.2cbec951.iframe.bundle.js.map} +1 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.bf8a24d1.iframe.bundle.js +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/{runtime~main.8d5710fb.iframe.bundle.js → runtime~main.af13ca55.iframe.bundle.js} +1 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.0c6310aa.iframe.bundle.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetMessagesResult, GetUserParams, ListUserParams, ListUserResponse, QBBlob, QBBlobCreateUploadParams, QBCustomObject, QBDataDeletedResponse, QBGetDialogResult, QBLoginParams, QBMediaParams, QBMessageStatusParams, QBSession, QBSystemMessage, QBUser, QBUserCreateParams, QBWebRTCSession } from 'quickblox/quickblox';
|
|
1
|
+
import { ChatConnectParams, GetMessagesResult, GetUserParams, ListUserParams, ListUserResponse, QBBlob, QBBlobCreateUploadParams, QBCustomObject, QBDataDeletedResponse, QBGetDialogResult, QBLoginParams, QBMediaParams, QBMessageStatusParams, QBSession, QBSystemMessage, QBUser, QBUserCreateParams, QBWebRTCSession } from 'quickblox/quickblox';
|
|
2
2
|
import { QBUIKitChatDialog, QBUIKitChatNewMessage, QBUIKitConfig } from '../CommonTypes/CommonTypes';
|
|
3
3
|
export type QBInitParams = {
|
|
4
4
|
appIdOrToken: string | number;
|
|
@@ -70,4 +70,5 @@ export declare function QBChatSendSystemMessage(to: QBUser['id'] | string, messa
|
|
|
70
70
|
extension: QBSystemMessage['extension'];
|
|
71
71
|
}): Promise<string>;
|
|
72
72
|
export declare function QBChatMarkMessageRead(params: QBMessageStatusParams): void;
|
|
73
|
+
export declare function QBChatMarkMessageDelivered(params: QBMessageStatusParams): void;
|
|
73
74
|
export declare function QBWebRTCSessionGetUserMedia(session: QBWebRTCSession, params: QBMediaParams): Promise<MediaStream | undefined>;
|
package/global.d.ts
CHANGED
|
@@ -173,32 +173,32 @@ type Dictionary<T> = Record<string, T>;
|
|
|
173
173
|
// }
|
|
174
174
|
|
|
175
175
|
// TODO: add export to SDK
|
|
176
|
-
type ChatConnectParams =
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
type QBCustomField =
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
176
|
+
// type ChatConnectParams =
|
|
177
|
+
// | {
|
|
178
|
+
// /** Connect to the chat by user id */
|
|
179
|
+
// userId: QBUser['id'];
|
|
180
|
+
// /** The user's password or session token */
|
|
181
|
+
// password: string;
|
|
182
|
+
// }
|
|
183
|
+
// | {
|
|
184
|
+
// /** Connect to the chat by user jid */
|
|
185
|
+
// jid: string;
|
|
186
|
+
// /** The user's password or session token */
|
|
187
|
+
// password: string;
|
|
188
|
+
// }
|
|
189
|
+
// | {
|
|
190
|
+
// /** Connect to the chat by user's email */
|
|
191
|
+
// email: string;
|
|
192
|
+
// /** The user's password or session token */
|
|
193
|
+
// password: string;
|
|
194
|
+
// };
|
|
195
|
+
//
|
|
196
|
+
// type QBCustomField =
|
|
197
|
+
// | string
|
|
198
|
+
// | string[]
|
|
199
|
+
// | number
|
|
200
|
+
// | number[]
|
|
201
|
+
// | boolean
|
|
202
|
+
// | boolean[]
|
|
203
|
+
// | null
|
|
204
|
+
// | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quickblox-react-ui-kit",
|
|
3
|
-
"version": "0.3.1-beta.
|
|
3
|
+
"version": "0.3.1-beta.3",
|
|
4
4
|
"main": "dist/index-ui.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"qb-ai-core": "^0.1.3",
|
|
13
13
|
"qb-ai-rephrase": "^0.1.2",
|
|
14
14
|
"qb-ai-translate": "^0.1.2",
|
|
15
|
-
"quickblox": "^2.16.
|
|
15
|
+
"quickblox": "^2.16.3",
|
|
16
16
|
"react": "^18.2.0",
|
|
17
17
|
"react-dom": "^18.2.0",
|
|
18
18
|
"react-router-dom": "^6.11.1",
|
|
@@ -137,10 +137,10 @@ export class DefaultConfigurations {
|
|
|
137
137
|
static getDefaultQBConfig(): QBUIKitConfig {
|
|
138
138
|
return {
|
|
139
139
|
credentials: {
|
|
140
|
-
appId:
|
|
141
|
-
accountKey: '
|
|
142
|
-
authKey: '
|
|
143
|
-
authSecret: '
|
|
140
|
+
appId: -1,
|
|
141
|
+
accountKey: '',
|
|
142
|
+
authKey: '',
|
|
143
|
+
authSecret: '',
|
|
144
144
|
sessionToken: '',
|
|
145
145
|
},
|
|
146
146
|
configAIApi: {
|
package/src/Data/Stubs.ts
CHANGED
|
@@ -105,10 +105,9 @@ export class Stubs {
|
|
|
105
105
|
for (const item of dialogsEntities) {
|
|
106
106
|
const dialogDTO: LocalDialogDTO =
|
|
107
107
|
// eslint-disable-next-line no-await-in-loop
|
|
108
|
-
await dialogsDTOtoEntityMapper.fromEntity<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
>(item);
|
|
108
|
+
await dialogsDTOtoEntityMapper.fromEntity<DialogEntity, LocalDialogDTO>(
|
|
109
|
+
item,
|
|
110
|
+
);
|
|
112
111
|
|
|
113
112
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,promise/catch-or-return,promise/always-return
|
|
114
113
|
ds.saveDialog(dialogDTO)
|
|
@@ -537,7 +536,7 @@ export class Stubs {
|
|
|
537
536
|
dto.id = '111';
|
|
538
537
|
dto.lastMessageDateSent = 0;
|
|
539
538
|
dto.lastMessageText = 'text test';
|
|
540
|
-
dto.lastMessageUserId =
|
|
539
|
+
dto.lastMessageUserId = 777;
|
|
541
540
|
dto.ownerId = '999';
|
|
542
541
|
dto.type = dialogType;
|
|
543
542
|
dto.unreadMessageCount = 555;
|
|
@@ -548,7 +547,7 @@ export class Stubs {
|
|
|
548
547
|
dto.id = '111';
|
|
549
548
|
dto.lastMessageDateSent = 0;
|
|
550
549
|
dto.lastMessageText = 'text test';
|
|
551
|
-
dto.lastMessageUserId =
|
|
550
|
+
dto.lastMessageUserId = 777;
|
|
552
551
|
dto.ownerId = '999';
|
|
553
552
|
dto.type = dialogType;
|
|
554
553
|
dto.unreadMessageCount = 555;
|
|
@@ -560,7 +559,7 @@ export class Stubs {
|
|
|
560
559
|
dto.id = '111';
|
|
561
560
|
dto.lastMessageDateSent = 0;
|
|
562
561
|
dto.lastMessageText = 'text test';
|
|
563
|
-
dto.lastMessageUserId =
|
|
562
|
+
dto.lastMessageUserId = 777;
|
|
564
563
|
dto.ownerId = '999';
|
|
565
564
|
dto.type = dialogType;
|
|
566
565
|
dto.unreadMessageCount = 555;
|
|
@@ -604,7 +603,7 @@ export class Stubs {
|
|
|
604
603
|
participantsIds: [],
|
|
605
604
|
lastMessageText: '',
|
|
606
605
|
lastMessageDateSent: 0,
|
|
607
|
-
lastMessageUserId:
|
|
606
|
+
lastMessageUserId: 0,
|
|
608
607
|
lastMessageId: '',
|
|
609
608
|
unreadMessageCount: 0,
|
|
610
609
|
updatedAt: '',
|
|
@@ -619,7 +618,7 @@ export class Stubs {
|
|
|
619
618
|
participantsIds: [],
|
|
620
619
|
lastMessageText: '',
|
|
621
620
|
lastMessageDateSent: 0,
|
|
622
|
-
lastMessageUserId:
|
|
621
|
+
lastMessageUserId: 0,
|
|
623
622
|
lastMessageId: '',
|
|
624
623
|
unreadMessageCount: 0,
|
|
625
624
|
updatedAt: '',
|
|
@@ -634,7 +633,7 @@ export class Stubs {
|
|
|
634
633
|
participantsIds: [],
|
|
635
634
|
lastMessageText: '',
|
|
636
635
|
lastMessageDateSent: 0,
|
|
637
|
-
lastMessageUserId:
|
|
636
|
+
lastMessageUserId: 0,
|
|
638
637
|
lastMessageId: '',
|
|
639
638
|
unreadMessageCount: 0,
|
|
640
639
|
updatedAt: '',
|
|
@@ -649,7 +648,7 @@ export class Stubs {
|
|
|
649
648
|
participantsIds: [],
|
|
650
649
|
lastMessageText: '',
|
|
651
650
|
lastMessageDateSent: 0,
|
|
652
|
-
lastMessageUserId:
|
|
651
|
+
lastMessageUserId: 0,
|
|
653
652
|
lastMessageId: '',
|
|
654
653
|
unreadMessageCount: 0,
|
|
655
654
|
updatedAt: '',
|
|
@@ -664,7 +663,7 @@ export class Stubs {
|
|
|
664
663
|
participantsIds: [],
|
|
665
664
|
lastMessageText: '',
|
|
666
665
|
lastMessageDateSent: 0,
|
|
667
|
-
lastMessageUserId:
|
|
666
|
+
lastMessageUserId: 0,
|
|
668
667
|
lastMessageId: '',
|
|
669
668
|
unreadMessageCount: 0,
|
|
670
669
|
updatedAt: '',
|
|
@@ -679,7 +678,7 @@ export class Stubs {
|
|
|
679
678
|
participantsIds: [],
|
|
680
679
|
lastMessageText: '',
|
|
681
680
|
lastMessageDateSent: 0,
|
|
682
|
-
lastMessageUserId:
|
|
681
|
+
lastMessageUserId: 0,
|
|
683
682
|
lastMessageId: '',
|
|
684
683
|
unreadMessageCount: 0,
|
|
685
684
|
updatedAt: '',
|
|
@@ -694,7 +693,7 @@ export class Stubs {
|
|
|
694
693
|
participantsIds: [],
|
|
695
694
|
lastMessageText: '',
|
|
696
695
|
lastMessageDateSent: 0,
|
|
697
|
-
lastMessageUserId:
|
|
696
|
+
lastMessageUserId: 0,
|
|
698
697
|
lastMessageId: '',
|
|
699
698
|
unreadMessageCount: 0,
|
|
700
699
|
updatedAt: '',
|
|
@@ -867,7 +866,7 @@ export class Stubs {
|
|
|
867
866
|
login: string,
|
|
868
867
|
created_at: string,
|
|
869
868
|
updated_at: string,
|
|
870
|
-
last_request_at:
|
|
869
|
+
last_request_at: string,
|
|
871
870
|
custom_data: string | null = null,
|
|
872
871
|
user_tags: string | null = null,
|
|
873
872
|
blob_id = '',
|
|
@@ -965,7 +964,7 @@ export class Stubs {
|
|
|
965
964
|
'login_user11',
|
|
966
965
|
'31.03.2023',
|
|
967
966
|
'31.03.2023',
|
|
968
|
-
|
|
967
|
+
'',
|
|
969
968
|
);
|
|
970
969
|
|
|
971
970
|
const user12: UserEntity = Stubs.createUserEntityWithParams(
|
|
@@ -975,7 +974,7 @@ export class Stubs {
|
|
|
975
974
|
'login_user12',
|
|
976
975
|
'31.03.2023',
|
|
977
976
|
'31.03.2023',
|
|
978
|
-
|
|
977
|
+
'',
|
|
979
978
|
);
|
|
980
979
|
|
|
981
980
|
const user13: UserEntity = Stubs.createUserEntityWithParams(
|
|
@@ -985,7 +984,7 @@ export class Stubs {
|
|
|
985
984
|
'login_user13',
|
|
986
985
|
'31.03.2023',
|
|
987
986
|
'31.03.2023',
|
|
988
|
-
|
|
987
|
+
'',
|
|
989
988
|
);
|
|
990
989
|
|
|
991
990
|
users.push(user11);
|
|
@@ -17,7 +17,7 @@ export class RemoteDialogDTO {
|
|
|
17
17
|
|
|
18
18
|
public lastMessageText: string;
|
|
19
19
|
|
|
20
|
-
public lastMessageUserId:
|
|
20
|
+
public lastMessageUserId: number;
|
|
21
21
|
|
|
22
22
|
public lastMessageDateSent: number;
|
|
23
23
|
|
|
@@ -43,7 +43,7 @@ export class RemoteDialogDTO {
|
|
|
43
43
|
|
|
44
44
|
this.lastMessageText = '';
|
|
45
45
|
|
|
46
|
-
this.lastMessageUserId =
|
|
46
|
+
this.lastMessageUserId = 0;
|
|
47
47
|
|
|
48
48
|
this.lastMessageDateSent = 0;
|
|
49
49
|
|
|
@@ -13,7 +13,7 @@ export class LocalUserDTO {
|
|
|
13
13
|
|
|
14
14
|
public updated_at: string;
|
|
15
15
|
|
|
16
|
-
public last_request_at:
|
|
16
|
+
public last_request_at: string;
|
|
17
17
|
|
|
18
18
|
public custom_data: string | null;
|
|
19
19
|
|
|
@@ -29,7 +29,7 @@ export class LocalUserDTO {
|
|
|
29
29
|
this.login = '';
|
|
30
30
|
this.created_at = '';
|
|
31
31
|
this.updated_at = '';
|
|
32
|
-
this.last_request_at =
|
|
32
|
+
this.last_request_at = '';
|
|
33
33
|
this.custom_data = '';
|
|
34
34
|
this.user_tags = '';
|
|
35
35
|
this.blob_id = '';
|
|
@@ -13,7 +13,7 @@ export class RemoteUserDTO {
|
|
|
13
13
|
|
|
14
14
|
public updated_at: string;
|
|
15
15
|
|
|
16
|
-
public last_request_at:
|
|
16
|
+
public last_request_at: string;
|
|
17
17
|
|
|
18
18
|
public custom_data: string | null;
|
|
19
19
|
|
|
@@ -29,7 +29,7 @@ export class RemoteUserDTO {
|
|
|
29
29
|
this.login = '';
|
|
30
30
|
this.created_at = '';
|
|
31
31
|
this.updated_at = '';
|
|
32
|
-
this.last_request_at =
|
|
32
|
+
this.last_request_at = '';
|
|
33
33
|
this.custom_data = '';
|
|
34
34
|
this.user_tags = '';
|
|
35
35
|
this.blob_id = 0;
|
|
@@ -50,7 +50,7 @@ export class DialogRemoteDTOMapper implements IMapper {
|
|
|
50
50
|
|
|
51
51
|
dialog.lastMessageText = dialogEntity.lastMessage.text;
|
|
52
52
|
|
|
53
|
-
dialog.lastMessageUserId = dialogEntity.lastMessage.userId
|
|
53
|
+
dialog.lastMessageUserId = dialogEntity.lastMessage.userId;
|
|
54
54
|
|
|
55
55
|
dialog.lastMessageDateSent = dialogEntity.lastMessage.dateSent;
|
|
56
56
|
|
|
@@ -74,10 +74,16 @@ export class DialogRemoteDTOMapper implements IMapper {
|
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
function formatPhotoUrl() {
|
|
77
|
-
if (
|
|
77
|
+
if (
|
|
78
|
+
!dialog.photo.includes('https') &&
|
|
79
|
+
dialog.photo &&
|
|
80
|
+
dialog.photo !== 'null'
|
|
81
|
+
) {
|
|
78
82
|
return dialog.photo && QB.content.privateUrl(dialog.photo);
|
|
79
83
|
}
|
|
80
84
|
|
|
85
|
+
if (dialog.photo.includes('https')) return dialog.photo;
|
|
86
|
+
|
|
81
87
|
return '';
|
|
82
88
|
}
|
|
83
89
|
switch (dialog.type) {
|
|
@@ -89,7 +95,7 @@ export class DialogRemoteDTOMapper implements IMapper {
|
|
|
89
95
|
{
|
|
90
96
|
dateSent: dialog.lastMessageDateSent,
|
|
91
97
|
text: dialog.lastMessageText ? dialog.lastMessageText : '',
|
|
92
|
-
userId:
|
|
98
|
+
userId: dialog.lastMessageUserId,
|
|
93
99
|
},
|
|
94
100
|
dialog.ownerId,
|
|
95
101
|
dialog.type,
|
|
@@ -105,7 +111,7 @@ export class DialogRemoteDTOMapper implements IMapper {
|
|
|
105
111
|
{
|
|
106
112
|
dateSent: dialog.lastMessageDateSent,
|
|
107
113
|
text: dialog.lastMessageText ? dialog.lastMessageText : '',
|
|
108
|
-
userId:
|
|
114
|
+
userId: dialog.lastMessageUserId,
|
|
109
115
|
},
|
|
110
116
|
dialog.ownerId,
|
|
111
117
|
dialog.type,
|
|
@@ -122,7 +128,7 @@ export class DialogRemoteDTOMapper implements IMapper {
|
|
|
122
128
|
{
|
|
123
129
|
dateSent: dialog.lastMessageDateSent,
|
|
124
130
|
text: dialog.lastMessageText ? dialog.lastMessageText : '',
|
|
125
|
-
userId:
|
|
131
|
+
userId: dialog.lastMessageUserId,
|
|
126
132
|
},
|
|
127
133
|
dialog.ownerId,
|
|
128
134
|
dialog.type,
|
|
@@ -555,16 +561,10 @@ export class DialogRemoteDTOMapper implements IMapper {
|
|
|
555
561
|
|
|
556
562
|
switch (dialogType) {
|
|
557
563
|
case DialogType.private:
|
|
558
|
-
dialogEntity =
|
|
559
|
-
entity instanceof PrivateDialogEntity
|
|
560
|
-
? (entity as unknown as PrivateDialogEntity)
|
|
561
|
-
: null;
|
|
564
|
+
dialogEntity = entity as PrivateDialogEntity;
|
|
562
565
|
break;
|
|
563
566
|
case DialogType.public:
|
|
564
|
-
dialogEntity =
|
|
565
|
-
entity instanceof PublicDialogEntity
|
|
566
|
-
? (entity as unknown as PublicDialogEntity)
|
|
567
|
-
: null;
|
|
567
|
+
dialogEntity = entity as PublicDialogEntity;
|
|
568
568
|
break;
|
|
569
569
|
case DialogType.group:
|
|
570
570
|
dialogEntity = entity as GroupDialogEntity;
|
|
@@ -134,7 +134,7 @@ export class UserLocalDTOMapper implements IMapper {
|
|
|
134
134
|
return (
|
|
135
135
|
last_request_at !== undefined &&
|
|
136
136
|
last_request_at !== null &&
|
|
137
|
-
last_request_at > 0
|
|
137
|
+
last_request_at.length > 0
|
|
138
138
|
);
|
|
139
139
|
},
|
|
140
140
|
login(v: unknown): v is UserEntity['login'] {
|
|
@@ -376,7 +376,7 @@ export class UserLocalDTOMapper implements IMapper {
|
|
|
376
376
|
email: '',
|
|
377
377
|
full_name: '',
|
|
378
378
|
id: 0,
|
|
379
|
-
last_request_at:
|
|
379
|
+
last_request_at: '',
|
|
380
380
|
login: '',
|
|
381
381
|
updated_at: '',
|
|
382
382
|
user_tags: '',
|
|
@@ -146,7 +146,7 @@ export class UserRemoteDTOMapper implements IMapper {
|
|
|
146
146
|
return (
|
|
147
147
|
last_request_at !== undefined &&
|
|
148
148
|
last_request_at !== null &&
|
|
149
|
-
last_request_at > 0
|
|
149
|
+
last_request_at.length > 0
|
|
150
150
|
);
|
|
151
151
|
},
|
|
152
152
|
login(v: unknown): v is UserEntity['login'] {
|
|
@@ -387,7 +387,7 @@ export class UserRemoteDTOMapper implements IMapper {
|
|
|
387
387
|
email: '',
|
|
388
388
|
full_name: '',
|
|
389
389
|
id: 0,
|
|
390
|
-
last_request_at:
|
|
390
|
+
last_request_at: '',
|
|
391
391
|
login: '',
|
|
392
392
|
updated_at: '',
|
|
393
393
|
user_tags: '',
|
|
@@ -38,7 +38,7 @@ export class DialogDTOMapper implements IDTOMapper {
|
|
|
38
38
|
),
|
|
39
39
|
last_message_date_sent: dialogDTO.lastMessageDateSent,
|
|
40
40
|
last_message_id: null,
|
|
41
|
-
last_message_user_id:
|
|
41
|
+
last_message_user_id: dialogDTO.lastMessageUserId,
|
|
42
42
|
name: dialogDTO.name,
|
|
43
43
|
occupants_ids: dialogDTO.participantsIds,
|
|
44
44
|
new_occupants_ids: dialogDTO.newParticipantsIds
|
|
@@ -70,9 +70,9 @@ export class DialogDTOMapper implements IDTOMapper {
|
|
|
70
70
|
dto.lastMessageDateSent = qbDialog.last_message_date_sent || 0;
|
|
71
71
|
dto.lastMessageUserId =
|
|
72
72
|
qbDialog.last_message_user_id === null
|
|
73
|
-
?
|
|
73
|
+
? 0
|
|
74
74
|
: // eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
75
|
-
qbDialog.last_message_user_id
|
|
75
|
+
qbDialog.last_message_user_id;
|
|
76
76
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
77
77
|
dto.ownerId = qbDialog.user_id.toString();
|
|
78
78
|
dto.type = qbDialog.type as number;
|
|
@@ -104,9 +104,9 @@ export class DialogDTOMapper implements IDTOMapper {
|
|
|
104
104
|
dto.lastMessageDateSent = qbDialog.last_message_date_sent || 0;
|
|
105
105
|
dto.lastMessageUserId =
|
|
106
106
|
qbDialog.last_message_user_id === null
|
|
107
|
-
?
|
|
107
|
+
? 0
|
|
108
108
|
: // eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
109
|
-
qbDialog.last_message_user_id
|
|
109
|
+
qbDialog.last_message_user_id;
|
|
110
110
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
111
111
|
dto.ownerId = qbDialog.user_id.toString();
|
|
112
112
|
dto.type = qbDialog.type;
|
|
@@ -122,9 +122,9 @@ export class DialogDTOMapper implements IDTOMapper {
|
|
|
122
122
|
dto.lastMessageDateSent = qbDialog.last_message_date_sent || 0;
|
|
123
123
|
dto.lastMessageUserId =
|
|
124
124
|
qbDialog.last_message_user_id === null
|
|
125
|
-
?
|
|
125
|
+
? 0
|
|
126
126
|
: // eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
127
|
-
qbDialog.last_message_user_id
|
|
127
|
+
qbDialog.last_message_user_id;
|
|
128
128
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
129
129
|
dto.ownerId = qbDialog.user_id.toString();
|
|
130
130
|
dto.type = qbDialog.type;
|
|
@@ -144,9 +144,9 @@ export class DialogDTOMapper implements IDTOMapper {
|
|
|
144
144
|
dto.lastMessageDateSent = qbDialog.last_message_date_sent || 0;
|
|
145
145
|
dto.lastMessageUserId =
|
|
146
146
|
qbDialog.last_message_user_id === null
|
|
147
|
-
?
|
|
147
|
+
? 0
|
|
148
148
|
: // eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
149
|
-
qbDialog.last_message_user_id
|
|
149
|
+
qbDialog.last_message_user_id;
|
|
150
150
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
151
151
|
dto.ownerId = qbDialog.user_id.toString();
|
|
152
152
|
dto.type = qbDialog.type;
|
|
@@ -13,6 +13,7 @@ import QB, {
|
|
|
13
13
|
QBSession,
|
|
14
14
|
QBSystemMessage,
|
|
15
15
|
QBUser,
|
|
16
|
+
QBMessageStatusParams,
|
|
16
17
|
} from 'quickblox/quickblox';
|
|
17
18
|
import { RemoteDialogDTO } from '../../dto/dialog/RemoteDialogDTO';
|
|
18
19
|
import {
|
|
@@ -36,6 +37,7 @@ import {
|
|
|
36
37
|
QBChatConnect,
|
|
37
38
|
QBChatDisconnect,
|
|
38
39
|
qbChatGetMessagesExtended,
|
|
40
|
+
QBChatMarkMessageDelivered,
|
|
39
41
|
QBChatMarkMessageRead,
|
|
40
42
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41
43
|
// QBChatMarkMessageRead,
|
|
@@ -177,8 +179,40 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
177
179
|
new SubscriptionPerformer<RemoteMessageDTO>();
|
|
178
180
|
}
|
|
179
181
|
|
|
180
|
-
updateCurrentDialog(dto: RemoteDialogDTO): void {
|
|
182
|
+
async updateCurrentDialog(dto: RemoteDialogDTO): Promise<void> {
|
|
181
183
|
this.currentDialog = dto;
|
|
184
|
+
//
|
|
185
|
+
//
|
|
186
|
+
const dialogsDTOtoEntityMapper: IMapper = new DialogRemoteDTOMapper();
|
|
187
|
+
|
|
188
|
+
const dialogEntity: DialogEntity = await dialogsDTOtoEntityMapper.toEntity(
|
|
189
|
+
this.currentDialog,
|
|
190
|
+
);
|
|
191
|
+
const userId = this._authInformation?.userId || -1;
|
|
192
|
+
const dialogId = this.currentDialog.id;
|
|
193
|
+
const messageId = this.currentDialog.lastMessageId;
|
|
194
|
+
//
|
|
195
|
+
//
|
|
196
|
+
const resultMessage: DialogEventInfo = {
|
|
197
|
+
eventMessageType: EventMessageType.LocalMessage,
|
|
198
|
+
dialogInfo: dialogEntity,
|
|
199
|
+
messageInfo: undefined,
|
|
200
|
+
messageStatus: {
|
|
201
|
+
isTyping: false,
|
|
202
|
+
userId,
|
|
203
|
+
dialogId,
|
|
204
|
+
messageId,
|
|
205
|
+
deliveryStatus: 'delivered',
|
|
206
|
+
},
|
|
207
|
+
notificationTypes: undefined,
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
this.subscriptionOnMessageStatus.informSubscribers(
|
|
211
|
+
resultMessage,
|
|
212
|
+
EventMessageType.LocalMessage,
|
|
213
|
+
);
|
|
214
|
+
//
|
|
215
|
+
//
|
|
182
216
|
}
|
|
183
217
|
|
|
184
218
|
public async setUpMockStorage(): Promise<void> {
|
|
@@ -468,7 +502,7 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
468
502
|
.then(async (result) => {
|
|
469
503
|
//
|
|
470
504
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
471
|
-
|
|
505
|
+
|
|
472
506
|
const dialogs: QBChatDialog[] | undefined = result?.items.filter(
|
|
473
507
|
(v) => v._id === dialogId,
|
|
474
508
|
);
|
|
@@ -790,6 +824,15 @@ export class RemoteDataSource implements IRemoteDataSource {
|
|
|
790
824
|
}
|
|
791
825
|
|
|
792
826
|
//
|
|
827
|
+
const currentUserId = this._authInformation?.userId || 0;
|
|
828
|
+
const statusMessageParams: QBMessageStatusParams = {
|
|
829
|
+
userId: newDTO.lastMessageUserId || currentUserId,
|
|
830
|
+
dialogId: newDTO.id,
|
|
831
|
+
messageId: newDTO.lastMessageId,
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
835
|
+
QBChatMarkMessageDelivered(statusMessageParams);
|
|
793
836
|
|
|
794
837
|
dialogsDTO.push(newDTO);
|
|
795
838
|
}
|
|
@@ -150,8 +150,8 @@ export default function MessageItem({
|
|
|
150
150
|
<div className="message-item-additional-part__actions">
|
|
151
151
|
<MessageContextMenu
|
|
152
152
|
message={message}
|
|
153
|
-
onReply={onReply}
|
|
154
|
-
onForward={onForward}
|
|
153
|
+
onReply={() => onReply(item)}
|
|
154
|
+
onForward={() => onForward(item)}
|
|
155
155
|
enableReplying={enableReplying}
|
|
156
156
|
enableForwarding={enableForwarding}
|
|
157
157
|
disableActions={disableAction}
|