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
+47 -40
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 { 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.
}
});
}
}
+1 -1
View File
@@ -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();
@@ -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,
@@ -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 = "";
+1 -1
View File
@@ -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);
}
+2 -1
View File
@@ -27,7 +27,7 @@ import { CPSession } from '../store/documentManagement';
export class AuthService {
userData$ = new BehaviorSubject<any>('');
userId$ = new BehaviorSubject<any>('');
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()
+2 -2
View File
@@ -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)) {
//
+1 -1
View File
@@ -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);
}
+14 -14
View File
@@ -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);
+1 -1
View File
@@ -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"};
+1 -1
View File
@@ -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);
}
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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);
}
@@ -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;
+1 -1
View File
@@ -4,4 +4,4 @@ import { doneITProd } from './suport/doneIt'
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'
export const environment: Environment = DevDev
export const environment: Environment = oaprDev