From 65515eb2ce007901544a97879fd3bdf648d29d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= Date: Sat, 17 May 2025 15:08:03 +0200 Subject: [PATCH] Always bring app in foreground if alerted --- NearDrop/AppDelegate.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NearDrop/AppDelegate.swift b/NearDrop/AppDelegate.swift index 80599fc..6981937 100644 --- a/NearDrop/AppDelegate.swift +++ b/NearDrop/AppDelegate.swift @@ -267,6 +267,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele } func obtainUserConsent(for transfer: TransferMetadata, from device: RemoteDeviceInfo) { + + NSApp.activate(ignoringOtherApps: true) + activeIncomingTransfers[transfer.id] = TransferInfo(device: device, transfer: transfer) AudioManager.playSound() @@ -363,8 +366,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele } func showUnsupportedFileAlert(for device: RemoteDeviceInfo?) { + DispatchQueue.main.async { + NSApp.activate(ignoringOtherApps: true) + let alert = NSAlert() alert.alertStyle = .critical @@ -383,6 +389,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele guard let transfer = activeIncomingTransfers[id] else { return } if let error = error { + + NSApp.activate(ignoringOtherApps: true) + var description = "" if let ne = (error as? NearbyError) {