-
Notifications
You must be signed in to change notification settings - Fork 10
VIDSOL-269: Persist device preference in localStorage #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -229,6 +229,9 @@ const usePreviewPublisher = (): PreviewPublisherContextType => { | |||||
| if (publisherRef.current) { | ||||||
| return; | ||||||
| } | ||||||
| // We reset user preferences as we want to start with both devices enabled | ||||||
| setStorageItem(STORAGE_KEYS.AUDIO_SOURCE_ENABLED, 'true'); | ||||||
| setStorageItem(STORAGE_KEYS.VIDEO_SOURCE_ENABLED, 'true'); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| // Set videoFilter based on user's selected background | ||||||
| let videoFilter: VideoFilter | undefined; | ||||||
|
|
@@ -283,6 +286,7 @@ const usePreviewPublisher = (): PreviewPublisherContextType => { | |||||
| return; | ||||||
| } | ||||||
| publisherRef.current.publishVideo(!isVideoEnabled); | ||||||
| setStorageItem(STORAGE_KEYS.VIDEO_SOURCE_ENABLED, isVideoEnabled ? 'true' : 'false'); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
No need to add conversion, automatically done by setStorageItem. |
||||||
| setIsVideoEnabled(!isVideoEnabled); | ||||||
| if (setUser) { | ||||||
| setUser((prevUser: UserType) => ({ | ||||||
|
|
@@ -307,6 +311,7 @@ const usePreviewPublisher = (): PreviewPublisherContextType => { | |||||
| } | ||||||
| publisherRef.current.publishAudio(!isAudioEnabled); | ||||||
| setIsAudioEnabled(!isAudioEnabled); | ||||||
| setStorageItem(STORAGE_KEYS.AUDIO_SOURCE_ENABLED, isAudioEnabled ? 'true' : 'false'); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
No need to add conversion, automatically done by setStorageItem. |
||||||
| if (setUser) { | ||||||
| setUser((prevUser: UserType) => ({ | ||||||
| ...prevUser, | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ import usePublisherQuality, { NetworkQuality } from '../usePublisherQuality/useP | |||||
| import usePublisherOptions from '../usePublisherOptions'; | ||||||
| import useSessionContext from '../../../hooks/useSessionContext'; | ||||||
| import applyBackgroundFilter from '../../../utils/backgroundFilter/applyBackgroundFilter/applyBackgroundFilter'; | ||||||
| import { setStorageItem, STORAGE_KEYS } from '../../../utils/storage'; | ||||||
|
|
||||||
| type PublisherStreamCreatedEvent = Event<'streamCreated', Publisher> & { | ||||||
| stream: Stream; | ||||||
|
|
@@ -291,6 +292,7 @@ const usePublisher = (): PublisherContextType => { | |||||
| } | ||||||
| publisherRef.current.publishVideo(!isVideoEnabled); | ||||||
| setIsVideoEnabled(!isVideoEnabled); | ||||||
| setStorageItem(STORAGE_KEYS.VIDEO_SOURCE_ENABLED, isVideoEnabled ? 'true' : 'false'); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
No need to add conversion, automatically done by setStorageItem. |
||||||
| }; | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -305,6 +307,7 @@ const usePublisher = (): PublisherContextType => { | |||||
| } | ||||||
| publisherRef.current.publishAudio(!isAudioEnabled); | ||||||
| setIsAudioEnabled(!isAudioEnabled); | ||||||
| setStorageItem(STORAGE_KEYS.AUDIO_SOURCE_ENABLED, isAudioEnabled ? 'true' : 'false'); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| setIsForceMuted(false); | ||||||
| }; | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.