mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-21 13:55:58 +00:00
Formatting
This commit is contained in:
1 parent
de2686d55e
commit
8bac50360f
8 files changed
+82
-120
No files matched your search
@@ -1,110 +0,0 @@
|
||||
//
|
||||
// CableConnectionView.swift
|
||||
// QuickDrop
|
||||
//
|
||||
// Created by Leon Böttger on 02.06.25.
|
||||
//
|
||||
|
||||
//import SwiftUI
|
||||
//
|
||||
//struct CableConnectionView: View {
|
||||
// let closeView: () -> Void
|
||||
//
|
||||
// @Environment(\.colorScheme) var colorScheme
|
||||
//
|
||||
// var body: some View {
|
||||
//
|
||||
// VStack {
|
||||
//
|
||||
// HStack {
|
||||
//
|
||||
// HStack(spacing: 5) {
|
||||
//
|
||||
// let imageSize: CGFloat = advertisesApp ? 20 : 25
|
||||
//
|
||||
// Image(.quickDropIcon)
|
||||
// .resizable()
|
||||
// .aspectRatio(contentMode: .fit)
|
||||
// .frame(width: imageSize, height: imageSize)
|
||||
//
|
||||
// if advertisesApp {
|
||||
// Text("QuickDrop")
|
||||
// }
|
||||
// }
|
||||
// .padding(.leading, 18)
|
||||
//
|
||||
// if !advertisesApp {
|
||||
// Spacer()
|
||||
//
|
||||
// HStack {
|
||||
// Text("ConnectWithQuickDropApp")
|
||||
// .padding(5)
|
||||
// .padding(.horizontal, 4)
|
||||
// .background(Capsule().fill(colorScheme == .light ? .white : .white.opacity(0.15)).opacity(connectWithApp ? 1 : 0))
|
||||
//
|
||||
// Text("ConnectWithoutApp")
|
||||
// .padding(5)
|
||||
// .padding(.horizontal, 4)
|
||||
// .background(Capsule().fill(colorScheme == .light ? .white : .white.opacity(0.15)).opacity(connectWithApp ? 0 : 1))
|
||||
// }
|
||||
// .padding(.horizontal, 1)
|
||||
// .padding(4)
|
||||
// .background(Capsule().fill(Color.gray.opacity(colorScheme == .light ? 0.2 : 0.15)))
|
||||
// .onTapGesture {
|
||||
// withAnimation {
|
||||
// connectWithApp.toggle()
|
||||
// }
|
||||
// }
|
||||
// .animation(.smooth, value:connectWithApp)
|
||||
// }
|
||||
//
|
||||
// Spacer()
|
||||
//
|
||||
// Button(action: {
|
||||
// closeView()
|
||||
// }, label: {
|
||||
// Image(systemName: "xmark")
|
||||
// .font(.system(size: 20))
|
||||
// .foregroundColor(.gray)
|
||||
// })
|
||||
// .buttonStyle(PlainButtonStyle())
|
||||
// }
|
||||
// .padding(.trailing, 15)
|
||||
// .padding(.leading, 10)
|
||||
// .padding(.top, 15)
|
||||
// .padding(.bottom, advertisesApp ? -10 : 0)
|
||||
//
|
||||
// Spacer()
|
||||
//
|
||||
// HStack {
|
||||
// Spacer()
|
||||
//
|
||||
// Image(connectWithApp ? .qrApp : .QR)
|
||||
// .resizable()
|
||||
// .aspectRatio(1, contentMode: .fit)
|
||||
// .frame(height: 160)
|
||||
//
|
||||
// Spacer()
|
||||
//
|
||||
//
|
||||
// Text(getDescription().localized())
|
||||
// .padding(.top, 5)
|
||||
// .padding(.horizontal)
|
||||
// .fixedSize(horizontal: false, vertical: true)
|
||||
// .multilineTextAlignment(.center)
|
||||
//
|
||||
// Spacer()
|
||||
// }
|
||||
// .padding(.horizontal)
|
||||
// .padding(.bottom)
|
||||
//
|
||||
// Spacer()
|
||||
//
|
||||
// }
|
||||
// .frame(width: qrCodeViewSize.width, height: qrCodeViewSize.height)
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//#Preview {
|
||||
// QrCodeView(advertisesApp: false, closeView: {})
|
||||
//}
|
||||
@@ -10,6 +10,8 @@ import Foundation
|
||||
import AppKit
|
||||
import Network
|
||||
|
||||
fileprivate let routerCheckQueue = DispatchQueue(label: "routerCheckQueue")
|
||||
|
||||
struct ApIsolationIssueView: View {
|
||||
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
@@ -27,6 +29,7 @@ struct ApIsolationIssueView: View {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func checkIfApIsolationStillEnabled() {
|
||||
scanner.scan { isConnectionAllowed in
|
||||
if isConnectionAllowed {
|
||||
@@ -48,8 +51,6 @@ struct ApIsolationIssueView: View {
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let routerCheckQueue = DispatchQueue(label: "routerCheckQueue")
|
||||
|
||||
|
||||
func openRouterSettingsPage() async {
|
||||
let routerIP: String? = await withCheckedContinuation { continuation in
|
||||
@@ -77,6 +78,8 @@ func openRouterSettingsPage() async {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Attempts to get the default gateway IP address (e.g., 192.168.1.1)
|
||||
/// and ensures it's reachable. Returns nil if unreachable or not found.
|
||||
func getDefaultGatewayIP() -> String? {
|
||||
@@ -98,6 +101,7 @@ func getDefaultGatewayIP() -> String? {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
/// Executes a shell command and returns the output
|
||||
@discardableResult
|
||||
func shell(_ command: String) -> String {
|
||||
@@ -114,6 +118,7 @@ func shell(_ command: String) -> String {
|
||||
return String(data: data, encoding: .utf8) ?? ""
|
||||
}
|
||||
|
||||
|
||||
/// Checks if a host (IP address or hostname) is reachable on port 80
|
||||
func isHostReachable(_ host: String) -> Bool {
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
@@ -145,7 +150,6 @@ func isHostReachable(_ host: String) -> Bool {
|
||||
}
|
||||
|
||||
|
||||
|
||||
#Preview {
|
||||
ApIsolationIssueView(closeView: {})
|
||||
.frame(width: issueViewWidth, height: issueViewHeight)
|
||||
|
||||
@@ -10,6 +10,7 @@ import AppKit
|
||||
import NearbyShare
|
||||
|
||||
struct SettingsView: View {
|
||||
|
||||
@AppStorage(UserDefaultsKeys.automaticallyAcceptFiles.rawValue) private var automaticallyAcceptFiles = false
|
||||
@AppStorage(UserDefaultsKeys.openFinderAfterReceiving.rawValue) private var openFinderAfterReceiving = false
|
||||
@AppStorage(UserDefaultsKeys.saveFolderBookmark.rawValue) private var saveFolderPath: Data = Data()
|
||||
@@ -49,6 +50,7 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func getSavedFolderPath() -> String? {
|
||||
if !saveFolderPath.isEmpty {
|
||||
var isStale = false
|
||||
@@ -62,6 +64,7 @@ struct SettingsView: View {
|
||||
return nil // No saved folder
|
||||
}
|
||||
|
||||
|
||||
private func selectFolder() {
|
||||
let panel = NSOpenPanel()
|
||||
panel.title = "SaveFilesLocation".localized()
|
||||
|
||||
Reference in new issue
Block a user