mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Notificaion from chat added
This commit is contained in:
@@ -186,6 +186,8 @@ export class ProfilePage implements OnInit {
|
||||
}
|
||||
else if (Service === "gabinete-digital" && Object === "expedientes-pr") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
|
||||
} else if (Service === "chat") {
|
||||
this.zone.run(() => this.router.navigate(['/home/chat', IdObject, 'chat']));
|
||||
}
|
||||
|
||||
// this.notificationservice.tempClearArray();
|
||||
|
||||
@@ -258,7 +258,7 @@
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send"
|
||||
src="assets/icon/theme/gov/icons-chat-record-audio.svg"></ion-icon>
|
||||
</button>
|
||||
<button *ngIf="ChatSystemService.getDmRoom(roomId).message" class="btn-no-color" (click)="sendMessage()"
|
||||
<button *ngIf="ChatSystemService.getDmRoom(roomId).message" class="btn-no-color" (click)="sendMessage(ChatSystemService.getDmRoom(roomId).messages)"
|
||||
class="btn-no-color">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send"
|
||||
src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router'
|
||||
import { ActivatedRoute, Route, Router } from '@angular/router'
|
||||
import { GestureController, ModalController, NavParams, PopoverController, Platform, AlertController } from '@ionic/angular';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
@@ -41,6 +41,7 @@ import { File } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||
import { NewEventPage } from '../../agenda/new-event/new-event.page';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@@ -126,6 +127,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
// private document: DocumentViewer
|
||||
private file: File,
|
||||
private fileOpener: FileOpener,
|
||||
private notificationService: NotificationsService,
|
||||
private router: Router
|
||||
) {
|
||||
this.loggedUser = SessionStore.user.ChatData['data'];
|
||||
this.roomId = this.navParams.get('roomId');
|
||||
@@ -150,6 +153,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.router.url);
|
||||
this.createDirectoryImage()
|
||||
// this.chatService.refreshtoken();
|
||||
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||
@@ -379,8 +383,14 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
window.removeEventListener('scroll', this.scrollChangeCallback, true);
|
||||
}
|
||||
|
||||
sendMessage() {
|
||||
this.ChatSystemService.getDmRoom(this.roomId).send({})
|
||||
sendMessage(msg) {
|
||||
let lastMsg = msg.pop();
|
||||
console.log(this.attendees)
|
||||
console.log(lastMsg._id,lastMsg.msg,lastMsg.msg)
|
||||
this.ChatSystemService.getDmRoom(this.roomId).send({}).then(() => {
|
||||
console.log(this.members)
|
||||
this.notificationService.ChatSendMessageNotification(this.members[1].username,this.members[1].name,lastMsg.msg,this.roomId)
|
||||
})
|
||||
}
|
||||
|
||||
base64toBlob(base64Data, contentType) {
|
||||
|
||||
@@ -72,7 +72,7 @@ export class MessageService {
|
||||
private AESEncrypt: AESEncrypt,
|
||||
private AttachmentsService: AttachmentsService,
|
||||
private NetworkServiceService: NetworkServiceService,
|
||||
private ChatSystemService: ChatSystemService) {
|
||||
private ChatSystemService: ChatSystemService,) {
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -180,8 +180,9 @@ export class MessageService {
|
||||
|
||||
async send(): Promise<any> {
|
||||
if(this.messageSend) {
|
||||
console.log('sended')
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve('solve')
|
||||
resolve('solve')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
import { Injectable, NgZone } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { AuthConnstants } from 'src/app/config/auth-constants';
|
||||
@@ -171,6 +171,28 @@ export class NotificationsService {
|
||||
);
|
||||
}
|
||||
|
||||
ChatSendMessageNotification(userID,title,bodymsg,roomId) {
|
||||
const geturl = environment.apiURL + `notifications/send`;
|
||||
|
||||
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
|
||||
const body = {
|
||||
UserId: 437,
|
||||
title: "Teste",
|
||||
body: "Test",
|
||||
data: {
|
||||
Service: "chat",
|
||||
IdObject: roomId
|
||||
}
|
||||
};
|
||||
let id = 437
|
||||
this.http.post<Tokenn>(geturl+`?userId=${id}&title=${title}&body=${bodymsg}`, body, { headers }).subscribe(data => {
|
||||
this.active = true
|
||||
console.log(data)
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
tempClearArray(data) {
|
||||
this.DataArray = new Array;
|
||||
}
|
||||
@@ -222,7 +244,9 @@ export class NotificationsService {
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
} else if (notification.notification.data.Service === "chat") {
|
||||
this.zone.run(() => this.router.navigate(['/home/chat', notification.notification.data.IdObject, 'chat']));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user