mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
improve
This commit is contained in:
@@ -174,15 +174,17 @@ export class RoomService {
|
|||||||
|
|
||||||
let index;
|
let index;
|
||||||
const find = messages.find((message, _index)=> {
|
const find = messages.find((message, _index)=> {
|
||||||
|
if(message.localReference) {
|
||||||
if(message.localReference == ChatMessage.localReference) {
|
if(message.localReference == ChatMessage.localReference) {
|
||||||
index = _index
|
index = _index
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
if(!find) {
|
if(find) {
|
||||||
messages[index] = ChatMessage
|
messages[index] = ChatMessage
|
||||||
this.storage.set('chatmsg' + this.id, messages)
|
this.storage.set('chatmsg' + this.id, messages)
|
||||||
}
|
}
|
||||||
@@ -197,6 +199,7 @@ export class RoomService {
|
|||||||
* @param id message ID
|
* @param id message ID
|
||||||
*/
|
*/
|
||||||
private deleteMessageFromDb(id) {
|
private deleteMessageFromDb(id) {
|
||||||
|
if (environment.chatOffline) {
|
||||||
this.storage.get('chatmsg' + this.id).then((messages: any = []) => {
|
this.storage.get('chatmsg' + this.id).then((messages: any = []) => {
|
||||||
if(!Array.isArray(messages)) {
|
if(!Array.isArray(messages)) {
|
||||||
messages = []
|
messages = []
|
||||||
@@ -215,6 +218,7 @@ export class RoomService {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async receiveMessageDelete() {
|
async receiveMessageDelete() {
|
||||||
|
|
||||||
@@ -384,7 +388,10 @@ export class RoomService {
|
|||||||
if(wewMessage.offline == false) {
|
if(wewMessage.offline == false) {
|
||||||
this.prepareMessage(ChatMessage)
|
this.prepareMessage(ChatMessage)
|
||||||
} else {
|
} else {
|
||||||
|
const offlineMessage = this.prepareMessage(ChatMessage)
|
||||||
|
offlineMessage.send().then(()=>{
|
||||||
|
this.updateMessageDB(ChatMessage, ChatMessage.localReference)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -461,11 +468,9 @@ export class RoomService {
|
|||||||
|
|
||||||
private fix_updatedAt(message) {
|
private fix_updatedAt(message) {
|
||||||
if (message.result) {
|
if (message.result) {
|
||||||
//console.log('FIX UPDATE ', message.result)
|
|
||||||
message.result._updatedAt = message.result._updatedAt['$date']
|
message.result._updatedAt = message.result._updatedAt['$date']
|
||||||
} else if(message._updatedAt) {
|
} else if(message._updatedAt) {
|
||||||
if(message._updatedAt.hasOwnProperty('$date')) {
|
if(message._updatedAt.hasOwnProperty('$date')) {
|
||||||
// console.log('FIX UPDATE 11', message)
|
|
||||||
message._updatedAt = message._updatedAt['$date']
|
message._updatedAt = message._updatedAt['$date']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export const environment = {
|
|||||||
domain: 'gabinetedigital.local', //gabinetedigital.local
|
domain: 'gabinetedigital.local', //gabinetedigital.local
|
||||||
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
|
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
|
||||||
defaultuserpwd: 'tabteste@006', //tabteste@006,
|
defaultuserpwd: 'tabteste@006', //tabteste@006,
|
||||||
chatOffline: false
|
chatOffline: true
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user