2023-06-19 22:26:41 +02:00
|
|
|
import { Paragraph } from '@/components/Typography';
|
2023-04-27 15:08:10 +02:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
|
import { Switch } from 'react-native-gesture-handler';
|
2023-06-19 22:26:41 +02:00
|
|
|
import { t } from '@/localisation';
|
|
|
|
|
import { useAppDispatch, useTypedSelector } from '@/store';
|
|
|
|
|
import { setEnablePlaybackReporting } from '@/store/settings/actions';
|
2023-04-28 21:01:21 +02:00
|
|
|
import Container from '../components/Container';
|
|
|
|
|
import { SwitchContainer, SwitchLabel } from '../components/Switch';
|
2023-04-27 15:08:10 +02:00
|
|
|
|
|
|
|
|
export default function PlaybackReporting() {
|
|
|
|
|
const isEnabled = useTypedSelector((state) => state.settings.enablePlaybackReporting);
|
|
|
|
|
const dispatch = useAppDispatch();
|
|
|
|
|
|
|
|
|
|
const toggleSwitch = useCallback(() => {
|
|
|
|
|
dispatch(setEnablePlaybackReporting(!isEnabled));
|
|
|
|
|
}, [isEnabled, dispatch]);
|
|
|
|
|
|
|
|
|
|
return (
|
2025-08-04 15:03:40 -07:00
|
|
|
<Container>
|
|
|
|
|
<Paragraph>{t('playback-reporting-description')}</Paragraph>
|
|
|
|
|
<SwitchContainer>
|
|
|
|
|
<SwitchLabel>{t('playback-reporting')}</SwitchLabel>
|
|
|
|
|
<Switch value={isEnabled} onValueChange={toggleSwitch} />
|
|
|
|
|
</SwitchContainer>
|
|
|
|
|
</Container>
|
2023-04-27 15:08:10 +02:00
|
|
|
);
|
|
|
|
|
}
|