mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve chat
This commit is contained in:
@@ -2,6 +2,8 @@ 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';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { capitalizeTxt } from 'src/plugin/text'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -17,28 +19,34 @@ export class MessageService {
|
||||
u = {}
|
||||
t = ''
|
||||
_id =''
|
||||
_updatedAt = ''
|
||||
_updatedAt
|
||||
file
|
||||
attachments
|
||||
offline = false
|
||||
offline = true
|
||||
|
||||
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.customFields = customFields
|
||||
this.channels = channels || []
|
||||
this.mentions = mentions || []
|
||||
this.msg = msg || ""
|
||||
this.rid = rid
|
||||
this.ts = ts
|
||||
this.u = u
|
||||
this.u = u || { name: this.usernameToDisplayName(SessionStore.user.RochetChatUser), username: SessionStore.user.RochetChatUser, _id: ""}
|
||||
this.t = t
|
||||
this._id = _id
|
||||
this._updatedAt = _updatedAt
|
||||
this._updatedAt = _updatedAt || new Date().getTime()
|
||||
this.file = file
|
||||
this.attachments = attachments
|
||||
|
||||
if(!this.ts) {
|
||||
this.offline = true
|
||||
} else {
|
||||
this.offline = false
|
||||
}
|
||||
|
||||
|
||||
if (this.file) {
|
||||
if (this.file.guid) {
|
||||
@@ -49,22 +57,22 @@ export class MessageService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this.rid == 'offline') {
|
||||
this.offline = true
|
||||
} else {
|
||||
this.offline = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
delete() {}
|
||||
|
||||
showDateDuration() {}
|
||||
|
||||
|
||||
|
||||
resend() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private usernameToDisplayName(username) {
|
||||
|
||||
const firstName = capitalizeTxt(username.split('.')[0])
|
||||
const lastName = capitalizeTxt(username.split('.')[1])
|
||||
return firstName + ' ' + lastName
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user