Commit 3083860b by Sixong.Zhu

update

parent 088c2b0c
...@@ -58,13 +58,11 @@ export default class ChatList extends Vue { ...@@ -58,13 +58,11 @@ export default class ChatList extends Vue {
@chatStore.Mutation(ChatStore.MUTATION_CLEAR_CURRENT_CHAT_ID) @chatStore.Mutation(ChatStore.MUTATION_CLEAR_CURRENT_CHAT_ID)
protected readonly clearCurrentChatId!: ChatStore.MUTATION_CLEAR_CURRENT_CHAT_ID; protected readonly clearCurrentChatId!: ChatStore.MUTATION_CLEAR_CURRENT_CHAT_ID;
private readonly invoker = Xim.getSdk();
protected parseMesage(data: ChatItem) { protected parseMesage(data: ChatItem) {
if (data.last_msg_sender && data.last_msg_sender !== "0") { if (data.last_msg_sender && data.last_msg_sender !== "0") {
if (this.userNames[data.last_msg_sender] === undefined) { if (this.userNames[data.last_msg_sender] === undefined) {
this.updateUserName({ id: data.last_msg_sender, name: "" }); this.updateUserName({ id: data.last_msg_sender, name: "" });
this.invoker Xim.getSdk()
.model("user") .model("user")
.detail(data.last_msg_sender) .detail(data.last_msg_sender)
.query() .query()
...@@ -74,7 +72,7 @@ export default class ChatList extends Vue { ...@@ -74,7 +72,7 @@ export default class ChatList extends Vue {
name: userInfo.row.first_name.display as string, name: userInfo.row.first_name.display as string,
}); });
}) })
.catch(() => {}); .catch(() => { });
} }
} }
if (data.last_msg_content === "") { if (data.last_msg_content === "") {
......
...@@ -14,6 +14,10 @@ class ChatCacheDatabaseController { ...@@ -14,6 +14,10 @@ class ChatCacheDatabaseController {
private readonly chatMessageKey = "chat-message"; private readonly chatMessageKey = "chat-message";
public setup(uid: string) { public setup(uid: string) {
const qqxb = window.navigator.userAgent.toLowerCase().includes('qqxb');
if (qqxb) {
return Promise.resolve();
}
return new Promise<void>((resolve) => { return new Promise<void>((resolve) => {
if (uid && indexedDB) { if (uid && indexedDB) {
const r = indexedDB.open( const r = indexedDB.open(
...@@ -35,17 +39,17 @@ class ChatCacheDatabaseController { ...@@ -35,17 +39,17 @@ class ChatCacheDatabaseController {
} }
resolve(); resolve();
}; };
r.onsuccess = function (e) { r.onsuccess = function(e) {
that.db = (e.target as any).result; that.db = (e.target as any).result;
console.log(`index database init comepleted, 33%`); console.log(`index database init comepleted, 33%`);
setupDb(); setupDb();
}; };
r.onupgradeneeded = function (e) { r.onupgradeneeded = function(e) {
that.db = (e.target as any).result; that.db = (e.target as any).result;
console.log(`index database init comepleted, 66%`); console.log(`index database init comepleted, 66%`);
setupDb(); setupDb();
}; };
r.onerror = function (e) { r.onerror = function(e) {
console.log(`index database init failed, ${e}`); console.log(`index database init failed, ${e}`);
}; };
} else { } else {
...@@ -72,17 +76,17 @@ class ChatCacheDatabaseController { ...@@ -72,17 +76,17 @@ class ChatCacheDatabaseController {
} }
setTimeout(() => resolve(), 200); setTimeout(() => resolve(), 200);
}; };
r.onsuccess = function (e) { r.onsuccess = function(e) {
const db = (e.target as any).result; const db = (e.target as any).result;
that.messageDatabases.set(k, db); that.messageDatabases.set(k, db);
setupDb(); setupDb();
}; };
r.onupgradeneeded = function (e) { r.onupgradeneeded = function(e) {
const db = (e.target as any).result; const db = (e.target as any).result;
that.messageDatabases.set(k, db); that.messageDatabases.set(k, db);
setupDb(); setupDb();
}; };
r.onerror = function (e) { r.onerror = function(e) {
console.log( console.log(
`chat message index database init failed, ${e}` `chat message index database init failed, ${e}`
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment