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:
@@ -14,6 +14,7 @@ import { SortService } from '../functions/sort.service';
|
||||
import { chatUser } from 'src/app/models/chatMethod';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -63,11 +64,12 @@ export class RoomService {
|
||||
private NativeNotificationService: NativeNotificationService,
|
||||
private sortService: SortService,
|
||||
private chatService: ChatService,
|
||||
private NfService: NfService
|
||||
) {
|
||||
this.NativeNotificationService.askForPermission()
|
||||
}
|
||||
|
||||
setData({ customFields, id, name, t, lastMessage = new MessageService(this.storage), _updatedAt }) {
|
||||
setData({ customFields, id, name, t, lastMessage = new MessageService(this.storage, this.NfService), _updatedAt }) {
|
||||
this.customFields = customFields
|
||||
this.id = id
|
||||
this.name = name
|
||||
@@ -232,19 +234,21 @@ export class RoomService {
|
||||
})
|
||||
} else {
|
||||
console.log('complex send')
|
||||
return {
|
||||
message: message,
|
||||
updateMessage: (update)=> {
|
||||
offlineChatMessage = Object.assign(offlineChatMessage, update)
|
||||
|
||||
const result = this.NfService.beforeSendAttachment(message, this)
|
||||
|
||||
delete message.temporaryData;
|
||||
|
||||
if(result) {
|
||||
message.hasSendAttachment = true
|
||||
|
||||
this.WsChatService.send({roomId:this.id, msg:message.msg,attachments:offlineChatMessage.attachments, file:offlineChatMessage.file}).then((data: any) => {
|
||||
console.log('send sucees', data.result)
|
||||
let ChatMessage = data.result
|
||||
this.redefinedMessage(message, ChatMessage)
|
||||
})
|
||||
|
||||
}
|
||||
this.WsChatService.send({roomId:this.id, msg:message.msg, attachments:offlineChatMessage.attachments, file:offlineChatMessage.file}).then((data: any) => {
|
||||
console.log('send sucees', data.result)
|
||||
let ChatMessage = data.result
|
||||
this.redefinedMessage(message, ChatMessage)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -398,7 +402,7 @@ export class RoomService {
|
||||
|
||||
prepareMessage(message): MessageService {
|
||||
message = this.fix_updatedAt(message)
|
||||
const wewMessage = new MessageService(this.storage)
|
||||
const wewMessage = new MessageService(this.storage, this.NfService)
|
||||
wewMessage.setData(message)
|
||||
this.messages.push(wewMessage)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user