mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
improve
This commit is contained in:
@@ -67,6 +67,15 @@ export class RoomService {
|
||||
private NfService: NfService
|
||||
) {
|
||||
this.NativeNotificationService.askForPermission()
|
||||
|
||||
|
||||
this.WsChatService.registerCallback({
|
||||
type: 'reConnect',
|
||||
funx: ()=>{
|
||||
this.hasLoadHistory = false
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
setData({ customFields, id, name, t, lastMessage = new MessageService(this.storage, this.NfService, this.WsChatService), _updatedAt }) {
|
||||
@@ -181,6 +190,7 @@ export class RoomService {
|
||||
deleteMessage(id) {
|
||||
this.messages.forEach((message, index) => {
|
||||
if(message._id == id) {
|
||||
alert('found and delete')
|
||||
this.messages.splice(index, 1)
|
||||
|
||||
this.deleteMessageFromDb(id)
|
||||
@@ -232,8 +242,6 @@ export class RoomService {
|
||||
file,
|
||||
temporaryData
|
||||
}
|
||||
|
||||
console.log('offlineChatMessage', offlineChatMessage)
|
||||
|
||||
this.addMessageDB(offlineChatMessage)
|
||||
const message: MessageService = this.prepareMessage(offlineChatMessage)
|
||||
@@ -355,9 +363,9 @@ export class RoomService {
|
||||
}
|
||||
|
||||
// runs onces only
|
||||
async loadHistory(limit = 100) {
|
||||
async loadHistory({limit = 100, forceUpdate = false }) {
|
||||
|
||||
if (this.hasLoadHistory) { return false }
|
||||
if (this.hasLoadHistory || forceUpdate) { return false }
|
||||
|
||||
this.restoreMessageFromDB()
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ export class WsChatMethodsService {
|
||||
|
||||
this.prepareRoom(roomData);
|
||||
|
||||
this.getGroupRoom(id).loadHistory();
|
||||
this.getGroupRoom(id).loadHistory({});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ export class WsChatService {
|
||||
|
||||
return new Promise ((resolve, reject) => {
|
||||
this.ws.registerCallback({type:'Onmessage', funx:(message) =>{
|
||||
if(message.id == requestId || deepFind(message, 'result') == requestId){
|
||||
if(message.id == requestId ){
|
||||
resolve(message)
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user