mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
improve
This commit is contained in:
@@ -5,6 +5,7 @@ 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';
|
||||
import { environment } from 'src/environments/environment';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -30,6 +31,7 @@ export class MessageService {
|
||||
sendAttempt = 0
|
||||
uploadingFile = false
|
||||
errorUploadingAttachment = false
|
||||
loadHistory = false
|
||||
|
||||
constructor(private storage: Storage,
|
||||
private NfService: NfService,
|
||||
@@ -98,14 +100,15 @@ export class MessageService {
|
||||
this.sendAttempt++;
|
||||
|
||||
if(!this.hasFile) {
|
||||
console.log('simple send')
|
||||
this.WsChatService.send({roomId:this.rid, msg:this.msg}).then((data: any) => {
|
||||
let ChatMessage = data.result
|
||||
this.redefinedMessage(this, ChatMessage)
|
||||
this.offline = false
|
||||
if (environment.chatOffline) {
|
||||
let ChatMessage = data.result
|
||||
this.redefinedMessage(this, ChatMessage)
|
||||
this.offline = false
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
console.log('complex send')
|
||||
|
||||
this.uploadingFile = true
|
||||
|
||||
@@ -122,10 +125,12 @@ export class MessageService {
|
||||
this.temporaryData = {}
|
||||
|
||||
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)
|
||||
this.offline = false
|
||||
if (environment.chatOffline) {
|
||||
// console.log('send sucees', data.result)
|
||||
let ChatMessage = data.result
|
||||
this.redefinedMessage(this, ChatMessage)
|
||||
this.offline = false
|
||||
}
|
||||
})
|
||||
} else if(this.WsChatService.isLogin == false) {
|
||||
|
||||
@@ -133,8 +138,7 @@ export class MessageService {
|
||||
this.WsChatService.registerCallback({
|
||||
type: 'reConnect',
|
||||
funx:()=> {
|
||||
alert('reConnect')
|
||||
// this.send()
|
||||
this.send()
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user