Fix issues on new systems

This commit is contained in:
世界
2025-09-23 21:45:01 +08:00
parent a696864985
commit 286f6fd794
8 changed files with 64 additions and 7 deletions
@@ -34,17 +34,23 @@ public struct EditProfileView: View {
FormItem(String(localized: "Path")) {
TextField("Path", text: $profile.path, prompt: Text("Required"))
.multilineTextAlignment(.trailing)
#if !os(macOS)
.keyboardType(.asciiCapableNumberPad)
#endif
}
} else if profile.type == .remote {
FormItem(String(localized: "URL")) {
TextField("URL", text: $profile.remoteURL.unwrapped(""), prompt: Text("Required"))
.multilineTextAlignment(.trailing)
#if !os(macOS)
.keyboardType(.URL)
#endif
}
Toggle("Auto Update", isOn: $profile.autoUpdate)
FormItem(String(localized: "Auto Update Interval")) {
TextField("Auto Update Interval", text: $profile.autoUpdateInterval.stringBinding(defaultValue: 60), prompt: Text("In Minutes"))
.multilineTextAlignment(.trailing)
#if os(iOS)
#if !os(macOS)
.keyboardType(.numberPad)
#endif
}
@@ -10,7 +10,11 @@ public struct NewProfileView: View {
@State private var isSaving = false
@State private var profileName = ""
@State private var profileType = ProfileType.local
#if !os(tvOS)
@State private var profileType = ProfileType.local
#else
@State private var profileType = ProfileType.remote
#endif
@State private var fileImport = false
@State private var fileURL: URL!
@State private var remotePath = ""
@@ -79,17 +83,23 @@ public struct NewProfileView: View {
FormItem(String(localized: "Path")) {
TextField("Path", text: $remotePath, prompt: Text("Required"))
.multilineTextAlignment(.trailing)
#if !os(macOS)
.keyboardType(.asciiCapableNumberPad)
#endif
}
} else if profileType == .remote {
FormItem(String(localized: "URL")) {
TextField("URL", text: $remotePath, prompt: Text("Required"))
.multilineTextAlignment(.trailing)
#if !os(macOS)
.keyboardType(.URL)
#endif
}
Toggle("Auto Update", isOn: $autoUpdate)
FormItem(String(localized: "Auto Update Interval")) {
TextField("Auto Update Interval", text: $autoUpdateInterval.stringBinding(defaultValue: 60), prompt: Text("In Minutes"))
.multilineTextAlignment(.trailing)
#if os(iOS)
#if !os(macOS)
.keyboardType(.numberPad)
#endif
}
@@ -137,14 +137,20 @@ public struct ProfileView: View {
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
if editMode == .inactive {
Button("Edit") {
Button(action: {
editMode = .active
}) {
Image(systemName: "square.and.pencil")
}
.tint(.accentColor)
.disabled(profileList.isEmpty)
} else {
Button("Done") {
Button(action: {
editMode = .inactive
}) {
Image(systemName: "checkmark.square.fill")
}
.tint(.accentColor)
}
}
}