added a scrollbiew for icons and updated the label icon for haptics

This commit is contained in:
neon443
2025-08-22 15:46:17 +01:00
parent 2030c48ab3
commit 6308ef1c2f

View File

@@ -42,7 +42,7 @@ struct SettingsView: View {
Toggle("location persistence", systemImage: "location.fill", isOn: $hostsManager.settings.locationPersist) Toggle("location persistence", systemImage: "location.fill", isOn: $hostsManager.settings.locationPersist)
Toggle("bell sound", systemImage: "bell.and.waves.left.and.right", isOn: $hostsManager.settings.bellSound) Toggle("bell sound", systemImage: "bell.and.waves.left.and.right", isOn: $hostsManager.settings.bellSound)
Toggle("bell haptic",systemImage: "iphone.homebutton.radiowaves.left.and.right", isOn: $hostsManager.settings.bellHaptic) Toggle("bell haptic",systemImage: "iphone.radiowaves.left.and.right", isOn: $hostsManager.settings.bellHaptic)
Toggle("keep screen awake", systemImage: "cup.and.saucer.fill", isOn: $hostsManager.settings.caffeinate) Toggle("keep screen awake", systemImage: "cup.and.saucer.fill", isOn: $hostsManager.settings.caffeinate)
@@ -54,31 +54,32 @@ struct SettingsView: View {
.pickerStyle(.inline) .pickerStyle(.inline)
Section("App Icon") { Section("App Icon") {
HStack { ScrollView(.horizontal) {
ForEach(AppIcon.allCases, id: \.self) { icon in HStack {
let isSelected = hostsManager.settings.appIcon == icon ForEach(AppIcon.allCases, id: \.self) { icon in
ZStack(alignment: .top) { let isSelected = hostsManager.settings.appIcon == icon
RoundedRectangle(cornerRadius: 21.5) ZStack(alignment: .top) {
.foregroundStyle(.gray.opacity(0.5)) RoundedRectangle(cornerRadius: 21.5)
.opacity(isSelected ? 1 : 0) .foregroundStyle(.gray.opacity(0.5))
VStack(spacing: 0) { .opacity(isSelected ? 1 : 0)
icon.image VStack(spacing: 0) {
.resizable().scaledToFit() icon.image
.clipShape(RoundedRectangle(cornerRadius: 16.5)) .resizable().scaledToFit()
.padding(5) .clipShape(RoundedRectangle(cornerRadius: 16.5))
Text(icon.description).tag(icon) .padding(5)
.font(.caption) Text(icon.description).tag(icon)
.padding(.bottom, 5) .font(.caption)
.padding(.horizontal, 5) .padding(.bottom, 5)
.border(.red) .padding(.horizontal, 5)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
}
} }
} .frame(maxWidth: 85, maxHeight: 110)
.frame(maxWidth: 85, maxHeight: 110) .onTapGesture {
.onTapGesture { withAnimation {
withAnimation { hostsManager.settings.appIcon = icon
hostsManager.settings.appIcon = icon hostsManager.setAppIcon()
hostsManager.setAppIcon() }
} }
} }
} }