Skip to content

Commit

Permalink
app: Migrate the old taggedNowPlaying overlay type
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Nov 19, 2020
1 parent 80dc62c commit eead1df
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
29 changes: 29 additions & 0 deletions src/main/configMigrations.ts
@@ -0,0 +1,29 @@
import {set} from 'mobx';

import store from 'src/shared/store';

/**
* There may be some situations where we have to implement migrations of the
* users configuration as they upgrade versiosns. These migrations will live
* here.
*/
export function runConfigMigrations() {
/**
* 11-19-20
*
* Migrate old 'taggedNowPlaying' overlay configurations to the new themeable
* nowPlaying overlay type.
*/
(() => {
const overlay = store.config.overlays.find(
overlay => overlay.type == 'taggedNowPlaying'
);

if (overlay === undefined) {
return;
}

set(overlay, {type: 'nowPlaying'});
set(overlay.config, {theme: 'modern'});
})();
}
8 changes: 5 additions & 3 deletions src/main/main.ts
Expand Up @@ -8,11 +8,12 @@ import {bringOnline, NetworkState, ProlinkNetwork} from 'prolink-connect';
import isDev from 'electron-is-dev';
import {set} from 'mobx';

import {startOverlayServer} from 'main/overlayServer';
import {registerMainIpc, observeStore, loadMainConfig} from 'src/shared/store/ipc';
import connectNetworkStore from 'src/shared/store/network';
import store from 'src/shared/store';
import connectNetworkStore from 'src/shared/store/network';
import {registerMainIpc, observeStore, loadMainConfig} from 'src/shared/store/ipc';
import {startOverlayServer} from 'main/overlayServer';
import {registerDebuggingEventsService} from 'src/main/debugEvents';
import {runConfigMigrations} from 'src/main/configMigrations';

// Update the store with user details ASAP
(async () => set(store, {user: await userInfo}))();
Expand Down Expand Up @@ -67,6 +68,7 @@ app.on('ready', async () => {

await loadMainConfig();
registerMainIpc();
runConfigMigrations();
observeStore();

let network: ProlinkNetwork;
Expand Down

0 comments on commit eead1df

Please sign in to comment.