diff --git a/front/state/SettingsSlice.ts b/front/state/SettingsSlice.ts index a49f2ea..cab31ae 100644 --- a/front/state/SettingsSlice.ts +++ b/front/state/SettingsSlice.ts @@ -9,7 +9,10 @@ export type SettingsState = { preferedLevel: 'easy' | 'medium' | 'hard', colorBlind: boolean, micLevel: number, - preferedInputName?: string + preferedInputName?: string, + dataCollection: boolean, + customAds: boolean, + recommandations: boolean, } export const settingsSlice = createSlice({ @@ -23,7 +26,10 @@ export const settingsSlice = createSlice({ preferedLevel: 'easy', colorBlind: false, micLevel: 50, - colorScheme: "system" + colorScheme: "system", + dataCollection: true, + customAds: true, + recommandations: true, }, }, reducers: { diff --git a/front/views/AuthenticationView.tsx b/front/views/AuthenticationView.tsx index 4221b11..cea938d 100644 --- a/front/views/AuthenticationView.tsx +++ b/front/views/AuthenticationView.tsx @@ -36,6 +36,7 @@ const handleSignup = async (username: string, password: string, email: string, a const AuthenticationView = () => { const navigation = useNavigation(); const dispatch = useDispatch(); + console.log(navigation.getState()); const params = navigation.getState().routes.find((route) => { // this is not ideal way to check if we are on login page return route.name === "Login"; diff --git a/front/views/settings/PrivacyView.tsx b/front/views/settings/PrivacyView.tsx index 737ccf2..87f86f4 100644 --- a/front/views/settings/PrivacyView.tsx +++ b/front/views/settings/PrivacyView.tsx @@ -1,13 +1,17 @@ import React from "react"; -import { View } from "react-native"; -import { Center, Button, Text, Switch, Heading } from "native-base"; +import { Center, Heading } from "native-base"; import { translate } from "../../i18n/i18n"; import ElementList from "../../components/GtkUI/ElementList"; +import { useDispatch } from "react-redux"; +import { RootState, useSelector } from "../../state/Store"; +import { SettingsState, updateSettings } from "../../state/SettingsSlice"; + +const PrivacyView = () => { + const dispatch = useDispatch(); + const settings: SettingsState = useSelector( + (state: RootState) => state.settings.settings as SettingsState + ); -const PrivacyView = ({ navigation }) => { - const [dataCollection, setDataCollection] = React.useState(false); - const [customAds, setCustomAds] = React.useState(false); - const [recommendations, setRecommendations] = React.useState(false); return (