Skip to content

Commit 440ff46

Browse files
committed
feat(plugins/better-calls): add versioning to storage
1 parent d9fd3a6 commit 440ff46

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

plugins/better-calls/src/index.tsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,23 @@ import {
1111
showAudioOutputDevicesSelectionSheet,
1212
} from './utils'
1313

14-
export type PluginStorage = {
15-
silentCall: {
16-
enabled: boolean
17-
users: Record<string, boolean>
18-
}
19-
rememberOutputDevice: {
20-
enabled: boolean
21-
device?: AudioDevice
14+
export type PluginStorageVersions = {
15+
2: {
16+
v: 2
17+
silentCall: {
18+
enabled: boolean
19+
users: Record<string, boolean>
20+
}
21+
rememberOutputDevice: {
22+
enabled: boolean
23+
device?: AudioDevice
24+
}
2225
}
2326
}
2427

25-
export const vstorage = storage as {
26-
silentCall: {
27-
enabled: boolean
28-
users: Record<string, boolean>
29-
}
30-
rememberOutputDevice: {
31-
enabled: boolean
32-
device?: AudioDevice
33-
}
34-
}
28+
export type PluginStorage = PluginStorageVersions[2]
29+
30+
export const vstorage = storage as PluginStorage
3531

3632
export const unpatches: {
3733
silentCall: UnpatchFunction[]
@@ -165,6 +161,8 @@ export default {
165161

166162
// TODO: Maybe force rerender of PrivateChannelButtons
167163
function onModuleStatusUpdate(_firstRun?: boolean) {
164+
vstorage.v ??= 2
165+
168166
vstorage.silentCall ??= {
169167
enabled: true,
170168
users: {},

0 commit comments

Comments
 (0)