This commit is contained in:
Peter Maquiran
2022-05-27 13:36:37 +01:00
parent 304975d823
commit ce7cee0876
25 changed files with 131 additions and 234 deletions
+4 -7
View File
@@ -218,12 +218,6 @@ export class AuthService {
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
message.file.guid = guid.path
// await this.storage.set(guid.path, message.file.image_url).then(() => {
//
// // message.getFileFromDb()
// });
message.downloadFileMsg()
return true
@@ -235,14 +229,17 @@ export class AuthService {
} else {
try {
const res = message.temporaryData
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
message.attachments[0].title_link = url_no_options
message.attachments[0].message_link = url_no_options
return true
} catch(e) {
return false
}
}
+8 -17
View File
@@ -8,9 +8,9 @@ import { WsChatService } from 'src/app/services/chat/ws-chat.service';
import { showDateDuration } from 'src/plugin/showDateDuration';
import { ChatStorageService } from './chat-storage.service'
import { ChatMethodsService } from './chat-methods.service'
import { MessageModel, DeleteMessageModel } from '../../models/beast-orm'
import { MessageModel } from '../../models/beast-orm'
import { AESEncrypt } from '../aesencrypt.service'
import { HttpClient, HttpEventType } from '@angular/common/http';
import { HttpEventType } from '@angular/common/http';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { NetworkServiceService , ConnectionStatus} from 'src/app/services/network-service.service';
@@ -133,7 +133,11 @@ export class MessageService {
if(!this.hasFile) {
const params = {roomId:this.rid, msg:this.msg, localReference: this.localReference}
const params = {
roomId:this.rid,
msg:this.msg,
localReference: this.localReference
}
await this.sendRequest(params)
@@ -153,13 +157,10 @@ export class MessageService {
this.errorUploadingAttachment = false
this.temporaryData = {}
const params = {roomId:this.rid, msg: this.msg, attachments: this.attachments, file: this.file, localReference: this.localReference}
await this.sendRequest(params)
} else if(this.WsChatService.isLogin == false) {
this.WsChatService.registerCallback({
type: 'reConnect',
funx: async ()=> {
@@ -189,10 +190,6 @@ export class MessageService {
}
}
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) {
this.WsChatService.send(params).then(
@@ -243,13 +240,7 @@ export class MessageService {
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
} /* else if (this.file.type == 'application/audio') {
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
} else if (this.file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
} */
}
this.attachments[0] = {
image_url: downloadFile,
@@ -362,6 +362,15 @@ export class WsChatMethodsService {
}
}
deleteRoom(roomId) {
delete this.group[roomId];
const index = this._group.findIndex((e)=> e.id == roomId);
this._group = this._group.splice(index, 1);
}
roomExist(roomId) {
return this.dm[roomId]?.id || this.group[roomId]?.id
}