Apps (mobile/): - Capacitor-8-Hülle, lädt die Web-App von APP_URL – Inhalte ohne App-Update - Android- und iOS-Projekt (Swift Package Manager) mit Firebase Messaging, nativer Sprachausgabe, Teilen, App, Statusleiste, Startbildschirm - `npm run sync` überträgt APP_ID, Name, Adresse und Farbe aus mobile/.env in beide Projekte und richtet ein: App-Links (Android intent-filter, iOS Associated Domains), Push (Entitlements, Background Mode, AppDelegate, Benachrichtigungssymbol/-farbe), Offline-Seite; idempotent, prüft Eingaben, warnt bei fehlenden Firebase-Dateien - `npm run assets` erzeugt Symbole und Startbildschirme aus Logo und Markenfarbe der Redaktion, dazu das Android-Benachrichtigungssymbol - Schritt-für-Schritt-Anleitung für den Mac (mobile/README.md) Server: - Versand an App-Geräte über FCM HTTP v1 (signiertes JWT, ohne firebase-admin), eingebunden in alle Benachrichtigungen; abgemeldete Geräte werden entfernt (nur bei UNREGISTERED, nicht bei anderen Fehlern) - Firebase-Dienstkonto in den Einstellungen hochladen (verschlüsselt), App-ID, Team-ID, SHA-256, Store-Links; /.well-known/apple-app-site- association und assetlinks.json; Smart-App-Banner, Store-Hinweis - Server erkennt die App am User-Agent (kein Aufblitzen von „Als App installieren“); Datenschutz-Vorlage um Firebase ergänzt Web-App in der App: Push über Firebase statt Web-Push, Vorlesen nativ, Teilen nativ, Zurück-Taste (schließt erst Dialoge), Antippen einer Benachrichtigung und App-Links öffnen die Seite (nur eigene Adressen). Getestet mit nachgebauter Capacitor-Brücke und nachgebautem Firebase-Dienst. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
57 lines
3.3 KiB
Swift
57 lines
3.3 KiB
Swift
import UIKit
|
||
import Capacitor
|
||
|
||
@UIApplicationMain
|
||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||
|
||
var window: UIWindow?
|
||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||
// Override point for customization after application launch.
|
||
return true
|
||
}
|
||
|
||
func applicationWillResignActive(_ application: UIApplication) {
|
||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
||
}
|
||
|
||
func applicationDidEnterBackground(_ application: UIApplication) {
|
||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||
}
|
||
|
||
func applicationWillEnterForeground(_ application: UIApplication) {
|
||
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
||
}
|
||
|
||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||
}
|
||
|
||
func applicationWillTerminate(_ application: UIApplication) {
|
||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||
}
|
||
|
||
func application(_ application: UIApplication,
|
||
configurationForConnecting connectingSceneSession: UISceneSession,
|
||
options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
||
let config = UISceneConfiguration(name: "Default Configuration",
|
||
sessionRole: connectingSceneSession.role)
|
||
config.delegateClass = SceneDelegate.self
|
||
return config
|
||
}
|
||
|
||
// werkstatt:push – Push-Nachrichten (@capacitor-firebase/messaging)
|
||
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
||
NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken)
|
||
}
|
||
|
||
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
||
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
|
||
}
|
||
|
||
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
||
NotificationCenter.default.post(name: Notification.Name.init("didReceiveRemoteNotification"), object: completionHandler, userInfo: userInfo)
|
||
}
|
||
}
|