Skip to content

Commit

Permalink
feat(plugins/better-calls): add versioning to storage
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmDevs committed Oct 10, 2024
1 parent d9fd3a6 commit 440ff46
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions plugins/better-calls/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,23 @@ import {
showAudioOutputDevicesSelectionSheet,
} from './utils'

export type PluginStorage = {
silentCall: {
enabled: boolean
users: Record<string, boolean>
}
rememberOutputDevice: {
enabled: boolean
device?: AudioDevice
export type PluginStorageVersions = {
2: {
v: 2
silentCall: {
enabled: boolean
users: Record<string, boolean>
}
rememberOutputDevice: {
enabled: boolean
device?: AudioDevice
}
}
}

export const vstorage = storage as {
silentCall: {
enabled: boolean
users: Record<string, boolean>
}
rememberOutputDevice: {
enabled: boolean
device?: AudioDevice
}
}
export type PluginStorage = PluginStorageVersions[2]

export const vstorage = storage as PluginStorage

export const unpatches: {
silentCall: UnpatchFunction[]
Expand Down Expand Up @@ -165,6 +161,8 @@ export default {

// TODO: Maybe force rerender of PrivateChannelButtons
function onModuleStatusUpdate(_firstRun?: boolean) {
vstorage.v ??= 2

vstorage.silentCall ??= {
enabled: true,
users: {},
Expand Down

0 comments on commit 440ff46

Please sign in to comment.