mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-29 00:20:04 +01:00
mobile: add marketing consent settings
This commit is contained in:
committed by
Abdullah Atta
parent
40cb6ae8bf
commit
e251c6f71c
@@ -289,12 +289,12 @@ const _SectionItem = ({ item }: { item: SettingSection }) => {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{item.type === "switch" && item.property && (
|
||||
{item.type === "switch" && (
|
||||
<ToggleSwitch
|
||||
isOn={
|
||||
item.getter
|
||||
? item.getter(item.property || current)
|
||||
: settings[item.property]
|
||||
: settings[item?.property as never]
|
||||
}
|
||||
onColor={colors.accent}
|
||||
offColor={colors.icon}
|
||||
|
||||
@@ -636,6 +636,26 @@ export const settingsGroups: SettingSection[] = [
|
||||
"Contribute towards a better Notesnook. All tracking information is anonymous.",
|
||||
property: "telemetry"
|
||||
},
|
||||
{
|
||||
id: "marketing-emails",
|
||||
type: "switch",
|
||||
name: "Marketing emails",
|
||||
description:
|
||||
"We will send you occasional promotional offers & product updates on your email (sent once every month).",
|
||||
modifer: async () => {
|
||||
try {
|
||||
await db.user?.changeMarketingConsent(
|
||||
!useUserStore.getState().user?.marketingConsent
|
||||
);
|
||||
useUserStore.getState().setUser(await db.user?.fetchUser());
|
||||
} catch (e) {
|
||||
ToastEvent.error(e as Error);
|
||||
}
|
||||
},
|
||||
getter: (current: any) => current?.marketingConsent,
|
||||
useHook: () => useUserStore((state) => state.user),
|
||||
hidden: (current) => !current
|
||||
},
|
||||
{
|
||||
id: "cors-bypass",
|
||||
type: "input",
|
||||
|
||||
Reference in New Issue
Block a user