From 8b86aa8f3404af9231f442cae1b98d0b161862d8 Mon Sep 17 00:00:00 2001 From: Ayushya Amitabh Date: Tue, 6 Oct 2026 19:15:59 -0400 Subject: [PATCH] iOS: show transfer notifications as banners while the app is open Co-Authored-By: Claude Sonnet 5.5 --- ios/Runner/AppDelegate.swift | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 93ed6ed..c86e0c2 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,5 +1,6 @@ import Flutter import UIKit +import UserNotifications @main @objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { @@ -8,7 +9,20 @@ import UIKit didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { TransferManager.shared.reconnect() - return super.application(application, didFinishLaunchingWithOptions: launchOptions) + let launched = super.application(application, didFinishLaunchingWithOptions: launchOptions) + UNUserNotificationCenter.current().delegate = self + return launched + } + + /// A transfer summary ("Downloaded 1 file") usually finishes while the app + /// is open; without this iOS delivers it silently to Notification Center + /// instead of showing the banner. + override func userNotificationCenter( + _ center: UNUserNotificationCenter, + willPresent notification: UNNotification, + withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void + ) { + completionHandler([.banner, .list, .sound]) } override func application(