diff --git a/apple/VniDrop/Core/CoreGateway.swift b/apple/VniDrop/Core/CoreGateway.swift index 5c57763..e7a5620 100644 --- a/apple/VniDrop/Core/CoreGateway.swift +++ b/apple/VniDrop/Core/CoreGateway.swift @@ -47,3 +47,4 @@ protocol CoreGateway: AnyObject { func receiverRequests(transferId: UInt64) async -> Result<[ReceiverRequestModel], Error> func respondReceiverRequest(requestId: String, accepted: Bool, reason: String?) async -> Result func refresh() async -> Result +} diff --git a/apple/VniDrop/Features/Notifications/TransferNotificationCoordinator.swift b/apple/VniDrop/Features/Notifications/TransferNotificationCoordinator.swift index 22e5b62..4c52fb7 100644 --- a/apple/VniDrop/Features/Notifications/TransferNotificationCoordinator.swift +++ b/apple/VniDrop/Features/Notifications/TransferNotificationCoordinator.swift @@ -111,7 +111,7 @@ final class TransferNotificationCoordinator: ObservableObject { switch signal { case .receiverHistoryChanged(let transferId), .transfersChanged(let transferId): Task { await self.syncReceivers(transferId: transferId) } - case .approvalChanged, .transfersChanged: + case .approvalChanged: break } } diff --git a/apple/VniDrop/Features/Send/SendModel.swift b/apple/VniDrop/Features/Send/SendModel.swift index 10400a3..ae1d4d8 100644 --- a/apple/VniDrop/Features/Send/SendModel.swift +++ b/apple/VniDrop/Features/Send/SendModel.swift @@ -353,7 +353,7 @@ final class SendModel: ObservableObject { senderName: current.senderName.trimmingCharacters(in: .whitespacesAndNewlines), destination: .invitation(accessPolicy: current.accessPolicy) ) - switch result.map(\.share) { + switch result { case .success(let share): await fileSystemService.discardPickedFiles(current.selectedFiles) if let thumb = current.selectedFiles.compactMap(\.thumbnailData).first { diff --git a/apple/VniDrop/Platform/AppDependencies+macOS.swift b/apple/VniDrop/Platform/AppDependencies+macOS.swift index ed7c14f..f227481 100644 --- a/apple/VniDrop/Platform/AppDependencies+macOS.swift +++ b/apple/VniDrop/Platform/AppDependencies+macOS.swift @@ -42,9 +42,10 @@ private struct MacDeviceInfoProvider: DeviceInfoProvider { var size = 0 sysctlbyname("hw.model", nil, &size, nil, 0) guard size > 0 else { return nil } - var model = [CChar](repeating: 0, count: size) + var model = [UInt8](repeating: 0, count: size) sysctlbyname("hw.model", &model, &size, nil, 0) - return String(cString: model) + // sysctl reports a NUL-terminated C string; drop the terminator(s). + return String(decoding: model.prefix(while: { $0 != 0 }), as: UTF8.self) } } #endif diff --git a/apple/VniDrop/UI/Feedback/UserFacingError.swift b/apple/VniDrop/UI/Feedback/UserFacingError.swift index 3784f94..f8bb041 100644 --- a/apple/VniDrop/UI/Feedback/UserFacingError.swift +++ b/apple/VniDrop/UI/Feedback/UserFacingError.swift @@ -30,6 +30,10 @@ extension Error { return .resource(L10n.Error.storageFull) case .Network: return .resource(L10n.Error.network) + case .DeviceUnavailable, .RelayPolicyIncompatible: + return .resource(L10n.Error.network) + case .OfferTimeout, .ProtocolIncompatible: + return .resource(L10n.Error.transfer) case .Transfer(let reason): return transferUiText(reason) case .Repository: @@ -88,6 +92,8 @@ extension Error { switch vni { case .Initialization(let r), .Ticket(let r), .Filesystem(let r), .FilesystemPermission(let r), .DestinationExists(let r), .StorageFull(let r), .Network(let r), + .DeviceUnavailable(let r), .OfferTimeout(let r), + .RelayPolicyIncompatible(let r), .ProtocolIncompatible(let r), .Transfer(let r), .Permission(let r), .Repository(let r), .Cancelled(let r), .InvalidInput(let r), .InvalidTransition(let r), .SecureStorageLocked(let r), .SecureStorageMissing(let r), .SecureStorageCorrupted(let r),