iOS: show transfer notifications as banners while the app is open
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
469e57cca7
commit
8b86aa8f34
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user