Skip to content
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

feat(iridium): add settings manager #3946

Merged
merged 23 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5ad6f05
feat(iridium): add settings manager
jasonwoodland Jul 11, 2022
b37e440
refactor(iridium): instantiate managers in constructor
jasonwoodland Jul 11, 2022
8ad6411
feat(iridium): add settings to iridium manager
jasonwoodland Jul 11, 2022
910eb16
feat(settings): use iridium settings manager
jasonwoodland Jul 11, 2022
1b25c88
feat(theme): use iridium theme settings
jasonwoodland Jul 11, 2022
ed0dc63
chore(store): remove old theme types/definitions
jasonwoodland Jul 11, 2022
c4e4201
feat(iridium): add init method for profile/group managers
jasonwoodland Jul 11, 2022
cead938
feat(theme): generate rgb color values for selection
jasonwoodland Jul 12, 2022
50870ab
feat(settings): move flip local video setting to iridium
jasonwoodland Jul 12, 2022
0b89745
chore(build): add deepmerge package
jasonwoodland Jul 13, 2022
5cb3b5b
feat(merge): add deepmerge utility function
jasonwoodland Jul 13, 2022
1247065
feat(settings): deep merge initial state
jasonwoodland Jul 13, 2022
d6f8bc4
feat(settings/audio): add notification sounds to settings
jasonwoodland Jul 13, 2022
8edf345
feat(iridium): add keybinds to settings
jasonwoodland Jul 13, 2022
b4dd9c2
feat(settings): connect keybinds to iridium
jasonwoodland Jul 13, 2022
aabf26f
style(settings): use record for object types
jasonwoodland Jul 13, 2022
814e815
feat(iridium): add privacy to settings
jasonwoodland Jul 13, 2022
2385e09
feat(settings): connect privacy to iridium
jasonwoodland Jul 13, 2022
6d8d5b3
refactor(settings): iterate over enum to generate initial state
jasonwoodland Jul 13, 2022
1e53f5f
fix(build): bump @nuxtjs/eslint-config-typescript version
jasonwoodland Jul 14, 2022
d376712
style: organise imports
jasonwoodland Jul 14, 2022
9206552
fix(settings): only set in iridium if the value was changed
jasonwoodland Jul 14, 2022
d43261a
fix(settings/audio): default values keys
jasonwoodland Jul 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/styles/framework/colors.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@satellite-color: #2761fd;
@satellite-color-secondary: #286cfe;
@satellite-color-rgb: 'rgb(39, 97, 253)';
@satellite-color-rgb: 39, 97, 253;
@flair-color: var(--flair-color);
@flair-color-secondary: var(--flair-color-secondary);
@flair-color-rgb: var(--flair-color-rgb);
Expand Down
2 changes: 1 addition & 1 deletion assets/styles/themes/moonless_night.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.moonless_night {
.theme-moonlessNight {
//------------- Colors -------------
@white: #fff;

Expand Down
2 changes: 1 addition & 1 deletion components/ui/HorizontalRule/HorizontalRule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default Vue.extend({})
.horizontal-container {
padding: @normal-spacing 0;
}
.moonless-night {
.theme-moonlessNight {
.horizontal-rule {
background: @lighter-splash-radial;
}
Expand Down
7 changes: 6 additions & 1 deletion components/views/media/user/User.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { $WebRTC } from '~/libraries/WebRTC/WebRTC'
import { Call, CallPeerStreams } from '~/libraries/WebRTC/Call'
import { PeerMutedState } from '~/store/webrtc/types'
import { RootState } from '~/types/store/store'
import iridium from '~/libraries/Iridium/IridiumManager'

async function loadVideos() {
const videos = document.querySelectorAll(
Expand Down Expand Up @@ -56,12 +57,16 @@ export default Vue.extend({
default: false,
},
},
data() {
return {
videoSettings: iridium.settings.state.video,
}
},
computed: {
...mapState({
audio: (state) => (state as RootState).audio,
video: (state) => (state as RootState).video,
webrtc: (state) => (state as RootState).webrtc,
flipVideo: (state) => (state as RootState).textile.userThread.flipVideo,
}),
call() {
return (
Expand Down
6 changes: 1 addition & 5 deletions components/views/settings/pages/audio/Audio.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
/>
<!--Audio Sources-->
<!-- Requires user permissions to see in most browsers -->
<SettingsSection
v-if="!userHasGivenAudioAccess"
>
<SettingsSection v-if="!userHasGivenAudioAccess">
<SettingsUnit
:title="$t('pages.settings.audio.sources.title')"
:text="$t('pages.settings.audio.sources.subtitle')"
Expand Down Expand Up @@ -170,7 +168,6 @@
</span>
</SettingsUnit>
<SettingsUnit
v-if="getInitialized"
:title="$t('pages.settings.video.flipVideo.title')"
:text="$t('pages.settings.video.flipVideo.subtitle')"
>
Expand All @@ -179,7 +176,6 @@
:isLocked="loading.includes('flipVideo')"
/>
</SettingsUnit>
<UiLoadersGenericContent class="column unit" :count="1" v-else />
</SettingsSection>

<!-- Screen Share -->
Expand Down
10 changes: 5 additions & 5 deletions components/views/settings/pages/audio/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { UserPermissions } from '~/components/mixins/UserPermissions'
import { CaptureMouseTypes } from '~/store/settings/types'
import { RootState } from '~/types/store/store'
import iridium from '~/libraries/Iridium/IridiumManager'

declare module 'vue/types/vue' {
interface Vue {
Expand Down Expand Up @@ -53,6 +54,7 @@ export default Vue.extend({
text: this.$i18n.t('pages.settings.never'),
},
],
iridiumSettings: iridium.settings.state,
}
},
computed: {
Expand Down Expand Up @@ -134,15 +136,13 @@ export default Vue.extend({
},
},
flipVideo: {
async set(flipVideo: boolean) {
async set(value: boolean) {
this.loading.push('flipVideo')
await this.$store.dispatch('textile/updateUserThreadData', {
flipVideo,
})
await iridium.settings.set('/video/flipLocalStream', value)
this.loading.splice(this.loading.indexOf('flipVideo'), 1)
},
get(): boolean {
return this.userThread.flipVideo
return this.iridiumSettings.video.flipLocalStream
},
},
},
Expand Down
12 changes: 6 additions & 6 deletions components/views/settings/pages/audio/sounds/Sounds.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@
:text="$t('pages.settings.notifications.sounds.title')"
/>
<SettingsPagesAudioSoundsItem
:value="sound(Sounds.NEW_MESSAGE)"
:value="sounds[Sounds.NEW_MESSAGE]"
@toggle="toggleSound(Sounds.NEW_MESSAGE, $event)"
:title="$t('pages.settings.notifications.sounds.message')"
/>
<SettingsPagesAudioSoundsItem
:value="sound(Sounds.CALL)"
:value="sounds[Sounds.CALL]"
@toggle="toggleSound(Sounds.CALL, $event)"
:title="$t('pages.settings.notifications.sounds.call')"
/>
<SettingsPagesAudioSoundsItem
:value="sound(Sounds.MUTE)"
:value="sounds[Sounds.MUTE]"
@toggle="toggleSounds([Sounds.MUTE, Sounds.UNMUTE], $event)"
:title="$t('pages.settings.notifications.sounds.mute')"
/>
<SettingsPagesAudioSoundsItem
:value="sound(Sounds.DEAFEN)"
:value="sounds[Sounds.DEAFEN]"
@toggle="toggleSounds([Sounds.DEAFEN, Sounds.UNDEAFEN], $event)"
:title="$t('pages.settings.notifications.sounds.deafen')"
/>
<SettingsPagesAudioSoundsItem
:value="sound(Sounds.UPLOAD)"
:value="sounds[Sounds.UPLOAD]"
@toggle="toggleSound(Sounds.UPLOAD, $event)"
:title="$t('pages.settings.notifications.sounds.upload')"
/>
<SettingsPagesAudioSoundsItem
:value="sound(Sounds.CONNECTED)"
:value="sounds[Sounds.CONNECTED]"
@toggle="toggleSound(Sounds.CONNECTED, $event)"
:title="$t('pages.settings.notifications.sounds.connected')"
/>
Expand Down
19 changes: 9 additions & 10 deletions components/views/settings/pages/audio/sounds/Sounds.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,30 @@

<script lang="ts">
import Vue from 'vue'
import { mapState } from 'vuex'
import { Sounds } from '~/libraries/SoundManager/SoundManager'
import iridium from '~/libraries/Iridium/IridiumManager'

export default Vue.extend({
name: 'NotificationsSettingsSounds',
layout: 'sounds',
data() {
return {
Sounds,
audioSettings: iridium.settings.state.audio,
}
},
computed: {
...mapState(['sounds']),
sounds() {
return this.audioSettings.sounds
},
},
mounted() {},
methods: {
sound(key: Sounds) {
return this.sounds[key]
},
toggleSound(key: Sounds, value: boolean) {
this.$store.commit('sounds/set', { key, value })
toggleSound(key: Sounds, isEnabled: boolean) {
this.audioSettings.sounds[key] = isEnabled
},
toggleSounds(keys: Sounds[], value: boolean) {
toggleSounds(keys: Sounds[], isEnabled: boolean) {
for (const key of keys) {
this.$store.commit('sounds/set', { key, value })
this.audioSettings.sounds[key] = isEnabled
}
},
},
Expand Down
8 changes: 4 additions & 4 deletions components/views/settings/pages/keybinds/Keybinds.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@
<InteractablesInput
readonly
type="primary"
:placeholder="settings.keybinds.toggleMute"
:placeholder="keybinds.toggleMute"
/>
</SettingsUnit>
<SettingsUnit @click="editKeybind('openSettings')">
<TypographyLabel :text="$t('pages.settings.keybinds.settings')" />
<InteractablesInput
readonly
type="primary"
:placeholder="settings.keybinds.openSettings"
:placeholder="keybinds.openSettings"
/>
</SettingsUnit>
</SettingsSection>
Expand All @@ -71,15 +71,15 @@
<InteractablesInput
readonly
type="primary"
:placeholder="settings.keybinds.toggleDeafen"
:placeholder="keybinds.toggleDeafen"
/>
</SettingsUnit>
<SettingsUnit @click="editKeybind('callActiveChat')">
<TypographyLabel :text="$t('pages.settings.keybinds.call')" />
<InteractablesInput
readonly
type="primary"
:placeholder="settings.keybinds.callActiveChat"
:placeholder="keybinds.callActiveChat"
/>
</SettingsUnit>
</SettingsSection>
Expand Down
Loading