From 97d86455cf7eb83f4261ffbb0743dc8d38ac3f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Wed, 25 Oct 2023 09:08:49 +0100 Subject: [PATCH] remove reject of the headets --- src/app/home/home.page.ts | 87 ++++++++++--------- src/app/pages/chat/chat.page.ts | 2 +- .../new-publication/new-publication.page.ts | 6 ++ .../pages/publications/publications.page.ts | 23 +++++ src/app/services/attachments.service.ts | 2 +- src/app/services/auth.service.ts | 3 +- src/app/services/chat.service.ts | 4 +- src/app/services/contacts.service.ts | 2 +- src/app/services/events.service.ts | 28 +++--- src/app/services/http.service.ts | 2 +- src/app/services/organic-entity.service.ts | 2 +- src/app/services/processes.service.ts | 4 +- src/app/services/publications.service.ts | 2 +- src/app/services/search.service.ts | 2 +- .../Gabinete Digital_files/vendor.js.download | 6 +- src/environments/environment.prod.ts | 2 +- src/environments/environment.ts | 2 +- 17 files changed, 108 insertions(+), 71 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 438291582..a70a24fd4 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, NgZone, OnInit } from '@angular/core'; import { Event } from '../models/event.model'; import { NotificationsService } from '../services/notifications.service'; import { AlertController, ModalController, NavParams, Platform } from '@ionic/angular'; @@ -20,7 +20,7 @@ import { RouteService } from 'src/app/services/route.service'; import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service'; import { UserSession } from '../models/user.model'; import { PermissionList } from '../models/permission/permissionList'; -import {SendIntent} from "send-intent"; +import { SendIntent } from "send-intent"; import { Plugins } from '@capacitor/core'; import { Filesystem } from '@capacitor/filesystem'; @@ -99,13 +99,14 @@ export class HomePage implements OnInit { public ActiveTabService: ActiveTabService, private RoleIdService: RoleIdService, private modalController: ModalController, - + private zone: NgZone + ) { if (SessionStore.exist) { this.user = SessionStore.user; } - + this.router.events.subscribe((val) => { document.querySelectorAll('ion-modal').forEach((e: any) => e.remove()) @@ -152,39 +153,45 @@ export class HomePage implements OnInit { refreshing() { } - checkSendIntentReceived() { - SendIntent.checkSendIntentReceived().then(async (result: any) => { + async checkSendIntentReceived() { + + try { + const result: any = await SendIntent.checkSendIntentReceived(); if (result) { console.log('SendIntent received'); - console.log(JSON.stringify(result)); - const modal = await this.modalController.create({ - component: PublicationsPage, - componentProps: { - item: "item", - intent: JSON.stringify(result) - }, - cssClass: 'new-action modal modal-desktop', - backdropDismiss: false - }); - - /* modal.onDidDismiss().then(() => { - this.getActions(); - }); */ - await modal.present(); + console.log('JSON RESULT', JSON.stringify(result)); + const modal = await this.modalController.create({ + component: PublicationsPage, + componentProps: { + item: "item", + intent: JSON.stringify(result) + }, + cssClass: 'new-action modal modal-desktop', + backdropDismiss: false + }); + + /* modal.onDidDismiss().then(() => { + this.getActions(); + }); */ + await modal.present(); } if (result.url) { - let resultUrl = decodeURIComponent(result.url); - Filesystem.readFile({path: resultUrl}) + console.log('SendIntent received URL'); + let resultUrl = decodeURIComponent(result.url); + Filesystem.readFile({ path: resultUrl }) .then((content) => { - console.log(content.data); + console.log('CONtent data', content.data); }) - .catch((err) => console.log(err)); + .catch((err) => console.log('Erro filesystem', err)); } - }).catch(err => console.log(err)); + } catch (error) { + console.error('error check intent', error); + } + } ngOnInit() { - this.checkSendIntentReceived() + /* this.checkSendIntentReceived() */ if ("serviceWorker" in navigator) { navigator.serviceWorker.onmessage = (event) => { @@ -277,19 +284,19 @@ export class HomePage implements OnInit { }, 1000) - if (!this.platform.is('desktop')) { - App.addListener('appStateChange', ({ isActive }) => { - if (isActive) { - // The app is in the foreground. - console.log('App is in the foreground'); - this.checkSendIntentReceived() - } else { - // The app is in the background. - console.log('App is in the background'); - // You can perform actions specific to the background state here. - } - }); - } + if (!this.platform.is('desktop')) { + App.addListener('appStateChange', ({ isActive }) => { + if (isActive) { + // The app is in the foreground. + console.log('App is in the foreground'); + /* this.checkSendIntentReceived() */ + } else { + // The app is in the background. + console.log('App is in the background'); + // You can perform actions specific to the background state here. + } + }); + } } diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index 2586e8519..4fe27b30a 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -130,7 +130,7 @@ export class ChatPage implements OnInit { public RouteService: RouteService, ) { - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; window.onresize = (event) => { if (window.innerWidth > 701) { this.modalController.dismiss(); diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 7546d8e00..93aab26bf 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -86,6 +86,7 @@ export class NewPublicationPage implements OnInit { imgResultBeforeCompress: string; imgResultAfterCompress: string; convertBlobToBase64Worker; + intent: any; constructor( private modalController: ModalController, @@ -107,12 +108,17 @@ export class NewPublicationPage implements OnInit { this.folderId = this.navParams.get('folderId'); this.publication = this.navParams.get('publication'); this.publicationTitle = 'Nova Publicação'; + this.intent = this.navParams.get('intent'); this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url)); } ngOnInit() { + if(this.intent) { + this.capturedImage = 'data:image/jpeg;base64,'+this.intent; + } + this.setTitle(); Filesystem.mkdir({ path: IMAGE_DIR, diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index 3ddbf68fb..b526cbc9a 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -14,6 +14,7 @@ import { ToastService } from 'src/app/services/toast.service'; import { ThemeService } from 'src/app/services/theme.service' import { PermissionService } from 'src/app/services/permission.service'; import { Storage } from '@ionic/storage'; +import { NewPublicationPage } from './new-publication/new-publication.page'; // import { ActionModel } from 'src/app/models/beast-orm'; @@ -285,7 +286,29 @@ export class PublicationsPage implements OnInit { } + async AddPublication(publicationType: any, folderId: any,intent: any) { + const modal = await this.modalController.create({ + component: NewPublicationPage, + componentProps: { + publicationType: publicationType, + folderId: folderId, + intent: intent + }, + cssClass: 'new-publication modal modal-desktop', + backdropDismiss: false + }); + + modal.onDidDismiss().then(() => { + this.doRefresh(event); + }); + await modal.present(); + } + goToPublicationsList(folderId: string) { + if(this.intent){ + this.AddPublication('2',folderId,this.intent) + return + } if (window.innerWidth < 701) { this.router.navigate(['/home/publications', folderId]); this.idSelected = ""; diff --git a/src/app/services/attachments.service.ts b/src/app/services/attachments.service.ts index 94fc3316f..f44e1390e 100644 --- a/src/app/services/attachments.service.ts +++ b/src/app/services/attachments.service.ts @@ -32,7 +32,7 @@ export class AttachmentsService { setHeader() { this.loggeduser = SessionStore.user - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey); } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 77342fa55..7c10fa3d6 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -27,7 +27,7 @@ import { CPSession } from '../store/documentManagement'; export class AuthService { userData$ = new BehaviorSubject(''); userId$ = new BehaviorSubject(''); - headers: HttpHeaders = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized }); + headers: HttpHeaders = new HttpHeaders(); public wsValidatedUserChat: any; public isWsAuthenticated: boolean = false; opts: any; @@ -169,6 +169,7 @@ export class AuthService { if (SessionStore.user.ChatData?.data) { this.RochetChatConnectorService.connect(); this.RochetChatConnectorService.login().then((message: any) => { + console.log('Chat login',message ) SessionStore.user.RochetChatUserId = message.result.id SessionStore.save() diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index a409bb498..974278731 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -40,7 +40,7 @@ export class ChatService { } getDocumentDetails(url: string) { - let headersc = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + let headersc = new HttpHeaders(); headersc = headersc.set('X-User-Id', SessionStore.user.ChatData.data.userId); headersc = headersc.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken); headersc = headersc.set('Sec-Fetch-Dest', 'attachment'); @@ -350,7 +350,7 @@ export class ChatService { try { if (this.p.userPermission(this.p.permissionList.Chat.access) && SessionStore.user.ChatData) { - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; if (this.p.userPermission(this.p.permissionList.Chat.access)) { // diff --git a/src/app/services/contacts.service.ts b/src/app/services/contacts.service.ts index d8ac76fb7..41bb3674b 100644 --- a/src/app/services/contacts.service.ts +++ b/src/app/services/contacts.service.ts @@ -36,7 +36,7 @@ export class ContactsService { setHeader() { this.loggeduser = SessionStore.user; - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); } diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index ebbf480f7..c5417b975 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -82,22 +82,22 @@ export class EventsService { async setHeader () { - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; - this.headersMdOficial = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; - this.headersMdPessoal = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; + this.headersMdOficial = new HttpHeaders();; + this.headersMdPessoal = new HttpHeaders();; - this.headersPrOficial = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; - this.headersPrPessoal = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headersPrOficial = new HttpHeaders();; + this.headersPrPessoal = new HttpHeaders();; - this.headersSharedOficial = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; - this.headersSharedPessoal = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headersSharedOficial = new HttpHeaders();; + this.headersSharedPessoal = new HttpHeaders();; - this.headerOwnOficial= new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; - this.headerOwnPessoal= new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headerOwnOficial= new HttpHeaders();; + this.headerOwnPessoal= new HttpHeaders();; - this.headerSharedOficial= new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; - this.headerSharedPessoal= new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headerSharedOficial= new HttpHeaders();; + this.headerSharedPessoal= new HttpHeaders();; this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey); @@ -377,7 +377,7 @@ export class EventsService { } makeHeader(calendar: calendarInterface) { - let header = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + let header = new HttpHeaders();; header = header.set('Authorization', SessionStore.user.BasicAuthKey); header = header.set('CalendarId', calendar.CalendarId); header = header.set('CalendarRoleId', calendar.CalendarRoleId); @@ -615,7 +615,7 @@ export class EventsService { let result = [] for(let agendasCalendar of agendasCalendars) { - var header = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + var header = new HttpHeaders();; header = header.set('Authorization', SessionStore.user.BasicAuthKey); header = header.set('CalendarId', agendasCalendar.CalendarId); header = header.set('CalendarRoleId', agendasCalendar.CalendarRoleId); @@ -648,7 +648,7 @@ export class EventsService { for (let sharedCalendar of SessionStore.user.SharedCalendars) { - var header = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + var header = new HttpHeaders();; header = header.set('Authorization', SessionStore.user.BasicAuthKey); header = header.set('CalendarId', sharedCalendar.CalendarId); header = header.set('CalendarRoleId', sharedCalendar.CalendarRoleId); diff --git a/src/app/services/http.service.ts b/src/app/services/http.service.ts index 6b5859a4c..70da0d27c 100644 --- a/src/app/services/http.service.ts +++ b/src/app/services/http.service.ts @@ -10,7 +10,7 @@ export class HttpService { constructor(private http:HttpClient) { } post(serviceName:string, data:any){ - const headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + const headers = new HttpHeaders();; const options = {header: headers, withCredentials: false}; const url = environment.apiChatUrl+serviceName; const body = {"user": "admin","password": "tabteste@006"}; diff --git a/src/app/services/organic-entity.service.ts b/src/app/services/organic-entity.service.ts index 6a8e8e791..aa51be383 100644 --- a/src/app/services/organic-entity.service.ts +++ b/src/app/services/organic-entity.service.ts @@ -31,7 +31,7 @@ export class OrganicEntityService { setHeader() { this.loggeduser = SessionStore.user; - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); } diff --git a/src/app/services/processes.service.ts b/src/app/services/processes.service.ts index c812ec70d..d653e51ab 100644 --- a/src/app/services/processes.service.ts +++ b/src/app/services/processes.service.ts @@ -44,11 +44,11 @@ export class ProcessesService { setHeader() { - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); - this.headers2 = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers2 = new HttpHeaders();; this.headers2 = this.headers2.set('Authorization', "Bearer " + CPSession.AuthorizationJwt); diff --git a/src/app/services/publications.service.ts b/src/app/services/publications.service.ts index 02ac38228..0299dba24 100644 --- a/src/app/services/publications.service.ts +++ b/src/app/services/publications.service.ts @@ -36,7 +36,7 @@ export class PublicationsService { setHeader () { this.loggeduser = SessionStore.user; - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); } diff --git a/src/app/services/search.service.ts b/src/app/services/search.service.ts index 184aded5d..76ce90440 100644 --- a/src/app/services/search.service.ts +++ b/src/app/services/search.service.ts @@ -37,7 +37,7 @@ export class SearchService { setHeader() { this.loggeduser = SessionStore.user; - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); } diff --git a/src/assets/images/Gabinete Digital_files/vendor.js.download b/src/assets/images/Gabinete Digital_files/vendor.js.download index 852dcb9df..df46b429e 100644 --- a/src/assets/images/Gabinete Digital_files/vendor.js.download +++ b/src/assets/images/Gabinete Digital_files/vendor.js.download @@ -7137,7 +7137,7 @@ class HttpHeaders { */ clone(update) { /** @type {?} */ - const clone = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + const clone = new HttpHeaders();; clone.lazyInit = (!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this; clone.lazyUpdate = (this.lazyUpdate || []).concat([update]); @@ -7688,7 +7688,7 @@ class HttpRequest { } // If no headers have been passed in, construct a new HttpHeaders instance. if (!this.headers) { - this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = new HttpHeaders();; } // If no parameters have been passed in, construct a new HttpUrlEncodedParams instance. if (!this.params) { @@ -7970,7 +7970,7 @@ class HttpResponseBase { constructor(init, defaultStatus = 200, defaultStatusText = 'OK') { // If the hash has values passed, use them to initialize the response. // Otherwise use the default values. - this.headers = init.headers || new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; + this.headers = init.headers || new HttpHeaders();; this.status = init.status !== undefined ? init.status : defaultStatus; this.statusText = init.statusText || defaultStatusText; this.url = init.url || null; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index a9256d5a8..726ebb13e 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -4,4 +4,4 @@ import { doneITProd } from './suport/doneIt' import { DevDev } from './suport/dev' -export const environment: Environment = DevDev; +export const environment: Environment = oaprProd; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 16a865ce9..e2d79dff9 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,4 +4,4 @@ import { doneITDev } from './suport/doneIt' import { DevDev } from './suport/dev' -export const environment: Environment = DevDev \ No newline at end of file +export const environment: Environment = oaprDev \ No newline at end of file