remove reject of the headets

This commit is contained in:
Eudes Inácio
2023-10-25 09:08:49 +01:00
parent f92cdc5816
commit 97d86455cf
17 changed files with 108 additions and 71 deletions
+44 -37
View File
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core'; import { Component, NgZone, OnInit } from '@angular/core';
import { Event } from '../models/event.model'; import { Event } from '../models/event.model';
import { NotificationsService } from '../services/notifications.service'; import { NotificationsService } from '../services/notifications.service';
import { AlertController, ModalController, NavParams, Platform } from '@ionic/angular'; 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 { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service';
import { UserSession } from '../models/user.model'; import { UserSession } from '../models/user.model';
import { PermissionList } from '../models/permission/permissionList'; import { PermissionList } from '../models/permission/permissionList';
import {SendIntent} from "send-intent"; import { SendIntent } from "send-intent";
import { Plugins } from '@capacitor/core'; import { Plugins } from '@capacitor/core';
import { Filesystem } from '@capacitor/filesystem'; import { Filesystem } from '@capacitor/filesystem';
@@ -99,6 +99,7 @@ export class HomePage implements OnInit {
public ActiveTabService: ActiveTabService, public ActiveTabService: ActiveTabService,
private RoleIdService: RoleIdService, private RoleIdService: RoleIdService,
private modalController: ModalController, private modalController: ModalController,
private zone: NgZone
) { ) {
if (SessionStore.exist) { if (SessionStore.exist) {
@@ -152,39 +153,45 @@ export class HomePage implements OnInit {
refreshing() { } refreshing() { }
checkSendIntentReceived() { async checkSendIntentReceived() {
SendIntent.checkSendIntentReceived().then(async (result: any) => {
try {
const result: any = await SendIntent.checkSendIntentReceived();
if (result) { if (result) {
console.log('SendIntent received'); console.log('SendIntent received');
console.log(JSON.stringify(result)); console.log('JSON RESULT', JSON.stringify(result));
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: PublicationsPage, component: PublicationsPage,
componentProps: { componentProps: {
item: "item", item: "item",
intent: JSON.stringify(result) intent: JSON.stringify(result)
}, },
cssClass: 'new-action modal modal-desktop', cssClass: 'new-action modal modal-desktop',
backdropDismiss: false backdropDismiss: false
}); });
/* modal.onDidDismiss().then(() => { /* modal.onDidDismiss().then(() => {
this.getActions(); this.getActions();
}); */ }); */
await modal.present(); await modal.present();
} }
if (result.url) { if (result.url) {
let resultUrl = decodeURIComponent(result.url); console.log('SendIntent received URL');
Filesystem.readFile({path: resultUrl}) let resultUrl = decodeURIComponent(result.url);
Filesystem.readFile({ path: resultUrl })
.then((content) => { .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() { ngOnInit() {
this.checkSendIntentReceived() /* this.checkSendIntentReceived() */
if ("serviceWorker" in navigator) { if ("serviceWorker" in navigator) {
navigator.serviceWorker.onmessage = (event) => { navigator.serviceWorker.onmessage = (event) => {
@@ -277,19 +284,19 @@ export class HomePage implements OnInit {
}, 1000) }, 1000)
if (!this.platform.is('desktop')) { if (!this.platform.is('desktop')) {
App.addListener('appStateChange', ({ isActive }) => { App.addListener('appStateChange', ({ isActive }) => {
if (isActive) { if (isActive) {
// The app is in the foreground. // The app is in the foreground.
console.log('App is in the foreground'); console.log('App is in the foreground');
this.checkSendIntentReceived() /* this.checkSendIntentReceived() */
} else { } else {
// The app is in the background. // The app is in the background.
console.log('App is in the background'); console.log('App is in the background');
// You can perform actions specific to the background state here. // You can perform actions specific to the background state here.
} }
}); });
} }
} }
+1 -1
View File
@@ -130,7 +130,7 @@ export class ChatPage implements OnInit {
public RouteService: RouteService, public RouteService: RouteService,
) { ) {
this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headers = new HttpHeaders();;
window.onresize = (event) => { window.onresize = (event) => {
if (window.innerWidth > 701) { if (window.innerWidth > 701) {
this.modalController.dismiss(); this.modalController.dismiss();
@@ -86,6 +86,7 @@ export class NewPublicationPage implements OnInit {
imgResultBeforeCompress: string; imgResultBeforeCompress: string;
imgResultAfterCompress: string; imgResultAfterCompress: string;
convertBlobToBase64Worker; convertBlobToBase64Worker;
intent: any;
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -107,12 +108,17 @@ export class NewPublicationPage implements OnInit {
this.folderId = this.navParams.get('folderId'); this.folderId = this.navParams.get('folderId');
this.publication = this.navParams.get('publication'); this.publication = this.navParams.get('publication');
this.publicationTitle = 'Nova Publicação'; this.publicationTitle = 'Nova Publicação';
this.intent = this.navParams.get('intent');
this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url)); this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url));
} }
ngOnInit() { ngOnInit() {
if(this.intent) {
this.capturedImage = 'data:image/jpeg;base64,'+this.intent;
}
this.setTitle(); this.setTitle();
Filesystem.mkdir({ Filesystem.mkdir({
path: IMAGE_DIR, path: IMAGE_DIR,
@@ -14,6 +14,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { PermissionService } from 'src/app/services/permission.service'; import { PermissionService } from 'src/app/services/permission.service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { NewPublicationPage } from './new-publication/new-publication.page';
// import { ActionModel } from 'src/app/models/beast-orm'; // 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) { goToPublicationsList(folderId: string) {
if(this.intent){
this.AddPublication('2',folderId,this.intent)
return
}
if (window.innerWidth < 701) { if (window.innerWidth < 701) {
this.router.navigate(['/home/publications', folderId]); this.router.navigate(['/home/publications', folderId]);
this.idSelected = ""; this.idSelected = "";
+1 -1
View File
@@ -32,7 +32,7 @@ export class AttachmentsService {
setHeader() { setHeader() {
this.loggeduser = SessionStore.user this.loggeduser = SessionStore.user
this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headers = new HttpHeaders();;
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey); this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
} }
+2 -1
View File
@@ -27,7 +27,7 @@ import { CPSession } from '../store/documentManagement';
export class AuthService { export class AuthService {
userData$ = new BehaviorSubject<any>(''); userData$ = new BehaviorSubject<any>('');
userId$ = new BehaviorSubject<any>(''); userId$ = new BehaviorSubject<any>('');
headers: HttpHeaders = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized }); headers: HttpHeaders = new HttpHeaders();
public wsValidatedUserChat: any; public wsValidatedUserChat: any;
public isWsAuthenticated: boolean = false; public isWsAuthenticated: boolean = false;
opts: any; opts: any;
@@ -169,6 +169,7 @@ export class AuthService {
if (SessionStore.user.ChatData?.data) { if (SessionStore.user.ChatData?.data) {
this.RochetChatConnectorService.connect(); this.RochetChatConnectorService.connect();
this.RochetChatConnectorService.login().then((message: any) => { this.RochetChatConnectorService.login().then((message: any) => {
console.log('Chat login',message )
SessionStore.user.RochetChatUserId = message.result.id SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save() SessionStore.save()
+2 -2
View File
@@ -40,7 +40,7 @@ export class ChatService {
} }
getDocumentDetails(url: string) { 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-User-Id', SessionStore.user.ChatData.data.userId);
headersc = headersc.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken); headersc = headersc.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken);
headersc = headersc.set('Sec-Fetch-Dest', 'attachment'); headersc = headersc.set('Sec-Fetch-Dest', 'attachment');
@@ -350,7 +350,7 @@ export class ChatService {
try { try {
if (this.p.userPermission(this.p.permissionList.Chat.access) && SessionStore.user.ChatData) { 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)) { if (this.p.userPermission(this.p.permissionList.Chat.access)) {
// //
+1 -1
View File
@@ -36,7 +36,7 @@ export class ContactsService {
setHeader() { setHeader() {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headers = new HttpHeaders();;
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
} }
+14 -14
View File
@@ -82,22 +82,22 @@ export class EventsService {
async setHeader () { async setHeader () {
this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headers = new HttpHeaders();;
this.headersMdOficial = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headersMdOficial = new HttpHeaders();;
this.headersMdPessoal = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headersMdPessoal = new HttpHeaders();;
this.headersPrOficial = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headersPrOficial = new HttpHeaders();;
this.headersPrPessoal = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headersPrPessoal = new HttpHeaders();;
this.headersSharedOficial = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headersSharedOficial = new HttpHeaders();;
this.headersSharedPessoal = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headersSharedPessoal = new HttpHeaders();;
this.headerOwnOficial= new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headerOwnOficial= new HttpHeaders();;
this.headerOwnPessoal= new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headerOwnPessoal= new HttpHeaders();;
this.headerSharedOficial= new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headerSharedOficial= new HttpHeaders();;
this.headerSharedPessoal= new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headerSharedPessoal= new HttpHeaders();;
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey); this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
@@ -377,7 +377,7 @@ export class EventsService {
} }
makeHeader(calendar: calendarInterface) { makeHeader(calendar: calendarInterface) {
let header = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; let header = new HttpHeaders();;
header = header.set('Authorization', SessionStore.user.BasicAuthKey); header = header.set('Authorization', SessionStore.user.BasicAuthKey);
header = header.set('CalendarId', calendar.CalendarId); header = header.set('CalendarId', calendar.CalendarId);
header = header.set('CalendarRoleId', calendar.CalendarRoleId); header = header.set('CalendarRoleId', calendar.CalendarRoleId);
@@ -615,7 +615,7 @@ export class EventsService {
let result = [] let result = []
for(let agendasCalendar of agendasCalendars) { 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('Authorization', SessionStore.user.BasicAuthKey);
header = header.set('CalendarId', agendasCalendar.CalendarId); header = header.set('CalendarId', agendasCalendar.CalendarId);
header = header.set('CalendarRoleId', agendasCalendar.CalendarRoleId); header = header.set('CalendarRoleId', agendasCalendar.CalendarRoleId);
@@ -648,7 +648,7 @@ export class EventsService {
for (let sharedCalendar of SessionStore.user.SharedCalendars) { 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('Authorization', SessionStore.user.BasicAuthKey);
header = header.set('CalendarId', sharedCalendar.CalendarId); header = header.set('CalendarId', sharedCalendar.CalendarId);
header = header.set('CalendarRoleId', sharedCalendar.CalendarRoleId); header = header.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
+1 -1
View File
@@ -10,7 +10,7 @@ export class HttpService {
constructor(private http:HttpClient) { } constructor(private http:HttpClient) { }
post(serviceName:string, data:any){ post(serviceName:string, data:any){
const headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; const headers = new HttpHeaders();;
const options = {header: headers, withCredentials: false}; const options = {header: headers, withCredentials: false};
const url = environment.apiChatUrl+serviceName; const url = environment.apiChatUrl+serviceName;
const body = {"user": "admin","password": "tabteste@006"}; const body = {"user": "admin","password": "tabteste@006"};
+1 -1
View File
@@ -31,7 +31,7 @@ export class OrganicEntityService {
setHeader() { setHeader() {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headers = new HttpHeaders();;
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
} }
+2 -2
View File
@@ -44,11 +44,11 @@ export class ProcessesService {
setHeader() { setHeader() {
this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headers = new HttpHeaders();;
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); 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); this.headers2 = this.headers2.set('Authorization', "Bearer " + CPSession.AuthorizationJwt);
+1 -1
View File
@@ -36,7 +36,7 @@ export class PublicationsService {
setHeader () { setHeader () {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headers = new HttpHeaders();;
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
} }
+1 -1
View File
@@ -37,7 +37,7 @@ export class SearchService {
setHeader() { setHeader() {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.headers = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; this.headers = new HttpHeaders();;
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
} }
@@ -7137,7 +7137,7 @@ class HttpHeaders {
*/ */
clone(update) { clone(update) {
/** @type {?} */ /** @type {?} */
const clone = new HttpHeaders({'rejectUnauthorized': environment.rejectUnauthorized });; const clone = new HttpHeaders();;
clone.lazyInit = clone.lazyInit =
(!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this; (!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this;
clone.lazyUpdate = (this.lazyUpdate || []).concat([update]); 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 no headers have been passed in, construct a new HttpHeaders instance.
if (!this.headers) { 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 no parameters have been passed in, construct a new HttpUrlEncodedParams instance.
if (!this.params) { if (!this.params) {
@@ -7970,7 +7970,7 @@ class HttpResponseBase {
constructor(init, defaultStatus = 200, defaultStatusText = 'OK') { constructor(init, defaultStatus = 200, defaultStatusText = 'OK') {
// If the hash has values passed, use them to initialize the response. // If the hash has values passed, use them to initialize the response.
// Otherwise use the default values. // 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.status = init.status !== undefined ? init.status : defaultStatus;
this.statusText = init.statusText || defaultStatusText; this.statusText = init.statusText || defaultStatusText;
this.url = init.url || null; this.url = init.url || null;
+1 -1
View File
@@ -4,4 +4,4 @@ import { doneITProd } from './suport/doneIt'
import { DevDev } from './suport/dev' import { DevDev } from './suport/dev'
export const environment: Environment = DevDev; export const environment: Environment = oaprProd;
+1 -1
View File
@@ -4,4 +4,4 @@ import { doneITDev } from './suport/doneIt'
import { DevDev } from './suport/dev' import { DevDev } from './suport/dev'
export const environment: Environment = DevDev export const environment: Environment = oaprDev