MESSENGER-3157 third notification settings option

This commit is contained in:
Arnfried Griesert
2023-03-07 13:28:09 +00:00
committed by Frank Rotermund
parent a50402d361
commit 89f8644abc
10 changed files with 49 additions and 11 deletions
@@ -37,6 +37,6 @@ extension RoomNotificationSettingsViewState {
extension RoomNotificationSettingsViewState {
var roomEncryptedString: String {
roomEncrypted ? VectorL10n.roomNotifsSettingsEncryptedRoomNotice : ""
return roomEncrypted ? BWIL10n.roomNotifsSettingsEncryptedRoomNotice : ""
}
}
@@ -32,11 +32,20 @@ extension RoomNotificationState {
var title: String {
switch self {
case .all:
return VectorL10n.roomNotifsSettingsAllMessages
return BWIL10n.roomNotifsSettingsAllMessages
case .mentionsAndKeywordsOnly:
return VectorL10n.roomNotifsSettingsMentionsAndKeywords
case .mute:
return VectorL10n.roomNotifsSettingsNone
return BWIL10n.roomNotifsSettingsNone
}
}
var subtitle: String {
switch self {
case .all:
return BWIL10n.roomNotifsSettingsAllDescription
default:
return ""
}
}
}
@@ -22,6 +22,7 @@ struct FormPickerItem: View {
@Environment(\.theme) var theme: ThemeSwiftUI
var title: String
var subtitle: String?
var selected: Bool
var onTap: TapCallback?
@@ -32,7 +33,16 @@ struct FormPickerItem: View {
VStack {
Spacer()
HStack {
Text(title)
if let subtitle = subtitle, !subtitle.isEmpty && BWIBuildSettings.shared.notificationSettingsLikeAndroidAndWeb {
VStack(alignment: .leading, spacing: 4) {
Text(title)
Text(subtitle)
.font(.footnote)
.foregroundColor(.secondary)
}
} else {
Text(title)
}
Spacer()
if selected {
Image("checkmark")
@@ -48,11 +48,11 @@ struct RoomNotificationSettings: View {
)
}
SwiftUI.Section(
header: FormSectionHeader(text: VectorL10n.roomNotifsSettingsNotifyMeFor),
header: FormSectionHeader(text: BWIL10n.roomNotifsSettingsNotifyMeFor),
footer: FormSectionFooter(text: viewModel.viewState.roomEncryptedString)
) {
ForEach(viewModel.viewState.notificationOptions) { option in
FormPickerItem(title: option.title, selected: viewModel.viewState.notificationState == option) {
FormPickerItem(title: option.title, subtitle: option.subtitle, selected: viewModel.viewState.notificationState == option) {
viewModel.process(viewAction: .selectNotificationState(option))
}
}