mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
improve search loader and chat user flow
This commit is contained in:
@@ -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
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user