@bcc-code/vue-bcc-chat-ui 3.0.0-alpha.9 → 3.1.0
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/vue-bcc-chat-ui.js +3791 -3810
- package/package.json +1 -1
- package/src/components/BccChatMessageList.vue +23 -12
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ import { loggedIn } from "../chat/login";
|
|
|
13
13
|
import { CometChatMessages } from "@cometchat/chat-uikit-vue";
|
|
14
14
|
import { Group } from "@cometchat/chat-sdk-javascript";
|
|
15
15
|
import { watchAndApplyStyle } from "../chat/styleFix";
|
|
16
|
-
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
16
|
+
//import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
17
17
|
import {
|
|
18
18
|
messageComposerConfiguration,
|
|
19
19
|
messageListConfiguration,
|
|
@@ -38,8 +38,14 @@ watch([loggedIn, ()=>props.chatUid, chat.initialized], async ([_loggedIn, _chatU
|
|
|
38
38
|
}
|
|
39
39
|
}, { immediate: true });
|
|
40
40
|
|
|
41
|
-
watch(chat.onlineStatus,
|
|
42
|
-
|
|
41
|
+
watch(chat.onlineStatus, () => {
|
|
42
|
+
tryConnect(false);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
watch(chat.onlineMode, () => {
|
|
46
|
+
if (chat.onlineMode.value == 'online'){
|
|
47
|
+
tryConnect(true);
|
|
48
|
+
}
|
|
43
49
|
});
|
|
44
50
|
|
|
45
51
|
const showChat = ref(false);
|
|
@@ -57,10 +63,15 @@ watchEffect(() => {
|
|
|
57
63
|
}
|
|
58
64
|
})
|
|
59
65
|
|
|
66
|
+
let _connecting = false;
|
|
60
67
|
async function tryConnect(force: boolean) {
|
|
61
|
-
console.log('CONNECTING::::');
|
|
62
68
|
if (chat.onlineStatus.value === "online" || force) {
|
|
63
|
-
|
|
69
|
+
if (!_connecting){
|
|
70
|
+
try {
|
|
71
|
+
await connect(componentId.value);
|
|
72
|
+
} catch { }
|
|
73
|
+
_connecting = false;
|
|
74
|
+
}
|
|
64
75
|
}
|
|
65
76
|
}
|
|
66
77
|
|
|
@@ -119,23 +130,23 @@ onUnmounted(async () => {
|
|
|
119
130
|
await disconnect(componentId.value);
|
|
120
131
|
});
|
|
121
132
|
|
|
122
|
-
const cometChatStatus = ref('');
|
|
123
|
-
function getCometChatStatus(){
|
|
124
|
-
|
|
125
|
-
}
|
|
133
|
+
// const cometChatStatus = ref('');
|
|
134
|
+
// function getCometChatStatus(){
|
|
135
|
+
// cometChatStatus.value = new Date().getTime() + CometChat.getConnectionStatus();
|
|
136
|
+
// }
|
|
126
137
|
|
|
127
138
|
</script>
|
|
128
139
|
|
|
129
140
|
<template>
|
|
130
141
|
<div class="bcc-chat-message-list-wrapper">
|
|
131
|
-
<div>
|
|
142
|
+
<!-- <div>
|
|
132
143
|
<div>Connecting... <button @click="tryConnect(true)">[retry]</button></div>
|
|
133
144
|
<div>Online status: {{chat.onlineStatus}}</div>
|
|
134
145
|
<div>Online mode: {{chat.onlineMode}}</div>
|
|
135
146
|
<div>Connected: {{chat.connected.value}}</div>
|
|
136
147
|
<div>Connecting: {{chat.connecting.value}}</div>
|
|
137
148
|
<div>CometChat: {{cometChatStatus}} <button @click="getCometChatStatus()">[refresh]</button></div>
|
|
138
|
-
</div>
|
|
149
|
+
</div> -->
|
|
139
150
|
<div v-if="showChat" class="bcc-chat-message-list">
|
|
140
151
|
|
|
141
152
|
<CometChatMessages
|
|
@@ -155,7 +166,7 @@ function getCometChatStatus(){
|
|
|
155
166
|
</div>
|
|
156
167
|
</div>
|
|
157
168
|
<div v-else-if="!chat.connected.value" class="bcc-chat-message-list-offline">
|
|
158
|
-
<span>Connecting
|
|
169
|
+
<span>Connecting...</span>
|
|
159
170
|
</div>
|
|
160
171
|
<div v-else-if="!chatGroup" class="bcc-chat-message-list-offline">
|
|
161
172
|
<span>Loading chat...</span>
|