feat: add video loop playback setting

Add a toggle in General Settings to enable/disable video loop playback,
following the same pattern as the existing autoplay setting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
codytseng 2026-02-18 13:55:53 +08:00
parent ae8a534103
commit 481603d0e8
23 changed files with 90 additions and 19 deletions

View file

@ -7,6 +7,9 @@ type TContentPolicyContext = {
autoplay: boolean
setAutoplay: (autoplay: boolean) => void
videoLoop: boolean
setVideoLoop: (videoLoop: boolean) => void
nsfwDisplayPolicy: TNsfwDisplayPolicy
setNsfwDisplayPolicy: (policy: TNsfwDisplayPolicy) => void
@ -40,6 +43,7 @@ export const useContentPolicy = () => {
export function ContentPolicyProvider({ children }: { children: React.ReactNode }) {
const [autoplay, setAutoplay] = useState(storage.getAutoplay())
const [videoLoop, setVideoLoop] = useState(storage.getVideoLoop())
const [nsfwDisplayPolicy, setNsfwDisplayPolicy] = useState(storage.getNsfwDisplayPolicy())
const [hideContentMentioningMutedUsers, setHideContentMentioningMutedUsers] = useState(
storage.getHideContentMentioningMutedUsers()
@ -94,6 +98,11 @@ export function ContentPolicyProvider({ children }: { children: React.ReactNode
setAutoplay(autoplay)
}
const updateVideoLoop = (videoLoop: boolean) => {
storage.setVideoLoop(videoLoop)
setVideoLoop(videoLoop)
}
const updateNsfwDisplayPolicy = (policy: TNsfwDisplayPolicy) => {
storage.setNsfwDisplayPolicy(policy)
setNsfwDisplayPolicy(policy)
@ -129,6 +138,8 @@ export function ContentPolicyProvider({ children }: { children: React.ReactNode
value={{
autoplay,
setAutoplay: updateAutoplay,
videoLoop,
setVideoLoop: updateVideoLoop,
nsfwDisplayPolicy,
setNsfwDisplayPolicy: updateNsfwDisplayPolicy,
hideContentMentioningMutedUsers,