mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Profile picture, notifications, chat romms
This commit is contained in:
@@ -190,11 +190,15 @@ export class AttachmentsService {
|
||||
return this.http.post(`${geturl}`, formData, options);
|
||||
}
|
||||
|
||||
getUserProfilePhoto() {
|
||||
getUserProfilePhoto(guid) {
|
||||
const geturl = environment.apiURL + 'UserAuthentication/GetPhoto';
|
||||
|
||||
let params = new HttpParams();
|
||||
params = params.set("UserPhoto", guid);
|
||||
|
||||
let options = {
|
||||
headers: this.headers
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
|
||||
return this.http.get(`${geturl}`, options);
|
||||
|
||||
@@ -19,15 +19,12 @@ export class RochetChatConnectorService {
|
||||
}
|
||||
|
||||
reConnect() {
|
||||
console.log('Connect1 ',this.ws.connected)
|
||||
if(!this.ws.connected) {
|
||||
this.ws.connect()
|
||||
console.log('Connect2 ',this.ws.connected)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
connect() {
|
||||
console.log('Check conetion 11')
|
||||
console.log(this.ws.connected)
|
||||
// dont connect if is already connected
|
||||
if(this.ws.connected == true) {
|
||||
console.log('Check conetion 22')
|
||||
@@ -744,7 +741,7 @@ export class RochetChatConnectorService {
|
||||
|
||||
private n = 0
|
||||
|
||||
private ws = {
|
||||
ws = {
|
||||
connected: false,
|
||||
registerCallback:(params: wsCallbacksParams) => {
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Injectable } from '@angular/core';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class DataService {
|
||||
public task: any;
|
||||
|
||||
|
||||
data = {}
|
||||
|
||||
@@ -137,9 +137,7 @@ export class NotificationsService {
|
||||
this.active = true
|
||||
console.log('NOtification Listener', notification)
|
||||
this.storenotification(notification)
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
@@ -156,6 +154,7 @@ export class NotificationsService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
storenotification(notification) {
|
||||
console.log('Store Notification ',notification)
|
||||
this.storageService.get("Notifications").then((store) => {
|
||||
@@ -163,22 +162,39 @@ export class NotificationsService {
|
||||
store.push(notification)
|
||||
console.log('Store Notification ',store)
|
||||
|
||||
const result = store.reduce((accumulator, current) => {
|
||||
let exists = accumulator.find(item => {
|
||||
return item.id === current.id;
|
||||
});
|
||||
if(!exists) {
|
||||
accumulator = accumulator.concat(current);
|
||||
}
|
||||
return accumulator;
|
||||
}, []);
|
||||
|
||||
console.log(result);
|
||||
if(this.platform.is('mobile')) {
|
||||
|
||||
const result = store.reduce((accumulator, current) => {
|
||||
let exists = accumulator.find(item => {
|
||||
return item.id === current.id;
|
||||
});
|
||||
|
||||
if(!exists) {
|
||||
accumulator = accumulator.concat(current);
|
||||
}
|
||||
return accumulator;
|
||||
}, []);
|
||||
|
||||
console.log('Notification Result',result);
|
||||
this.storageService.store("Notifications", result).then(() => {
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
this.storageService.store("Notifications", store).then(() => {
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.storageService.store("Notifications", result)
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
if (!error) {
|
||||
this.storageService.store("Notifications", [notification])
|
||||
@@ -214,11 +230,9 @@ export class NotificationsService {
|
||||
notification: event.data
|
||||
}
|
||||
|
||||
this.notificatinsRoutes(object)
|
||||
// Implemente a lógica para lidar com a mensagem recebida do Service Worker
|
||||
if (event.data.notificationClicked) {
|
||||
console.log('Notificação push do Firebase clicada em segundo plano!');
|
||||
// Implemente ações adicionais conforme necessário
|
||||
this.notificatinsRoutes(object)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user