mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix
This commit is contained in:
@@ -4,7 +4,7 @@ import { Storage } from '@ionic/storage';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { capitalizeTxt } from 'src/plugin/text'
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
|
||||
import { WsChatService } from 'src/app/services/chat/ws-chat.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -29,7 +29,8 @@ export class MessageService {
|
||||
hasSendAttachment = false
|
||||
|
||||
constructor(private storage: Storage,
|
||||
private NfService: NfService) {
|
||||
private NfService: NfService,
|
||||
private WsChatService: WsChatService) {
|
||||
}
|
||||
|
||||
setData({customFields, channels, mentions, msg ,rid ,ts, u, t, _id, _updatedAt, file, attachments, temporaryData}:Message) {
|
||||
@@ -45,7 +46,7 @@ export class MessageService {
|
||||
this._updatedAt = _updatedAt || new Date().getTime()
|
||||
this.file = file
|
||||
this.attachments = attachments
|
||||
this,temporaryData = {}
|
||||
this.temporaryData = temporaryData
|
||||
|
||||
if(!this.ts) {
|
||||
this.offline = true
|
||||
@@ -90,7 +91,33 @@ export class MessageService {
|
||||
}
|
||||
|
||||
sendFile() {
|
||||
|
||||
if(this.file == null && this.attachments == null) {
|
||||
console.log('simple send')
|
||||
this.WsChatService.send({roomId:this.rid, msg:this.msg}).then((data: any) => {
|
||||
let ChatMessage = data.result
|
||||
this.redefinedMessage(this, ChatMessage)
|
||||
})
|
||||
} else {
|
||||
console.log('complex send')
|
||||
|
||||
const result = this.NfService.beforeSendAttachment(this)
|
||||
|
||||
|
||||
if(result) {
|
||||
this.hasSendAttachment = true
|
||||
|
||||
this.WsChatService.send({roomId:this.rid, msg: this.msg, attachments: this.attachments, file: this.file}).then((data: any) => {
|
||||
console.log('send sucees', data.result)
|
||||
let ChatMessage = data.result
|
||||
this.redefinedMessage(this, ChatMessage)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
redefinedMessage(messagem, ChatMessage){
|
||||
this.setData(ChatMessage)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user