mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
fix message
This commit is contained in:
@@ -44,6 +44,29 @@ export class AppComponent {
|
||||
this.initializeApp();
|
||||
this.storage.set('version', environment.version).then(() => {})
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/firebase-messaging-sw.js')
|
||||
.then(registration => {
|
||||
console.log('Service Worker registrado com sucesso:', registration);
|
||||
|
||||
|
||||
// Send data to the service worker
|
||||
if (registration.active) {
|
||||
registration.active.postMessage({ type: 'INIT_WEBSOCKET', url: 'wss://example.com/socket' });
|
||||
} else {
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.active.postMessage({ type: 'INIT_WEBSOCKET', url: 'wss://example.com/socket' });
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Erro ao registrar o Service Worker:', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* requestPermission() {
|
||||
|
||||
@@ -6,12 +6,9 @@ import { IBoldLocalRepository } from 'src/app/core/chat/repository/bold/bold-loc
|
||||
import { IMessageLocalRepository } from 'src/app/core/chat/repository/message/message-local-repository';
|
||||
import { InstanceId } from '../../../../module/chat/domain/chat-service.service';
|
||||
import { HttpAdapter } from 'src/app/infra/http/adapter';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { IRoomLocalRepository } from 'src/app/core/chat/repository/room/room-local-repository';
|
||||
import { IMessageGetAllByRoomIdOutPut } from 'src/app/core/chat/usecase/message/message-get-all-by-room-Id';
|
||||
import { RoomEntity } from 'src/app/core/chat/entity/group';
|
||||
import { messageListDetermineChanges } from '../../../../module/chat/data/async/list/rooms/messageListChangedetector';
|
||||
|
||||
|
||||
@Injectable({
|
||||
@@ -75,7 +72,7 @@ export class RoomBoldSyncUseCaseService {
|
||||
if(result.isOk() && result.value?.bold == 1) {
|
||||
const lastMessage = await this.roomLocalDataSourceService.findOne({id: message.roomId})
|
||||
if(lastMessage.isOk()) {
|
||||
if(lastMessage.value.messages[0].id == message.id) {
|
||||
if(lastMessage.value?.messages[0]?.id == message.id) {
|
||||
const result = await this.boldLocalRepository.update(message.roomId, {bold: 0})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,16 +14,16 @@ export class WebNotificationPopupService {
|
||||
|
||||
|
||||
askNotificationPermission() {
|
||||
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {}
|
||||
else {return false}
|
||||
else {return false}
|
||||
|
||||
// function to actually ask the permissions
|
||||
function handlePermission(permission) {}
|
||||
|
||||
|
||||
// Let's check if the browser supports notifications
|
||||
if (!('Notification' in window)) {
|
||||
|
||||
|
||||
} else {
|
||||
if(this.checkNotificationPromise()) {
|
||||
Notification.requestPermission()
|
||||
@@ -51,7 +51,7 @@ export class WebNotificationPopupService {
|
||||
|
||||
sendNotification(e) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {}
|
||||
else {return false}
|
||||
else {return false}
|
||||
|
||||
Notification.requestPermission((result) => {
|
||||
if (result === 'granted') {
|
||||
@@ -67,15 +67,15 @@ export class WebNotificationPopupService {
|
||||
// {action: 'reply', title: 'Reply', icon: 'https://example/reply.png'}
|
||||
// ]
|
||||
}).then(e =>{
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +234,8 @@ export class ChatPage implements OnInit {
|
||||
this.openChat(roomExist.$id)
|
||||
}
|
||||
|
||||
} else if(!roomExist) {
|
||||
console.log('routeCheck, conversa não existe', roomId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
const me = message.haveSeen(message.info)
|
||||
|
||||
if(!me) {
|
||||
Logger.info('send read at, sender '+ message.sender.wxFullName+ ' '+ message.message +'message id'+ message.id)
|
||||
// Logger.info('send read at, sender '+ message.sender.wxFullName+ ' '+ message.message +'message id'+ message.id)
|
||||
|
||||
this.chatServiceService.sendReadAt({
|
||||
memberId: SessionStore.user.UserId,
|
||||
|
||||
@@ -162,6 +162,7 @@ export class GroupContactsPage implements OnInit {
|
||||
} else {
|
||||
// this.openGroupMessage.emit(this.roomId);
|
||||
console.log('nothoing to add')
|
||||
this.modalController.dismiss({roomId: this.roomId})
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
@@ -344,7 +344,7 @@ export class RoomStore {
|
||||
const me = message.haveSeen(message.info)
|
||||
|
||||
if(!me) {
|
||||
Logger.info('send read at, sender '+ message.sender.wxFullName+ ' '+ message.message +'message id'+ message.id)
|
||||
// Logger.info('send read at, sender '+ message.sender.wxFullName+ ' '+ message.message +'message id'+ message.id)
|
||||
|
||||
this.chatServiceService.sendReadAt({
|
||||
memberId: SessionStore.user.UserId,
|
||||
|
||||
Reference in New Issue
Block a user