diff --git a/app/EXO/EXO/EXOApp.swift b/app/EXO/EXO/EXOApp.swift index 2ba2c9e8..7669c408 100644 --- a/app/EXO/EXO/EXOApp.swift +++ b/app/EXO/EXO/EXOApp.swift @@ -225,7 +225,7 @@ private final class ExoUpdaterDelegate: NSObject, SPUUpdaterDelegate { } } - private func showNotification(title: String, body: String) { + nonisolated private func showNotification(title: String, body: String) { let center = UNUserNotificationCenter.current() let content = UNMutableNotificationContent() content.title = title diff --git a/app/EXO/EXO/Services/NetworkSetupHelper.swift b/app/EXO/EXO/Services/NetworkSetupHelper.swift index 27d98582..8fc6f97f 100644 --- a/app/EXO/EXO/Services/NetworkSetupHelper.swift +++ b/app/EXO/EXO/Services/NetworkSetupHelper.swift @@ -241,11 +241,11 @@ enum NetworkSetupHelper { rm -f "$LOG_OUT" "$LOG_ERR" # Switch back to Automatic network location - networksetup -switchtolocation Automatic 2>/dev/null || true + networksetup -switchtolocation Automatic >/dev/null 2>&1 || true # Delete the exo network location if it exists - networksetup -listlocations | grep -q '^exo$' && { - networksetup -deletelocation exo 2>/dev/null || true + networksetup -listlocations 2>/dev/null | grep -q '^exo$' && { + networksetup -deletelocation exo >/dev/null 2>&1 || true } || true # Re-enable any Thunderbolt Bridge service if it exists @@ -255,12 +255,12 @@ enum NetworkSetupHelper { tb_devices=$(networksetup -listallhardwareports 2>/dev/null | awk ' /^Hardware Port:/ { port = tolower(substr($0, 16)) } /^Device:/ { if (port ~ /thunderbolt/) print substr($0, 9) } - ') + ') || true [ -z "$tb_devices" ] && return 0 # For each bridge device, check if it contains Thunderbolt interfaces for bridge in bridge0 bridge1 bridge2; do - members=$(ifconfig "$bridge" 2>/dev/null | awk '/member:/ {print $2}') + members=$(ifconfig "$bridge" 2>/dev/null | awk '/member:/ {print $2}') || true [ -z "$members" ] && continue for tb_dev in $tb_devices; do @@ -269,7 +269,7 @@ enum NetworkSetupHelper { service_name=$(networksetup -listnetworkserviceorder 2>/dev/null | awk -v dev="$bridge" ' /^\\([0-9*]/ { gsub(/^\\([0-9*]+\\) /, ""); svc = $0 } /Device:/ && $0 ~ dev { print svc; exit } - ') + ') || true if [ -n "$service_name" ]; then networksetup -setnetworkserviceenabled "$service_name" on 2>/dev/null || true return 0 @@ -277,8 +277,9 @@ enum NetworkSetupHelper { fi done done + return 0 } - find_and_enable_thunderbolt_bridge + find_and_enable_thunderbolt_bridge || true echo "EXO network components removed successfully" """ diff --git a/app/EXO/EXO/Services/ThunderboltBridgeService.swift b/app/EXO/EXO/Services/ThunderboltBridgeService.swift index c9b11454..112fb991 100644 --- a/app/EXO/EXO/Services/ThunderboltBridgeService.swift +++ b/app/EXO/EXO/Services/ThunderboltBridgeService.swift @@ -127,21 +127,24 @@ final class ThunderboltBridgeService: ObservableObject { // 2. Request specific network configuration rights let rightName = "system.services.systemconfiguration.network" - var item = AuthorizationItem( - name: rightName, - valueLength: 0, - value: nil, - flags: 0 - ) - var rights = AuthorizationRights(count: 1, items: &item) - - status = AuthorizationCopyRights( - authRef, - &rights, - nil, - [.extendRights, .interactionAllowed], - nil - ) + status = rightName.withCString { nameCString in + var item = AuthorizationItem( + name: nameCString, + valueLength: 0, + value: nil, + flags: 0 + ) + return withUnsafeMutablePointer(to: &item) { itemPointer in + var rights = AuthorizationRights(count: 1, items: itemPointer) + return AuthorizationCopyRights( + authRef, + &rights, + nil, + [.extendRights, .interactionAllowed], + nil + ) + } + } guard status == errAuthorizationSuccess else { if status == errAuthorizationCanceled { throw ThunderboltBridgeError.authorizationCanceled