Native shell bridge
Maintainer reference. The hosted portal at https://portal.gfelektro.com runs inside
Electron (desktop), iOS (ios/PortalEU), or
Android (mobile/portal_android). Each shell exposes a small JavaScript API for
OS notifications and FCM device tokens.
window.portalNativeAPI (iOS / Android)
| Member | Type | Description |
|---|---|---|
platform |
'ios' | 'android' |
Shell identifier |
isNativeShell |
true |
Detection flag for the web app |
notifications.requestPermission() |
Promise |
Ask the user for notification permission |
notifications.checkPermission() |
Promise |
Current permission state |
notifications.show(title, options?) |
void |
OS notification; options may include body, tag, id, data |
push.getNativeToken() |
Promise<string | null> |
FCM registration token for Firestore, or null |
Injection order
- Native prelude defines
portalNativeAPI(Swift:PortalNativeBridge.swift, Android prelude inportal_webview_screen.dart). portal-native-bridge.jspatcheswindow.NotificationandServiceWorkerRegistration.prototype.showNotification.- Clicks are delivered via
portal-notification-clickedCustomEventonwindow.
window.electronNotificationAPI (desktop)
Electron uses preload.js and electron-notification-clicked. Do not remove it.
Digital-Platform (web app repo)
Implement in the separate Digital-Platform repository: openExternalUrl.ts, pushSubscriptionService.ts,
browserNotifications.ts, notificationCapability.ts. Server:
functions/src/webPushNotify.ts multicasts to all tokens in fcmTokens.
Security
Never commit GoogleService-Info.plist, google-services.json, .p8, or .p12 files.
Users install the macOS app from the DMG only — see macOS install guide.