Files
doneit-web/src/app/services/chat/message.service.ts
T
Peter Maquiran 33cce0fd44 add chat offline
2022-02-02 20:16:12 +01:00

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() {
}
}