use same visuals for notification sounds setting as the allow messages from (#4141)

zio/stable
Hailey 2024-05-20 20:08:29 -07:00 committed by GitHub
parent 8be65a8790
commit 5bbb5f5806
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 41 additions and 15 deletions

View File

@ -35,7 +35,7 @@ export function MessagesSettingsScreen({}: Props) {
},
})
const onSelectItem = useCallback(
const onSelectMessagesFrom = useCallback(
(keys: string[]) => {
const key = keys[0]
if (!key) return
@ -44,6 +44,15 @@ export function MessagesSettingsScreen({}: Props) {
[updateDeclaration],
)
const onSelectSoundSetting = useCallback(
(keys: string[]) => {
const key = keys[0]
if (!key) return
setPref('playSoundChat', key === 'enabled')
},
[setPref],
)
return (
<CenteredView sideBorders style={a.h_full_vh}>
<ViewHeader title={_(msg`Settings`)} showOnDesktop showBorder />
@ -58,7 +67,7 @@ export function MessagesSettingsScreen({}: Props) {
(profile?.associated?.chat?.allowIncoming as AllowIncoming) ??
'following',
]}
onChange={onSelectItem}>
onChange={onSelectMessagesFrom}>
<View>
<Toggle.Item
name="all"
@ -91,19 +100,36 @@ export function MessagesSettingsScreen({}: Props) {
</Toggle.Group>
{isNative && (
<>
<Divider style={[a.my_lg]} />
<Divider />
<Text style={[a.text_lg, a.font_bold]}>
<Trans>Notification Sounds</Trans>
</Text>
<Toggle.Group
label={_(msg`Notification sounds`)}
type="radio"
values={[preferences.playSoundChat ? 'enabled' : 'disabled']}
onChange={onSelectSoundSetting}>
<View>
<Toggle.Item
name="playSoundChat"
label={_(msg`Play notification sounds`)}
value={preferences.playSoundChat}
onChange={() => {
setPref('playSoundChat', !preferences.playSoundChat)
}}>
<Toggle.Checkbox />
name="enabled"
label={_(msg`Enabled`)}
style={[a.justify_between, a.py_sm]}>
<Toggle.LabelText>
<Trans>Play notification sounds</Trans>
<Trans>Enabled</Trans>
</Toggle.LabelText>
<Toggle.Radio />
</Toggle.Item>
<Toggle.Item
name="disabled"
label={_(msg`Disabled`)}
style={[a.justify_between, a.py_sm]}>
<Toggle.LabelText>
<Trans>Disabled</Trans>
</Toggle.LabelText>
<Toggle.Radio />
</Toggle.Item>
</View>
</Toggle.Group>
</>
)}
</View>