mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve
This commit is contained in:
@@ -13,7 +13,7 @@ import { NativeNotificationService } from 'src/app/services/native-notification.
|
||||
import { SortService } from '../functions/sort.service';
|
||||
import { chatUser } from 'src/app/models/chatMethod';
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
|
||||
import { ChangeProfileService } from '../change-profile.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -42,18 +42,10 @@ export class WsChatMethodsService {
|
||||
private sortService: SortService,
|
||||
private ChatService: ChatService,
|
||||
private NfService: NfService,
|
||||
private changeProfileService: ChangeProfileService,
|
||||
) {
|
||||
(async()=>{
|
||||
await this.restoreRooms()
|
||||
await this.getAllRooms();
|
||||
this.subscribeToRoom()
|
||||
|
||||
|
||||
//
|
||||
await this.getUser()
|
||||
this.getUserStatus()
|
||||
|
||||
})()
|
||||
|
||||
this.loadChat()
|
||||
|
||||
this.WsChatService.registerCallback({
|
||||
type: 'reConnect',
|
||||
@@ -64,7 +56,9 @@ export class WsChatMethodsService {
|
||||
*/
|
||||
this.subscribeToRoom()
|
||||
|
||||
this.currentRoom.loadHistory({forceUpdate: true})
|
||||
if(this.currentRoom) {
|
||||
this.currentRoom.loadHistory({forceUpdate: true})
|
||||
}
|
||||
|
||||
for (const id in this.dm) {
|
||||
this.dm[id].hasLoadHistory = false
|
||||
@@ -77,6 +71,11 @@ export class WsChatMethodsService {
|
||||
}
|
||||
})
|
||||
|
||||
this.changeProfileService.registerCallback(()=>{
|
||||
this.clearChat()
|
||||
this.ReLoadChat()
|
||||
})
|
||||
|
||||
|
||||
// this.WsChatService.registerCallback({
|
||||
// type:'Onmessage',
|
||||
@@ -112,6 +111,36 @@ export class WsChatMethodsService {
|
||||
|
||||
}
|
||||
|
||||
private loadChat() {
|
||||
this.ReLoadChat()
|
||||
}
|
||||
|
||||
async ReLoadChat() {
|
||||
await this.restoreRooms()
|
||||
await this.getAllRooms();
|
||||
this.subscribeToRoom()
|
||||
|
||||
|
||||
//
|
||||
await this.getUser()
|
||||
this.getUserStatus()
|
||||
}
|
||||
|
||||
clearChat() {
|
||||
this.dm = {}
|
||||
this.group = {}
|
||||
this._dm = []
|
||||
this._group = []
|
||||
|
||||
this.loadingWholeList = false
|
||||
|
||||
this.dmCount = 0;
|
||||
this.groupCount = 0;
|
||||
|
||||
this.currentRoom = null
|
||||
this.users = []
|
||||
}
|
||||
|
||||
getRoomFromDb() {
|
||||
this.storage.get('Rooms').then((rooms) => {
|
||||
rooms.result.update.forEach((roomData: room) => {
|
||||
|
||||
Reference in New Issue
Block a user