feat: Android APP V1 - Experimental Alpha

This commit is contained in:
2026-06-05 07:40:25 +02:00
parent bf4e6891d1
commit 9a1305f976
179 changed files with 8031 additions and 120 deletions

View File

@@ -0,0 +1,34 @@
import { Injectable, inject } from '@angular/core';
import type { MobileAppLifecycleAdapter } from '../contracts/mobile.contracts';
import { CapacitorMobileAppLifecycleAdapter } from '../adapters/capacitor/capacitor-mobile-app-lifecycle.adapter';
import { WebMobileAppLifecycleAdapter } from '../adapters/web/web-mobile-app-lifecycle.adapter';
import { MobilePlatformService } from './mobile-platform.service';
/** Facade for foreground/background lifecycle events. */
@Injectable({ providedIn: 'root' })
export class MobileAppLifecycleService {
private readonly mobilePlatform = inject(MobilePlatformService);
private readonly adapter: MobileAppLifecycleAdapter = this.createAdapter();
private initialized = false;
async initialize(): Promise<void> {
if (this.initialized) {
return;
}
await this.adapter.initialize();
this.mobilePlatform.refreshRuntimeDetection();
this.initialized = true;
}
onAppStateChange(handler: (isActive: boolean) => void): void {
this.adapter.onAppStateChange(handler);
}
private createAdapter(): MobileAppLifecycleAdapter {
return this.mobilePlatform.isCapacitor()
? new CapacitorMobileAppLifecycleAdapter()
: new WebMobileAppLifecycleAdapter();
}
}