This commit is contained in:
Peter Maquiran
2022-02-07 17:55:00 +01:00
parent 2caaad7f2b
commit e03fb2b413
14 changed files with 333 additions and 379 deletions
+16 -10
View File
@@ -3,6 +3,7 @@ import { Message } from 'src/app/models/chatMethod';
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'
@Injectable({
providedIn: 'root'
@@ -23,9 +24,12 @@ export class MessageService {
attachments
offline = true
displayType = ''
temporaryData = {}
temporaryData: any = {}
hasFile = false
hasSendAttachment = false
constructor(private storage: Storage) {
constructor(private storage: Storage,
private NfService: NfService) {
}
setData({customFields, channels, mentions, msg ,rid ,ts, u, t, _id, _updatedAt, file, attachments, temporaryData}:Message) {
@@ -49,18 +53,20 @@ export class MessageService {
this.offline = false
}
if (this.file) {
this.getFileFromDb()
if(this.file.type) {
if(this.file.type != 'application/webtrix' && typeof(this.file.type) == 'string') {
this.displayType = this.file.type.replace('application/','').toUpperCase()
if(typeof(this.file.type) == 'string') {
this.hasFile = true
}
}
}
if(this.hasFile) {
this.getFileFromDb()
if(this.file.type != 'application/webtrix') {
this.displayType = this.file.type.replace('application/','').toUpperCase()
}
}
}
private usernameToDisplayName(username) {
@@ -71,13 +77,13 @@ export class MessageService {
}
getFileFromDb() {
if (this.file) {
if(this.hasFile) {
if (this.file.guid) {
this.storage.get(this.file.guid).then((image) => {
if(image != null) {
this.file.image_url = image
}
});
}
}