performace

This commit is contained in:
Peter Maquiran
2023-09-29 16:40:50 +01:00
parent 7f1dbf13aa
commit 93ad41eab9
12 changed files with 175 additions and 106 deletions
+28 -13
View File
@@ -220,6 +220,7 @@ export class MessageService {
this.RochetChatConnectorService.registerCallback({
type: 'reConnect',
funx: async () => {
console.log('send now have login')
this.send().catch((error) =>{
console.error(error)
})
@@ -227,7 +228,16 @@ export class MessageService {
}
})
console.log('no login')
} else if (this.UploadAttachmentsTemp <= 3) {
console.log('temp'+ this.UploadAttachmentsTemp)
setTimeout(async () => {
return await this.send()
}, 4000)
} else if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Offline) {
console.log('recooonect')
this.RochetChatConnectorService.registerCallback({
type: 'reConnect',
funx: async ()=> {
@@ -238,11 +248,8 @@ export class MessageService {
return true
}
})
} else if (this.UploadAttachmentsTemp <= 3) {
setTimeout(async () => {
return await this.send()
}, 3000)
} else if (this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) {
console.log('manual')
this.manualRetry = true
}
@@ -256,6 +263,7 @@ export class MessageService {
async sendRequestAttachment() {
console.log('sendRequestAttachment')
this.uploadingFile = true
let uploadSuccessfully = false
@@ -270,23 +278,30 @@ export class MessageService {
await this.generateTemporaryData()
}
console.log('send temp')
if(this.hasSendAttachment == false) {
try {
uploadSuccessfully = await this.NfService.beforeSendAttachment(this)
this.UploadAttachmentsTemp++
this.uploadingFile = false
this.manualRetry = false
this.errorUploadingAttachment = false
this.hasSendAttachment = true
this.UploadAttachmentsTemp++
uploadSuccessfully = await this.NfService.beforeSendAttachment(this)
this.uploadingFile = false
this.hasSendAttachment = uploadSuccessfully
if(this.hasSendAttachment) {
console.log('send uploadSuccessfully')
} else {
console.log('not send uploadSuccessfully')
}
this.saveChanges()
} catch (error) {
this.uploadingFile = false
console.log('send not uploadSuccessfully')
this.errorUploadingAttachment = true
this.UploadAttachmentsTemp++
this.saveChanges()
}
@@ -409,14 +424,14 @@ export class MessageService {
if(!roomObject.isGroup) {
var memeberTosend = this.ChatSystemService.getRoomById(this.rid).membersExcludeMe
this.notificationService.ChatSendMessageNotification(memeberTosend[0].username,ChatMessage.u.name,ChatMessage.msg,this.rid)
this.notificationService.ChatSendMessageNotification(memeberTosend[0].username,ChatMessage.u.name,ChatMessage.msg || "Anexo",this.rid)
} else {
var memeberTosend = this.ChatSystemService.getRoomById(this.rid).membersExcludeMe
var usersNames = [];
for(let i = 0; i < memeberTosend.length; i++) {
usersNames.push(memeberTosend[i].username)
}
this.notificationService.ChatSendMessageNotificationGrup(usersNames,ChatMessage.u.name,ChatMessage.msg,this.rid)
this.notificationService.ChatSendMessageNotificationGrup(usersNames,ChatMessage.u.name,ChatMessage.msg || "Anexo",this.rid)
}