mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Git pull made
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Message } from 'src/app/models/chatMethod';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { capitalizeTxt } from 'src/plugin/text'
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
import { capitalizeTxt } from 'src/plugin/text';
|
||||
import { NfService } from 'src/app/services/chat/nf.service';
|
||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
||||
import { showDateDuration } from 'src/plugin/showDateDuration';
|
||||
import { ChatMethodsService } from './chat-methods.service'
|
||||
import { MessageModel } from '../../models/beast-orm'
|
||||
import { AESEncrypt } from '../aesencrypt.service'
|
||||
import { ChatMethodsService } from './chat-methods.service';
|
||||
import { MessageModel } from '../../models/beast-orm';
|
||||
import { AESEncrypt } from '../aesencrypt.service';
|
||||
import { HttpEventType } from '@angular/common/http';
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { NetworkServiceService , ConnectionStatus} from 'src/app/services/network-service.service';
|
||||
@@ -182,7 +182,6 @@ export class MessageService {
|
||||
|
||||
async send(): Promise<any> {
|
||||
if(this.messageSend) {
|
||||
console.log('sended')
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve('solve')
|
||||
})
|
||||
|
||||
@@ -110,7 +110,7 @@ export class EventsService {
|
||||
if (SessionStore.user.Profile == 'MDGPR') {
|
||||
|
||||
for (let calendar of SessionStore.user.OwnerCalendars) {
|
||||
this.hasAnyCalendar = false
|
||||
this.hasAnyCalendar = true
|
||||
|
||||
if (calendar.CalendarName == 'Oficial') {
|
||||
|
||||
@@ -133,7 +133,7 @@ export class EventsService {
|
||||
}
|
||||
|
||||
for (let sharedCalendar of SessionStore.user.SharedCalendars) {
|
||||
this.hasAnyCalendar = false
|
||||
this.hasAnyCalendar = true
|
||||
|
||||
if (sharedCalendar.CalendarName == 'Oficial') {
|
||||
|
||||
@@ -158,7 +158,7 @@ export class EventsService {
|
||||
else if (SessionStore.user.Profile == 'PR') {
|
||||
|
||||
for (let calendar of SessionStore.user.OwnerCalendars) {
|
||||
this.hasAnyCalendar = false
|
||||
this.hasAnyCalendar = true
|
||||
if (calendar.CalendarName == 'Oficial') {
|
||||
|
||||
this.hasOwnOficial = true
|
||||
@@ -181,7 +181,7 @@ export class EventsService {
|
||||
}
|
||||
|
||||
for (let calendar of SessionStore.user.OwnerCalendars) {
|
||||
this.hasAnyCalendar = false
|
||||
this.hasAnyCalendar = true
|
||||
if(!this.usersCalendarIds.includes(calendar.OwnerUserId)) {
|
||||
this.usersCalendarIds.push(calendar.OwnerUserId)
|
||||
}
|
||||
@@ -213,7 +213,7 @@ export class EventsService {
|
||||
}
|
||||
|
||||
for (let sharedCalendar of SessionStore.user.SharedCalendars) {
|
||||
this.hasAnyCalendar = false
|
||||
this.hasAnyCalendar = true
|
||||
|
||||
if(!this.usersCalendarIds.includes(sharedCalendar.OwnerUserId)) {
|
||||
this.usersCalendarIds.push(sharedCalendar.OwnerUserId)
|
||||
@@ -246,7 +246,7 @@ export class EventsService {
|
||||
|
||||
|
||||
for (let sharedCalendar of SessionStore.user.SharedCalendars) {
|
||||
this.hasAnyCalendar = false
|
||||
this.hasAnyCalendar = true
|
||||
if(sharedCalendar?.OwnerUserId) {
|
||||
this.GetCalendarName(sharedCalendar.OwnerUserId).subscribe((e)=> {
|
||||
this.calendarNames[sharedCalendar.CalendarId] = e.FullName
|
||||
@@ -266,7 +266,7 @@ export class EventsService {
|
||||
}
|
||||
|
||||
for (let sharedCalendar of SessionStore.user.OwnerCalendars) {
|
||||
this.hasAnyCalendar = false
|
||||
this.hasAnyCalendar = true
|
||||
|
||||
this.calendarNames[sharedCalendar.CalendarId] = 'Meu calendario'
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { EventTrigger } from '../services/eventTrigger.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { ActionPerformed, PushNotificationSchema, PushNotifications, Token, } from '@capacitor/push-notifications';
|
||||
import { notificationObject } from '../models/notifications';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -38,43 +39,44 @@ export class NotificationsService {
|
||||
private platform: Platform,
|
||||
private router: Router,
|
||||
private zone: NgZone,
|
||||
private eventtrigger: EventTrigger,) {
|
||||
private eventtrigger: EventTrigger,) {}
|
||||
|
||||
|
||||
registerCallback({type, funx, id = uuidv4()} : {
|
||||
type: notificationObject,
|
||||
funx: Function
|
||||
id?: string
|
||||
}) {
|
||||
this.callbacks[id] = { funx, id, type}
|
||||
return id;
|
||||
}
|
||||
|
||||
deleteCallback(id) {
|
||||
delete this.callbacks[id]
|
||||
}
|
||||
|
||||
// registerCallback({type, funx, id = uuidv4()} : {
|
||||
// type: notificationObject,
|
||||
// funx: Function
|
||||
// id?: string
|
||||
// }) {
|
||||
// this.callbacks[id] = { funx, id, type}
|
||||
// return id;
|
||||
// }
|
||||
private async runNotificationCallback(notification) {
|
||||
|
||||
for (const [key, value] of Object.entries(this.callbacks)) {
|
||||
if(value.type == notification.data.Object) {
|
||||
|
||||
// private async runNotificationCallback(notification) {
|
||||
const dontRepeat = await value.funx(notification)
|
||||
|
||||
// for (const [key, value] of Object.entries(this.callbacks)) {
|
||||
// if(value.type == notification.data.Object) {
|
||||
if(dontRepeat) {
|
||||
delete this.callbacks[key]
|
||||
}
|
||||
|
||||
// const dontRepeat = await value.funx(notification)
|
||||
} else if (value.type == '*') {
|
||||
const dontRepeat = await value.funx(notification)
|
||||
|
||||
// if(dontRepeat) {
|
||||
// delete this.callbacks[key]
|
||||
// }
|
||||
if(dontRepeat) {
|
||||
delete this.callbacks[key]
|
||||
}
|
||||
}
|
||||
|
||||
// } else if (value.type == '*') {
|
||||
// const dontRepeat = await value.funx(notification)
|
||||
}
|
||||
|
||||
// if(dontRepeat) {
|
||||
// delete this.callbacks[key]
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
getTokenByUserIdAndId(user, userID) {
|
||||
// const geturl = environment.apiURL + 'notifications/user/' + userID;
|
||||
|
||||
@@ -21,9 +21,14 @@ export class EventService {
|
||||
|
||||
|
||||
if(this.p.userRole(['PR'])) {
|
||||
alert('pr')
|
||||
return this.eventService.postEventPr(body, calendar)
|
||||
} else {
|
||||
} else if(this.p.userRole(['MDGPR'])) {
|
||||
alert('md')
|
||||
return this.eventService.postEventMd(body, calendar)
|
||||
} else {
|
||||
alert('other')
|
||||
return this.eventService.postEventGeneric(body, calendar, body.CalendarId)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ServerConnectionService } from './server-connection.service';
|
||||
|
||||
describe('ServerConnectionService', () => {
|
||||
let service: ServerConnectionService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ServerConnectionService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ServerConnectionService {
|
||||
|
||||
constructor(private http: HttpClient,) { }
|
||||
|
||||
async BaseAPI(): Promise<boolean> {
|
||||
try {
|
||||
await this.http.get(environment.apiURL)
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user