improve search loader and chat user flow

This commit is contained in:
Peter Maquiran
2022-10-13 14:37:03 +01:00
parent a2782e0cbe
commit 0bbf046010
8 changed files with 77 additions and 28 deletions
+13 -4
View File
@@ -101,6 +101,7 @@ export class ChatSystemService {
async ReLoadChat() {
await this.chatService.refreshtoken();
await this.restoreUsers();
await this.getUser();
await this.restoreRooms();
await this.getAllRooms();
@@ -123,6 +124,7 @@ export class ChatSystemService {
this.currentRoom = null
this.users = []
this.storage.remove('Users');
}
openRoom(roomId) {
@@ -152,16 +154,13 @@ export class ChatSystemService {
async restoreRooms() {
try {
const rooms = await this.storage.get('Rooms');
const rooms = await this.storage.remove('Rooms');
if(rooms) {
for (let roomData of rooms.result.update) {
await this.prepareRoom(roomData);
}
}
} catch(e){}
setTimeout(() => {
@@ -170,6 +169,15 @@ export class ChatSystemService {
}
async restoreUsers () {
const users = await this.storage.get('Users');
if(users) {
this.users = users
}
}
async getAllRooms () {
this.loadingWholeList = true
const rooms = await this.RochetChatConnectorService.getRooms();
@@ -632,6 +640,7 @@ export class ChatSystemService {
return 0;
});
await this.storage.set('Users',this.users);
this.loadingUsers = false
}