mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
notification
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Injectable } from '@angular/core';
|
||||
import { WsChatService } from 'src/app/services/chat/ws-chat.service';
|
||||
import { MessageService } from 'src/app/services/chat/message.service'
|
||||
import { ChatUserService } from 'src/app/services/chat/chat-user.service'
|
||||
import { showDateDuration } from 'src/plugin/showDateDuration'
|
||||
import { MessageService } from 'src/app/services/chat/message.service';
|
||||
import { ChatUserService } from 'src/app/services/chat/chat-user.service';
|
||||
import { showDateDuration } from 'src/plugin/showDateDuration';
|
||||
import { ToastsService } from '../toast.service';
|
||||
import { chatHistory, ChatMessage } from 'src/app/models/chatMethod'
|
||||
import { chatHistory, ChatMessage } from 'src/app/models/chatMethod';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { NativeNotificationService } from 'src/app/services/native-notification.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -37,7 +39,10 @@ export class RoomService {
|
||||
private storage: Storage,
|
||||
private platform: Platform,
|
||||
private sqlservice: SqliteService,
|
||||
) { }
|
||||
private NativeNotificationService: NativeNotificationService
|
||||
) {
|
||||
this.NativeNotificationService.askForPermission()
|
||||
}
|
||||
|
||||
setData({ customFields, id, name, t, lastMessage, _updatedAt }) {
|
||||
this.customFields = customFields
|
||||
@@ -72,6 +77,13 @@ export class RoomService {
|
||||
}, 100)
|
||||
|
||||
|
||||
if(SessionStore.user.RochetChatUser != ChatMessage.u.username) {
|
||||
this.NativeNotificationService.sendNotificationChat({
|
||||
message: message.msg,
|
||||
title: this.name
|
||||
});
|
||||
}
|
||||
|
||||
// save to ionic storage
|
||||
this.storage.get('chatmsg' + this.id).then((messages: any) => {
|
||||
const newListMessages = messages.push(ChatMessage)
|
||||
|
||||
Reference in New Issue
Block a user