YESSSSSSSSS

ok now jsut have ot make this scalabel 😭
😭😭😭
This commit is contained in:
neon443
2025-05-14 21:04:00 +01:00
parent 82341f40ef
commit bb67b0ce98
2 changed files with 24 additions and 31 deletions

View File

@@ -163,6 +163,13 @@ class SettingsViewModel: ObservableObject {
}
}
func changeTint(to: String) {
if let uicolor = UIColor(named: "uiColors/\(to)") {
self.settings.tint = ColorCodable(uiColor: uicolor)
saveSettings()
}
}
let appGroupSettingsStore = UserDefaults(suiteName: "group.NearFuture") ?? UserDefaults.standard
let icSettStore = NSUbiquitousKeyValueStore.default
@@ -182,9 +189,9 @@ class SettingsViewModel: ObservableObject {
}
//
for color in accentChoices {
self.colorChoices.append(AccentIcon(color))
}
// for color in accentChoices {
// self.colorChoices.append(AccentIcon(color))
// }
}
func saveSettings() {
@@ -196,10 +203,6 @@ class SettingsViewModel: ObservableObject {
loadSettings()
}
}
func changeAccent(to color: AccentIcon) {
}
}
class EventViewModel: ObservableObject {

View File

@@ -40,6 +40,14 @@ struct SettingsView: View {
}
}
func changeIcon(to: String) {
guard !(to == "orange") else {
UIApplication.shared.setAlternateIconName(nil)
return
}
UIApplication.shared.setAlternateIconName(to)
}
var body: some View {
NavigationStack {
ZStack {
@@ -48,41 +56,24 @@ struct SettingsView: View {
ScrollView(.horizontal) {
HStack {
ForEach(settingsModel.accentChoices, id: \.self) { choice in
let color = Color(uiColor: UIColor(named: "uiColors/\(choice)")!)
ZStack {
Button() {
settingsModel.changeAccent(to: choice)
settingsModel.changeTint(to: choice)
changeIcon(to: choice)
} label: {
Circle()
.foregroundStyle(choice.color)
.foregroundStyle(color)
.frame(width: 30)
}
if ColorCodable(choice.color) == settingsModel.settings.tint {
let needContrast: Bool = ColorCodable(choice.color) == settingsModel.settings.tint
if ColorCodable(color) == settingsModel.settings.tint {
let needContrast: Bool = ColorCodable(color) == settingsModel.settings.tint
Circle()
.foregroundStyle(needContrast ? .two : .one)
.frame(width: 10)
}
}
}
// ForEach(settingsModel.accentChoices, id: \.self) { color in
// ZStack {
// Button() {
//
// } label: {
// Circle()
// .foregroundStyle(color)
// .frame(width: 30)
// }
// if ColorCodable(color) == settingsModel.settings.tint {
// let needContrast: Bool = ColorCodable(color) == settingsModel.settings.tint
// Circle()
// .foregroundStyle(needContrast ? .two : .one)
// .frame(width: 10)
// }
// }
// }
}
}
Toggle("Show completed Events in Home", isOn: $settingsModel.settings.showCompletedInHome)
@@ -194,4 +185,3 @@ struct SettingsView: View {
settingsModel: dummySettingsViewModel()
)
}