about summary refs log tree commit diff
path: root/src/lib/routes
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/lib/routes
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/lib/routes')
-rw-r--r--src/lib/routes/router.ts6
-rw-r--r--src/lib/routes/types.ts24
2 files changed, 16 insertions, 14 deletions
diff --git a/src/lib/routes/router.ts b/src/lib/routes/router.ts
index ba76b1bda..c74192f29 100644
--- a/src/lib/routes/router.ts
+++ b/src/lib/routes/router.ts
@@ -1,8 +1,8 @@
 import {type Route, type RouteParams} from './types'
 
-export class Router {
+export class Router<T extends Record<string, any>> {
   routes: [string, Route][] = []
-  constructor(description: Record<string, string | string[]>) {
+  constructor(description: Record<keyof T, string | string[]>) {
     for (const [screen, pattern] of Object.entries(description)) {
       if (typeof pattern === 'string') {
         this.routes.push([screen, createRoute(pattern)])
@@ -14,7 +14,7 @@ export class Router {
     }
   }
 
-  matchName(name: string): Route | undefined {
+  matchName(name: keyof T | (string & {})): Route | undefined {
     for (const [screenName, route] of this.routes) {
       if (screenName === name) {
         return route
diff --git a/src/lib/routes/types.ts b/src/lib/routes/types.ts
index f58742390..c92be34c2 100644
--- a/src/lib/routes/types.ts
+++ b/src/lib/routes/types.ts
@@ -52,7 +52,18 @@ export type CommonNavigatorParams = {
   AccountSettings: undefined
   PrivacyAndSecuritySettings: undefined
   ContentAndMediaSettings: undefined
-  SettingsInterests: undefined
+  NotificationSettings: undefined
+  ReplyNotificationSettings: undefined
+  MentionNotificationSettings: undefined
+  QuoteNotificationSettings: undefined
+  LikeNotificationSettings: undefined
+  RepostNotificationSettings: undefined
+  NewFollowerNotificationSettings: undefined
+  LikesOnRepostsNotificationSettings: undefined
+  RepostsOnRepostsNotificationSettings: undefined
+  ActivityNotificationSettings: undefined
+  MiscellaneousNotificationSettings: undefined
+  InterestsSettings: undefined
   AboutSettings: undefined
   AppIconSettings: undefined
   Search: {q?: string}
@@ -61,7 +72,7 @@ export type CommonNavigatorParams = {
   MessagesConversation: {conversation: string; embed?: string; accept?: true}
   MessagesSettings: undefined
   MessagesInbox: undefined
-  NotificationSettings: undefined
+  LegacyNotificationSettings: undefined
   Feeds: undefined
   Start: {name: string; rkey: string}
   StarterPack: {name: string; rkey: string; new?: boolean}
@@ -104,8 +115,6 @@ export type FlatNavigatorParams = CommonNavigatorParams & {
   Search: {q?: string}
   Feeds: undefined
   Notifications: undefined
-  Hashtag: {tag: string; author?: string}
-  Topic: {topic: string}
   Messages: {pushToConversation?: string; animation?: 'push' | 'pop'}
 }
 
@@ -118,15 +127,8 @@ export type AllNavigatorParams = CommonNavigatorParams & {
   NotificationsTab: undefined
   Notifications: undefined
   MyProfileTab: undefined
-  Hashtag: {tag: string; author?: string}
-  Topic: {topic: string}
   MessagesTab: undefined
   Messages: {animation?: 'push' | 'pop'}
-  Start: {name: string; rkey: string}
-  StarterPack: {name: string; rkey: string; new?: boolean}
-  StarterPackShort: {code: string}
-  StarterPackWizard: undefined
-  StarterPackEdit: {rkey?: string}
 }
 
 // NOTE