Files
doneit-web/src/main.ts
T

94 lines
2.7 KiB
TypeScript
Raw Normal View History

2020-08-05 15:39:16 +01:00
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { defineCustomElements } from '@ionic/pwa-elements/loader';
import "hammerjs"; // HAMMER TIME
2023-10-27 16:21:15 +01:00
import { SendIntent } from "send-intent";
import { Filesystem } from '@capacitor/filesystem';
2020-08-05 15:39:16 +01:00
if (environment.production) {
enableProdMode();
}
2023-01-02 14:54:50 +01:00
/* Sentry.init(
{
dsn: 'https://5b345a3ae70b4e4da463da65881b4aaa@o4504340905525248.ingest.sentry.io/4504345615794176',
2022-12-30 15:34:45 +01:00
// To set your release and dist versions
2023-01-02 14:54:50 +01:00
release: 'gabinetedigital@1.0.0',
dist: '1',
2022-12-30 15:34:45 +01:00
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
2023-01-02 14:54:50 +01:00
integrations: [
new BrowserTracing({
tracingOrigins: ['localhost', 'https://gd-api.oapr.gov.ao/api/'],
}) as Integration,
]
},
2022-12-17 17:46:08 +01:00
// Forward the init method to the sibling Framework.
2023-01-02 14:54:50 +01:00
SentrySibling.init
); */
2022-12-17 17:46:08 +01:00
if ('serviceWorker' in navigator && environment.production) {
navigator.serviceWorker.register('firebase-messaging-sw.js')
.then(registration => {
console.log('Service Worker registrado com sucesso:', registration);
})
.catch(error => {
console.error('Erro ao registrar o Service Worker:', error);
});
}
2022-12-17 17:46:08 +01:00
2020-08-05 15:39:16 +01:00
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
// Call the element loader after the platform has been bootstrapped
2023-10-27 16:21:15 +01:00
SendIntent.checkSendIntentReceived().then((result: any) => {
if (result) {
console.log('SendIntent received');
console.log(JSON.stringify(result));
}
if (result.url) {
let resultUrl = decodeURIComponent(result.url);
Filesystem.readFile({path: resultUrl})
.then(async (content) => {
/* const modal = await this.modalController.create({
component: PublicationsPage,
componentProps: {
item: "item",
intent: content.data
},
cssClass: 'new-action modal modal-desktop',
backdropDismiss: false
});
modal.onDidDismiss().then(() => {
SendIntent.finish();
});
await modal.present();
*/
window["sharedintend"] = content.data
window["this.router"].navigateByUrl("/home/publication");
alert('shared')
console.log(content.data);
})
.catch((err) => console.error(err));
}
}).catch(err => console.error(err));
2021-11-30 12:30:58 +01:00
defineCustomElements(window);