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,56 @@
import { Injectable, inject } from '@angular/core';
import type { CallNotificationActionIntent } from '../logic/call-notification.rules';
import { buildIncomingCallNotification, buildInCallNotification } from '../logic/call-notification.rules';
import type { MobileNotificationAdapter } from '../contracts/mobile.contracts';
import { CapacitorMobileNotificationsAdapter } from '../adapters/capacitor/capacitor-mobile-notifications.adapter';
import { WebMobileNotificationsAdapter } from '../adapters/web/web-mobile-notifications.adapter';
import { MobilePlatformService } from './mobile-platform.service';
import { MobilePushRegistrationService } from './mobile-push-registration.service';
/** Facade for push/local notifications with platform-specific adapters. */
@Injectable({ providedIn: 'root' })
export class MobileNotificationsService {
private readonly mobilePlatform = inject(MobilePlatformService);
private readonly pushRegistration = inject(MobilePushRegistrationService);
private readonly adapter: MobileNotificationAdapter = this.createAdapter();
private initialized = false;
async initialize(): Promise<void> {
if (this.initialized) {
return;
}
await this.adapter.initialize();
this.pushRegistration.initialize();
this.initialized = true;
}
async showIncomingCall(displayName: string, callId: string): Promise<void> {
await this.initialize();
await this.adapter.showCallNotification(buildIncomingCallNotification(displayName, callId));
}
async showActiveCall(input: { callId: string; displayName: string; isMuted: boolean }): Promise<void> {
await this.initialize();
await this.adapter.showCallNotification(buildInCallNotification(input));
}
async dismissIncomingCall(callId: string): Promise<void> {
await this.adapter.dismissCallNotification(callId, 'incoming');
}
async dismissActiveCall(callId: string): Promise<void> {
await this.adapter.dismissCallNotification(callId, 'active');
}
onCallAction(handler: (input: { callId: string; intent: CallNotificationActionIntent }) => void): void {
this.adapter.onActionSelected(handler);
}
private createAdapter(): MobileNotificationAdapter {
return this.mobilePlatform.isCapacitor()
? new CapacitorMobileNotificationsAdapter()
: new WebMobileNotificationsAdapter();
}
}