Store sort order and explicit setting to localStorage

vue-cli
Noah 2023-09-07 20:05:52 -07:00
parent d8c92800f3
commit 8853f9882b
2 changed files with 22 additions and 10 deletions

View File

@ -340,6 +340,9 @@ export default {
});
LocalStorage.set('videoScale', this.webcam.videoScale);
},
whoSort() {
LocalStorage.set('whoSort', this.whoSort);
},
fontSizeClass() {
// Store the setting persistently.
LocalStorage.set('fontSizeClass', this.fontSizeClass);
@ -650,34 +653,40 @@ export default {
}
// Webcam mutality preferences from last broadcast.
if (settings.videoMutual === "true") {
if (settings.videoMutual === true) {
this.webcam.mutual = true;
}
if (settings.videoMutualOpen === "true") {
if (settings.videoMutualOpen === true) {
this.webcam.mutualOpen = true;
}
if (settings.videoAutoMute === "true") {
if (settings.videoAutoMute === true) {
this.webcam.autoMute = true;
}
if (settings.videoVipOnly === "true") {
if (settings.videoVipOnly === true) {
this.webcam.vipOnly = true;
}
if (settings.videoExplicit === true) {
this.webcam.nsfw = true;
}
// Misc preferences
if (settings.joinMessages != undefined) {
this.prefs.joinMessages = settings.joinMessages === "true";
this.prefs.joinMessages = settings.joinMessages === true;
}
if (settings.exitMessages != undefined) {
this.prefs.exitMessages = settings.exitMessages === "true";
this.prefs.exitMessages = settings.exitMessages === true;
}
if (settings.watchNotif != undefined) {
this.prefs.watchNotif = settings.watchNotif === "true";
this.prefs.watchNotif = settings.watchNotif === true;
}
if (settings.muteSounds != undefined) {
this.prefs.muteSounds = settings.muteSounds === "true";
this.prefs.muteSounds = settings.muteSounds === true;
}
if (settings.closeDMs != undefined) {
this.prefs.closeDMs = settings.closeDMs === "true";
this.prefs.closeDMs = settings.closeDMs === true;
}
if (settings.whoSort != undefined) {
this.whoSort = settings.whoSort;
}
},
@ -850,7 +859,7 @@ export default {
// The server can set our webcam NSFW flag.
let myNSFW = this.webcam.nsfw;
let theirNSFW = (msg.video & this.VideoFlag.NSFW) > 0;
if (myNSFW != theirNSFW) {
if (this.webcam.active && myNSFW != theirNSFW) {
this.webcam.nsfw = theirNSFW;
}
@ -1693,6 +1702,7 @@ export default {
LocalStorage.set('videoMutualOpen', this.webcam.mutualOpen);
LocalStorage.set('videoAutoMute', this.webcam.autoMute);
LocalStorage.set('videoVipOnly', this.webcam.vipOnly);
LocalStorage.set('videoExplicit', this.webcam.nsfw);
// Auto-mute our camera? Two use cases:
// 1. The user marked their cam as muted but then changed video device,

View File

@ -5,12 +5,14 @@ const keys = {
'imageDisplaySetting': String, // Show/hide/expand image preference
'scrollback': Number, // Scrollback buffer (int)
'preferredDeviceNames': Object, // Webcam/mic device names (object, keys video,audio)
'whoSort': String, // user's preferred sort order for the Who List
// Webcam settings (booleans)
'videoMutual': Boolean,
'videoMutualOpen': Boolean,
'videoAutoMute': Boolean,
'videoVipOnly': Boolean,
'videoExplicit': Boolean, // whether the user turns explicit on by default
// Booleans
'joinMessages': Boolean,