mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
fix chat eror
This commit is contained in:
@@ -95,10 +95,12 @@ export class ChatSystemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadChat() {
|
loadChat() {
|
||||||
this.ReLoadChat()
|
if(SessionStore.user.ChatData) {
|
||||||
|
this.ReLoadChat()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async ReLoadChat() {
|
private async ReLoadChat() {
|
||||||
|
|
||||||
await this.chatService.refreshtoken();
|
await this.chatService.refreshtoken();
|
||||||
await this.restoreUsers();
|
await this.restoreUsers();
|
||||||
@@ -400,7 +402,7 @@ export class ChatSystemService {
|
|||||||
if (setData.name != 'Rocket Cat') {
|
if (setData.name != 'Rocket Cat') {
|
||||||
// create room
|
// create room
|
||||||
if(!this.roomExist(roomId)) {
|
if(!this.roomExist(roomId)) {
|
||||||
let room:RoomService = new RoomService(this.RochetChatConnectorService, new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this)
|
let room:RoomService = new RoomService(this.RochetChatConnectorService, new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this)
|
||||||
room.setData(setData)
|
room.setData(setData)
|
||||||
room.receiveMessage()
|
room.receiveMessage()
|
||||||
room.getAllUsers = this.getUsers
|
room.getAllUsers = this.getUsers
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { AESEncrypt } from '../aesencrypt.service'
|
|||||||
import { HttpEventType } from '@angular/common/http';
|
import { HttpEventType } from '@angular/common/http';
|
||||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||||
import { NetworkServiceService , ConnectionStatus} from 'src/app/services/network-service.service';
|
import { NetworkServiceService , ConnectionStatus} from 'src/app/services/network-service.service';
|
||||||
|
import { ChatSystemService } from './chat-system.service';
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
@@ -67,7 +67,8 @@ export class MessageService {
|
|||||||
private ChatMethodsService: ChatMethodsService,
|
private ChatMethodsService: ChatMethodsService,
|
||||||
private AESEncrypt: AESEncrypt,
|
private AESEncrypt: AESEncrypt,
|
||||||
private AttachmentsService: AttachmentsService,
|
private AttachmentsService: AttachmentsService,
|
||||||
private NetworkServiceService: NetworkServiceService) {
|
private NetworkServiceService: NetworkServiceService,
|
||||||
|
private ChatSystemService: ChatSystemService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = [], delate = false, delateRequest =false, from }:Message) {
|
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = [], delate = false, delateRequest =false, from }:Message) {
|
||||||
@@ -119,6 +120,17 @@ export class MessageService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.u.name && this.u.username) {
|
||||||
|
const user = this.ChatSystemService.users.find((u)=> u.username == this.u.username)
|
||||||
|
if(user) {
|
||||||
|
this.u.name = user.name
|
||||||
|
} else if( this.u.username == SessionStore.user.UserName) {
|
||||||
|
this.u.name = SessionStore.user.FullName
|
||||||
|
} else {
|
||||||
|
// console.log(user.username, SessionStore.user.UserName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.calDateDuration()
|
this.calDateDuration()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +215,6 @@ export class MessageService {
|
|||||||
// console.log('online send')
|
// console.log('online send')
|
||||||
this.RochetChatConnectorService.send(params).then(
|
this.RochetChatConnectorService.send(params).then(
|
||||||
(ChatMessage: any) => {
|
(ChatMessage: any) => {
|
||||||
console.log('response')
|
|
||||||
ChatMessage = ChatMessage.message.result
|
ChatMessage = ChatMessage.message.result
|
||||||
|
|
||||||
this.messageSend = true
|
this.messageSend = true
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ export class RoomService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setData({membersExcludeMe, members, u, customFields = {}, id, name, t, lastMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService), _updatedAt }) {
|
setData({membersExcludeMe, members, u, customFields = {}, id, name, t, lastMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService), _updatedAt }) {
|
||||||
this.customFields = customFields
|
this.customFields = customFields
|
||||||
this.id = id
|
this.id = id
|
||||||
this.name = name
|
this.name = name
|
||||||
@@ -710,10 +710,11 @@ export class RoomService {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
const offlineMessage = await this.prepareMessageCreateIfNotExist({message:ChatMessage})
|
const offlineMessage = await this.prepareMessageCreateIfNotExist({message:ChatMessage})
|
||||||
offlineMessage.from = 'Offline'
|
|
||||||
offlineMessage.loadHistory = this.hasLoadHistory
|
|
||||||
|
|
||||||
if(offlineMessage) {
|
if(offlineMessage) {
|
||||||
|
offlineMessage.from = 'Offline'
|
||||||
|
offlineMessage.loadHistory = this.hasLoadHistory
|
||||||
|
|
||||||
this.messagesLocalReference.push(offlineMessage.localReference)
|
this.messagesLocalReference.push(offlineMessage.localReference)
|
||||||
|
|
||||||
offlineMessage?.decryptMessage()
|
offlineMessage?.decryptMessage()
|
||||||
@@ -827,7 +828,7 @@ export class RoomService {
|
|||||||
message = this.fix_updatedAt(message)
|
message = this.fix_updatedAt(message)
|
||||||
|
|
||||||
|
|
||||||
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService)
|
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService)
|
||||||
wewMessage.setData(message)
|
wewMessage.setData(message)
|
||||||
wewMessage.loadHistory = this.hasLoadHistory
|
wewMessage.loadHistory = this.hasLoadHistory
|
||||||
|
|
||||||
@@ -884,7 +885,7 @@ export class RoomService {
|
|||||||
async prepareCreate({message, save = true}): Promise<MessageService> {
|
async prepareCreate({message, save = true}): Promise<MessageService> {
|
||||||
message = this.fix_updatedAt(message)
|
message = this.fix_updatedAt(message)
|
||||||
|
|
||||||
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService)
|
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService)
|
||||||
wewMessage.setData(message)
|
wewMessage.setData(message)
|
||||||
wewMessage.loadHistory = this.hasLoadHistory
|
wewMessage.loadHistory = this.hasLoadHistory
|
||||||
|
|
||||||
@@ -922,7 +923,7 @@ export class RoomService {
|
|||||||
|
|
||||||
simplePrepareMessage(message) {
|
simplePrepareMessage(message) {
|
||||||
message = this.fix_updatedAt(message)
|
message = this.fix_updatedAt(message)
|
||||||
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService)
|
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService)
|
||||||
wewMessage.setData(message)
|
wewMessage.setData(message)
|
||||||
wewMessage.loadHistory = this.hasLoadHistory
|
wewMessage.loadHistory = this.hasLoadHistory
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user