mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user