diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index a43a1a7f..00dd10b5 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -22,6 +22,14 @@
+
+
+
+
+
+
+
+
{
let platformReadySpy: any;
@@ -54,6 +55,7 @@ describe('AppComponent', () => {
ngxLogger = jasmine.createSpyObj('NGXLogger', ['log', 'error', 'warn']);
TestBed.configureTestingModule({
+ imports: [RouterTestingModule.withRoutes([])],
declarations: [AppComponent],
providers: [
{provide: Platform, useValue: platformSpy},
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 9dc2cb05..fbac57bd 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2020 StApps
+ * Copyright (C) 2018-2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,7 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {Component} from '@angular/core';
+import {Component, NgZone} from '@angular/core';
+import {Router} from '@angular/router';
+import {App, URLOpenListenerEvent} from '@capacitor/app';
import {SplashScreen} from '@capacitor/splash-screen';
import {Platform} from '@ionic/angular';
import {NGXLogger} from 'ngx-logger';
@@ -47,12 +49,16 @@ export class AppComponent {
* @param settingsProvider TODO
* @param configProvider TODO
* @param logger An angular logger
+ * @param router The angular router
+ * @param zone The angular zone
*/
constructor(
private readonly platform: Platform,
private readonly settingsProvider: SettingsProvider,
private readonly configProvider: ConfigProvider,
private readonly logger: NGXLogger,
+ private readonly router: Router,
+ private readonly zone: NgZone,
) {
void this.initializeApp();
}
@@ -61,6 +67,16 @@ export class AppComponent {
* TODO
*/
async initializeApp() {
+ App.addListener('appUrlOpen', (event: URLOpenListenerEvent) => {
+ this.zone.run(() => {
+ const slug = event.url.split('.de').pop();
+ if (slug) {
+ this.router.navigateByUrl(slug);
+ }
+ // If no match, do nothing - let regular routing
+ // logic take over
+ });
+ });
this.platform.ready().then(async () => {
await SplashScreen.hide();