diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 3826020b1..0847042d3 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ - + @@ -30,6 +30,7 @@ + { @@ -294,29 +294,9 @@ export class HomePage implements OnInit { if (!this.platform.is('desktop')) { App.addListener('appStateChange', ({ isActive }) => { if (isActive) { - /* this.checkSendIntentReceived("value") */ - // The app is in the foreground. - /* fetchData() - .then((value) => { - console.log('fetchData was successful in file2.ts', value); - this.imageToBase64(value) - .then((base64Data) => {s - if (base64Data) { - // Use the base64 data as needed - console.log('Base64 data:', base64Data); - } else { - console.error('Base64 data is null'); - } - }); - if (value) - this.checkSendIntentReceived(value) - - }) - .catch((error) => { - console.error('Error in file2.ts:', error); - }); */ + /* sendIntent.setRouteService(this.router) */ console.log('App is in the foreground'); - /* this.checkSendIntentReceived() */ + this.checkSendIntentReceived() } else { // The app is in the background. console.log('App is in the background'); diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index eea526bcf..53114a029 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -70,13 +70,12 @@ export class PublicationsPage implements OnInit { public ThemeService: ThemeService, public p: PermissionService, private storage: Storage, - private navParams: NavParams, ) { this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"]; - this.intent = this.navParams.get('intent'); + } ngOnInit() { @@ -91,6 +90,7 @@ export class PublicationsPage implements OnInit { }); this.hideRefreshButton(); + this.intent = window["sharedContent"] } diff --git a/src/app/services/shareIntent.ts b/src/app/services/shareIntent.ts index 0f2ecce12..a7c1b0067 100644 --- a/src/app/services/shareIntent.ts +++ b/src/app/services/shareIntent.ts @@ -3,7 +3,7 @@ import { SendIntent } from "send-intent"; import { Router } from '@angular/router'; import { CallbackScheduler } from './callbackScheduler'; -class SendIntent { +export class SendIntentService { Router!: Router @@ -20,6 +20,7 @@ class SendIntent { // event handler if (result.url) { this.onReceive(result) + } }).catch(err => console.error(err)); } @@ -38,13 +39,12 @@ class SendIntent { let resultUrl = decodeURIComponent(result.url); Filesystem.readFile({path: resultUrl}).then(async (content) => { - this.Router.navigateByUrl("/home/publication"); + this.Router.navigateByUrl("/home/publications"); - alert('shared') - console.log(content.data); + window["sharedContent"] = content.data; }) }) } -export const sendIntent = new SendIntent() +export const sendIntent = new SendIntentService()