mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
chat notification added
This commit is contained in:
@@ -19,6 +19,7 @@ import { AESEncrypt } from '../aesencrypt.service'
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { NetworkServiceService} from 'src/app/services/network-service.service';
|
||||
import { ViewedMessageService } from './viewed-message.service'
|
||||
import { NotificationsService } from '../notifications.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -56,7 +57,8 @@ export class ChatSystemService {
|
||||
private AESEncrypt: AESEncrypt,
|
||||
private AttachmentsService:AttachmentsService,
|
||||
private NetworkServiceService: NetworkServiceService,
|
||||
private ViewedMessageService: ViewedMessageService
|
||||
private ViewedMessageService: ViewedMessageService,
|
||||
private notificationService: NotificationsService
|
||||
) {
|
||||
|
||||
this.RochetChatConnectorService.registerCallback({
|
||||
@@ -417,7 +419,7 @@ export class ChatSystemService {
|
||||
if (setData.name != 'Rocket Cat' && setData.name != 'general' ) {
|
||||
// create room
|
||||
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), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.ViewedMessageService)
|
||||
let room:RoomService = new RoomService(this.RochetChatConnectorService, new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this,this.notificationService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.ViewedMessageService,this.notificationService)
|
||||
room.setData(setData)
|
||||
room.receiveMessage()
|
||||
room.getAllUsers = this.getUsers
|
||||
|
||||
@@ -13,6 +13,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { NetworkServiceService , ConnectionStatus} from 'src/app/services/network-service.service';
|
||||
import { ChatSystemService } from './chat-system.service';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -72,7 +73,8 @@ export class MessageService {
|
||||
private AESEncrypt: AESEncrypt,
|
||||
private AttachmentsService: AttachmentsService,
|
||||
private NetworkServiceService: NetworkServiceService,
|
||||
private ChatSystemService: ChatSystemService,) {
|
||||
private ChatSystemService: ChatSystemService,
|
||||
private notificationService: NotificationsService) {
|
||||
}
|
||||
|
||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference = 'out-'+uuidv4() , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0, origin }:Message) {
|
||||
@@ -289,7 +291,7 @@ export class MessageService {
|
||||
clearTimeout(this.functionTimer);
|
||||
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
console.log()
|
||||
}
|
||||
).catch((error) => {
|
||||
clearTimeout(this.functionTimer);
|
||||
@@ -366,9 +368,17 @@ export class MessageService {
|
||||
this.addReceived(user._id)
|
||||
}
|
||||
|
||||
if(!roomObject.isGroup) {
|
||||
var memeberTosend = this.ChatSystemService.getRoomById(this.rid).membersExcludeMe
|
||||
this.notificationService.ChatSendMessageNotification(memeberTosend[0].username,ChatMessage.u.username,ChatMessage.msg,this.rid)
|
||||
}
|
||||
|
||||
|
||||
await this.saveChanges()
|
||||
}
|
||||
|
||||
sendNotificaton
|
||||
|
||||
downloadFileMsg() {
|
||||
|
||||
this.downloadLoader = true;
|
||||
|
||||
@@ -24,6 +24,7 @@ import { ConnectionStatus, NetworkServiceService} from 'src/app/services/network
|
||||
import { ChatSystemService } from './chat-system.service';
|
||||
import { ViewedMessageService } from './viewed-message.service'
|
||||
import * as FIFOProcessQueue from 'fifo-process-queue';
|
||||
import { NotificationsService } from '../notifications.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -97,7 +98,8 @@ export class RoomService {
|
||||
private AttachmentsService: AttachmentsService,
|
||||
private NetworkServiceService: NetworkServiceService,
|
||||
private ChatSystemService: ChatSystemService,
|
||||
private ViewedMessageService: ViewedMessageService
|
||||
private ViewedMessageService: ViewedMessageService,
|
||||
private notificationService: NotificationsService
|
||||
) {
|
||||
this.NativeNotificationService.askForPermission()
|
||||
|
||||
@@ -158,7 +160,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, this.ChatSystemService), _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,this.notificationService), _updatedAt }) {
|
||||
this.customFields = customFields
|
||||
this.id = id
|
||||
this.name = name
|
||||
@@ -811,7 +813,7 @@ export class RoomService {
|
||||
async prepareCreate({message, save = true}): Promise<MessageService> {
|
||||
message = this.fix_updatedAt(message)
|
||||
|
||||
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService)
|
||||
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService,this.notificationService)
|
||||
wewMessage.setData(message)
|
||||
wewMessage.loadHistory = this.hasLoadHistory
|
||||
|
||||
@@ -823,7 +825,7 @@ export class RoomService {
|
||||
|
||||
simplePrepareMessage(message) {
|
||||
message = this.fix_updatedAt(message)
|
||||
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService)
|
||||
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService,this.notificationService)
|
||||
wewMessage.setData(message)
|
||||
wewMessage.loadHistory = this.hasLoadHistory
|
||||
|
||||
|
||||
Reference in New Issue
Block a user