mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
remove reject of the headets
This commit is contained in:
+47
-40
@@ -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.
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user