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 appGroupSettingsStore = UserDefaults(suiteName: "group.NearFuture") ?? UserDefaults.standard
let icSettStore = NSUbiquitousKeyValueStore.default let icSettStore = NSUbiquitousKeyValueStore.default
@@ -182,9 +189,9 @@ class SettingsViewModel: ObservableObject {
} }
// //
for color in accentChoices { // for color in accentChoices {
self.colorChoices.append(AccentIcon(color)) // self.colorChoices.append(AccentIcon(color))
} // }
} }
func saveSettings() { func saveSettings() {
@@ -196,10 +203,6 @@ class SettingsViewModel: ObservableObject {
loadSettings() loadSettings()
} }
} }
func changeAccent(to color: AccentIcon) {
}
} }
class EventViewModel: ObservableObject { 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 { var body: some View {
NavigationStack { NavigationStack {
ZStack { ZStack {
@@ -48,41 +56,24 @@ struct SettingsView: View {
ScrollView(.horizontal) { ScrollView(.horizontal) {
HStack { HStack {
ForEach(settingsModel.accentChoices, id: \.self) { choice in ForEach(settingsModel.accentChoices, id: \.self) { choice in
let color = Color(uiColor: UIColor(named: "uiColors/\(choice)")!)
ZStack { ZStack {
Button() { Button() {
settingsModel.changeAccent(to: choice) settingsModel.changeTint(to: choice)
changeIcon(to: choice)
} label: { } label: {
Circle() Circle()
.foregroundStyle(choice.color) .foregroundStyle(color)
.frame(width: 30) .frame(width: 30)
} }
if ColorCodable(choice.color) == settingsModel.settings.tint { if ColorCodable(color) == settingsModel.settings.tint {
let needContrast: Bool = ColorCodable(choice.color) == settingsModel.settings.tint let needContrast: Bool = ColorCodable(color) == settingsModel.settings.tint
Circle() Circle()
.foregroundStyle(needContrast ? .two : .one) .foregroundStyle(needContrast ? .two : .one)
.frame(width: 10) .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) Toggle("Show completed Events in Home", isOn: $settingsModel.settings.showCompletedInHome)
@@ -194,4 +185,3 @@ struct SettingsView: View {
settingsModel: dummySettingsViewModel() settingsModel: dummySettingsViewModel()
) )
} }