about summary refs log tree commit diff
path: root/src/screens/Settings/NotificationSettings.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-06-17 12:37:14 +0300
committerGitHub <noreply@github.com>2025-06-17 02:37:14 -0700
commit21989b558bd074bf84ac08c174d7a411fda1ffb7 (patch)
treef5f28510cf5a592b83bcfc581a57e992823eb402 /src/screens/Settings/NotificationSettings.tsx
parent7dc6bb57a6666db3e507630c13448487acceadc5 (diff)
downloadvoidsky-21989b558bd074bf84ac08c174d7a411fda1ffb7.tar.zst
Granular notification settings (#8484)
* add mockup screen

* add notification index screen

* add redirect screen

* upgrade sdk

* new icons

* add new screens

* make router typesafe, finish adding screens

* add routes to go server

* load settings

* push notif settings

* improve web

* fix lockfile lint

* no $type on preferences

* prompt to enable push notifications

* fix reply prefs

* space out options

* fix copy error

* Update RepostsOnRepostsNotificationSettings.tsx

* only send minimal diff to putPrefs

* fix yarn.lock

* Update Navigation.tsx

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>

* Update src/screens/Settings/NotificationSettings/index.tsx

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>

* add description to `syncOthers`

---------

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
Diffstat (limited to 'src/screens/Settings/NotificationSettings.tsx')
-rw-r--r--src/screens/Settings/NotificationSettings.tsx98
1 files changed, 0 insertions, 98 deletions
diff --git a/src/screens/Settings/NotificationSettings.tsx b/src/screens/Settings/NotificationSettings.tsx
deleted file mode 100644
index ebb230c2c..000000000
--- a/src/screens/Settings/NotificationSettings.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import {Text} from 'react-native'
-import {msg, Trans} from '@lingui/macro'
-import {useLingui} from '@lingui/react'
-
-import {AllNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
-import {useNotificationFeedQuery} from '#/state/queries/notifications/feed'
-import {useNotificationSettingsMutation} from '#/state/queries/notifications/settings'
-import {atoms as a} from '#/alf'
-import {Admonition} from '#/components/Admonition'
-import {Error} from '#/components/Error'
-import * as Toggle from '#/components/forms/Toggle'
-import {Beaker_Stroke2_Corner2_Rounded as BeakerIcon} from '#/components/icons/Beaker'
-import * as Layout from '#/components/Layout'
-import {Loader} from '#/components/Loader'
-import * as SettingsList from './components/SettingsList'
-
-type Props = NativeStackScreenProps<AllNavigatorParams, 'NotificationSettings'>
-export function NotificationSettingsScreen({}: Props) {
-  const {_} = useLingui()
-
-  const {
-    data,
-    isError: isQueryError,
-    refetch,
-  } = useNotificationFeedQuery({
-    filter: 'all',
-  })
-  const serverPriority = data?.pages.at(0)?.priority
-
-  const {
-    mutate: onChangePriority,
-    isPending: isMutationPending,
-    variables,
-  } = useNotificationSettingsMutation()
-
-  const priority = isMutationPending
-    ? variables[0] === 'enabled'
-    : serverPriority
-
-  return (
-    <Layout.Screen>
-      <Layout.Header.Outer>
-        <Layout.Header.BackButton />
-        <Layout.Header.Content>
-          <Layout.Header.TitleText>
-            <Trans>Notification Settings</Trans>
-          </Layout.Header.TitleText>
-        </Layout.Header.Content>
-        <Layout.Header.Slot />
-      </Layout.Header.Outer>
-      <Layout.Content>
-        {isQueryError ? (
-          <Error
-            title={_(msg`Oops!`)}
-            message={_(msg`Something went wrong!`)}
-            onRetry={refetch}
-            sideBorders={false}
-          />
-        ) : (
-          <SettingsList.Container>
-            <SettingsList.Group>
-              <SettingsList.ItemIcon icon={BeakerIcon} />
-              <SettingsList.ItemText>
-                <Trans>Notification filters</Trans>
-              </SettingsList.ItemText>
-              <Toggle.Group
-                label={_(msg`Priority notifications`)}
-                type="checkbox"
-                values={priority ? ['enabled'] : []}
-                onChange={onChangePriority}
-                disabled={typeof priority !== 'boolean' || isMutationPending}>
-                <Toggle.Item
-                  name="enabled"
-                  label={_(msg`Enable priority notifications`)}
-                  style={[a.flex_1, a.justify_between]}>
-                  <Toggle.LabelText>
-                    <Trans>Enable priority notifications</Trans>
-                  </Toggle.LabelText>
-                  {!data ? <Loader size="md" /> : <Toggle.Platform />}
-                </Toggle.Item>
-              </Toggle.Group>
-            </SettingsList.Group>
-            <SettingsList.Item>
-              <Admonition type="warning" style={[a.flex_1]}>
-                <Trans>
-                  <Text style={[a.font_bold]}>Experimental:</Text> When this
-                  preference is enabled, you'll only receive reply and quote
-                  notifications from users you follow. We'll continue to add
-                  more controls here over time.
-                </Trans>
-              </Admonition>
-            </SettingsList.Item>
-          </SettingsList.Container>
-        )}
-      </Layout.Content>
-    </Layout.Screen>
-  )
-}