Files
doneit-web/src/app/services/chat/message.service.ts
T

71 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-01-10 23:52:33 +01:00
import { Injectable } from '@angular/core';
2022-01-13 10:52:03 +01:00
import { Message } from 'src/app/models/chatMethod';
import { chatHistory, ChatMessage, File } from 'src/app/models/chatMethod'
2022-01-28 15:28:21 +01:00
import { Storage } from '@ionic/storage';
2022-01-10 23:52:33 +01:00
@Injectable({
providedIn: 'root'
})
export class MessageService {
2022-01-13 21:24:43 +01:00
customFields
2022-01-11 15:43:09 +01:00
channels = []
mentions = []
msg = ''
rid = ''
2022-01-11 16:07:54 +01:00
ts = {}
u = {}
2022-01-17 11:27:25 +01:00
t = ''
2022-01-11 16:07:54 +01:00
_id =''
2022-02-02 20:16:12 +01:00
_updatedAt = ''
2022-01-13 10:52:03 +01:00
file
attachments
2022-02-02 20:16:12 +01:00
offline = false
2022-01-11 16:07:54 +01:00
2022-01-28 15:28:21 +01:00
constructor(private storage: Storage) {
}
2022-01-11 16:07:54 +01:00
2022-01-17 11:27:25 +01:00
setData({customFields, channels, mentions, msg ,rid ,ts, u, t, _id, _updatedAt, file, attachments}:Message) {
2022-01-13 21:24:43 +01:00
this.customFields = customFields
2022-01-11 16:07:54 +01:00
this.channels = channels
this.mentions = mentions
this.msg = msg
this.rid = rid
this.ts = ts
this.u = u
2022-01-17 11:27:25 +01:00
this.t = t
2022-01-11 16:07:54 +01:00
this._id = _id
this._updatedAt = _updatedAt
2022-01-13 10:52:03 +01:00
this.file = file
this.attachments = attachments
2022-01-28 15:28:21 +01:00
if (this.file) {
if (this.file.guid) {
this.storage.get(this.file.guid).then((image) => {
2022-01-29 19:21:46 +01:00
// console.log('IMAGE FROM STORAGE', image)
2022-01-28 15:28:21 +01:00
this.file.image_url = image
});
}
}
2022-02-02 20:16:12 +01:00
if(this.rid == 'offline') {
this.offline = true
} else {
this.offline = false
}
2022-01-11 16:07:54 +01:00
}
delete() {}
2022-01-11 16:28:59 +01:00
showDateDuration() {}
2022-02-02 20:16:12 +01:00
resend() {
}
2022-01-10 23:52:33 +01:00
}