feat: muted words
This commit is contained in:
parent
3c74c8c5db
commit
603bd35b4a
25 changed files with 282 additions and 87 deletions
|
|
@ -23,6 +23,9 @@ type TContentPolicyContext = {
|
|||
|
||||
faviconUrlTemplate: string
|
||||
setFaviconUrlTemplate: (template: string) => void
|
||||
|
||||
mutedWords: string[]
|
||||
setMutedWords: (words: string[]) => void
|
||||
}
|
||||
|
||||
const ContentPolicyContext = createContext<TContentPolicyContext | undefined>(undefined)
|
||||
|
|
@ -46,6 +49,7 @@ export function ContentPolicyProvider({ children }: { children: React.ReactNode
|
|||
storage.getProfilePictureAutoLoadPolicy()
|
||||
)
|
||||
const [faviconUrlTemplate, setFaviconUrlTemplate] = useState(storage.getFaviconUrlTemplate())
|
||||
const [mutedWords, setMutedWords] = useState(storage.getMutedWords())
|
||||
const [connectionType, setConnectionType] = useState((navigator as any).connection?.type)
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -115,6 +119,11 @@ export function ContentPolicyProvider({ children }: { children: React.ReactNode
|
|||
setFaviconUrlTemplate(template)
|
||||
}
|
||||
|
||||
const updateMutedWords = (words: string[]) => {
|
||||
storage.setMutedWords(words)
|
||||
setMutedWords(words)
|
||||
}
|
||||
|
||||
return (
|
||||
<ContentPolicyContext.Provider
|
||||
value={{
|
||||
|
|
@ -131,7 +140,9 @@ export function ContentPolicyProvider({ children }: { children: React.ReactNode
|
|||
profilePictureAutoLoadPolicy,
|
||||
setProfilePictureAutoLoadPolicy: updateProfilePictureAutoLoadPolicy,
|
||||
faviconUrlTemplate,
|
||||
setFaviconUrlTemplate: updateFaviconUrlTemplate
|
||||
setFaviconUrlTemplate: updateFaviconUrlTemplate,
|
||||
mutedWords,
|
||||
setMutedWords: updateMutedWords
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue