Tweak to notifications policy

This commit is contained in:
Thomas Ricouard 2024-08-16 07:24:19 +02:00
parent 412f475d1d
commit dc85557d40

View file

@ -25,12 +25,8 @@ struct NotificationsPolicyView: View {
})) { })) {
pickerMenu pickerMenu
} label: { } label: {
VStack(alignment: .leading) { makePickerLabel(title: "notifications.content-filter.peopleYouDontFollow",
Text("notifications.content-filter.peopleYouDontFollow") subtitle: "Until you manually approve them")
Text("Until you manually approve them")
.foregroundStyle(.secondary)
.font(.footnote)
}
} }
Picker(selection: .init(get: { Picker(selection: .init(get: {
@ -41,12 +37,8 @@ struct NotificationsPolicyView: View {
})) { })) {
pickerMenu pickerMenu
} label: { } label: {
VStack(alignment: .leading) { makePickerLabel(title: "notifications.content-filter.peopleNotFollowingYou",
Text("notifications.content-filter.peopleNotFollowingYou") subtitle: "And following you for less than 3 days")
Text("And following you for less than 3 days")
.foregroundStyle(.secondary)
.font(.footnote)
}
} }
Picker(selection: .init(get: { Picker(selection: .init(get: {
@ -57,12 +49,8 @@ struct NotificationsPolicyView: View {
})) { })) {
pickerMenu pickerMenu
} label: { } label: {
VStack(alignment: .leading) { makePickerLabel(title: "notifications.content-filter.newAccounts",
Text("notifications.content-filter.newAccounts") subtitle: "Created within the past 30 days")
Text("Created within the past 30 days")
.foregroundStyle(.secondary)
.font(.footnote)
}
} }
Picker(selection: .init(get: { Picker(selection: .init(get: {
@ -73,12 +61,8 @@ struct NotificationsPolicyView: View {
})) { })) {
pickerMenu pickerMenu
} label: { } label: {
VStack(alignment: .leading) { makePickerLabel(title: "notifications.content-filter.privateMentions",
Text("notifications.content-filter.privateMentions") subtitle: "Unless it's in reply to your own mention or if you follow the sender")
Text("Unless it's in reply to your own mention or if you follow the sender")
.foregroundStyle(.secondary)
.font(.footnote)
}
} }
Picker(selection: .init(get: { Picker(selection: .init(get: {
@ -90,10 +74,8 @@ struct NotificationsPolicyView: View {
pickerMenu pickerMenu
} label: { } label: {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text("Moderated accounts") makePickerLabel(title: "Moderated accounts",
Text("Limited by server moderators") subtitle: "Limited by server moderators")
.foregroundStyle(.secondary)
.font(.footnote)
} }
} }
} }
@ -112,7 +94,7 @@ struct NotificationsPolicyView: View {
} }
.redacted(reason: policy == nil ? .placeholder : []) .redacted(reason: policy == nil ? .placeholder : [])
} }
.presentationDetents([.medium]) .presentationDetents([.height(500)])
.presentationBackground(.thinMaterial) .presentationBackground(.thinMaterial)
} }
@ -122,6 +104,16 @@ struct NotificationsPolicyView: View {
} }
} }
private func makePickerLabel(title: LocalizedStringKey, subtitle: LocalizedStringKey) -> some View {
VStack(alignment: .leading) {
Text(title)
.font(.callout)
Text(subtitle)
.foregroundStyle(.secondary)
.font(.footnote)
}
}
private func getPolicy() async { private func getPolicy() async {
defer { defer {
isUpdating = false isUpdating = false