Add swiftlint & Minor fixes
This commit is contained in:
@@ -18,14 +18,16 @@ public struct ProfileActionToolbar: View {
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
#if os(iOS) || os(tvOS)
|
||||
#if os(iOS)
|
||||
iosBody
|
||||
#elseif os(tvOS)
|
||||
tvOSBody
|
||||
#elseif os(macOS)
|
||||
macOSBody
|
||||
#endif
|
||||
}
|
||||
|
||||
#if os(iOS) || os(tvOS)
|
||||
#if os(iOS)
|
||||
private var iosBody: some View {
|
||||
Section("Action") {
|
||||
if profile.type != .remote {
|
||||
@@ -65,6 +67,33 @@ public struct ProfileActionToolbar: View {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(tvOS)
|
||||
private var tvOSBody: some View {
|
||||
Section("Action") {
|
||||
if profile.type == .remote {
|
||||
FormButton {
|
||||
viewModel.isLoading = true
|
||||
Task {
|
||||
await viewModel.updateProfile(profile, environments: environments)
|
||||
}
|
||||
} label: {
|
||||
Label("Update", systemImage: "arrow.clockwise")
|
||||
}
|
||||
.foregroundColor(.accentColor)
|
||||
.disabled(viewModel.isLoading)
|
||||
}
|
||||
FormButton(role: .destructive) {
|
||||
Task {
|
||||
await viewModel.deleteProfile(profile, environments: environments, dismiss: dismiss)
|
||||
}
|
||||
} label: {
|
||||
Label("Delete", systemImage: "trash.fill")
|
||||
}
|
||||
.foregroundColor(.red)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(macOS)
|
||||
private var macOSBody: some View {
|
||||
VStack(spacing: 0) {
|
||||
|
||||
@@ -128,17 +128,17 @@ public struct ProfileView: View {
|
||||
if viewModel.editMode == .inactive {
|
||||
Button(action: {
|
||||
viewModel.editMode = .active
|
||||
}) {
|
||||
}, label: {
|
||||
Image(systemName: "square.and.pencil")
|
||||
}
|
||||
})
|
||||
.tint(.accentColor)
|
||||
.disabled(viewModel.profileList.isEmpty)
|
||||
} else {
|
||||
Button(action: {
|
||||
viewModel.editMode = .inactive
|
||||
}) {
|
||||
}, label: {
|
||||
Image(systemName: "checkmark.square.fill")
|
||||
}
|
||||
})
|
||||
.tint(.accentColor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,20 +57,12 @@ public struct QRCodeSheet: View {
|
||||
if #available(iOS 16.0, tvOS 17.0, *) {
|
||||
NavigationStackCompat {
|
||||
QRCodeContentView(profileName: profileName, remoteURL: remoteURL)
|
||||
.navigationTitle("Share QR Code")
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
#endif
|
||||
}
|
||||
.presentationDetents([.medium])
|
||||
.presentationDragIndicator(.visible)
|
||||
} else {
|
||||
NavigationStackCompat {
|
||||
QRCodeContentView(profileName: profileName, remoteURL: remoteURL)
|
||||
.navigationTitle("Share QR Code")
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user