mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
71 lines
1.3 KiB
TypeScript
71 lines
1.3 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Message } from 'src/app/models/chatMethod';
|
|
import { chatHistory, ChatMessage, File } from 'src/app/models/chatMethod'
|
|
import { Storage } from '@ionic/storage';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class MessageService {
|
|
|
|
customFields
|
|
channels = []
|
|
mentions = []
|
|
msg = ''
|
|
rid = ''
|
|
ts = {}
|
|
u = {}
|
|
t = ''
|
|
_id =''
|
|
_updatedAt = ''
|
|
file
|
|
attachments
|
|
offline = false
|
|
|
|
constructor(private storage: Storage) {
|
|
}
|
|
|
|
setData({customFields, channels, mentions, msg ,rid ,ts, u, t, _id, _updatedAt, file, attachments}:Message) {
|
|
this.customFields = customFields
|
|
this.channels = channels
|
|
this.mentions = mentions
|
|
this.msg = msg
|
|
this.rid = rid
|
|
this.ts = ts
|
|
this.u = u
|
|
this.t = t
|
|
this._id = _id
|
|
this._updatedAt = _updatedAt
|
|
this.file = file
|
|
this.attachments = attachments
|
|
|
|
|
|
if (this.file) {
|
|
if (this.file.guid) {
|
|
this.storage.get(this.file.guid).then((image) => {
|
|
// console.log('IMAGE FROM STORAGE', image)
|
|
this.file.image_url = image
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
if(this.rid == 'offline') {
|
|
this.offline = true
|
|
} else {
|
|
this.offline = false
|
|
}
|
|
|
|
}
|
|
|
|
delete() {}
|
|
|
|
showDateDuration() {}
|
|
|
|
|
|
resend() {
|
|
|
|
}
|
|
|
|
}
|