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>
This commit is contained in:
@@ -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
|
||||
|
||||
+13
-11
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user