aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/stores/Service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/main/src/stores/Service.ts')
-rw-r--r--packages/main/src/stores/Service.ts21
1 files changed, 8 insertions, 13 deletions
diff --git a/packages/main/src/stores/Service.ts b/packages/main/src/stores/Service.ts
index 78c57cb..331805b 100644
--- a/packages/main/src/stores/Service.ts
+++ b/packages/main/src/stores/Service.ts
@@ -19,18 +19,14 @@
19 */ 19 */
20 20
21import type { UnreadCount } from '@sophie/service-shared'; 21import type { UnreadCount } from '@sophie/service-shared';
22import { 22import { service as originalService } from '@sophie/shared';
23 service as originalService,
24 ServiceSettingsSnapshotIn,
25} from '@sophie/shared';
26import { Instance, getSnapshot, ReferenceIdentifier } from 'mobx-state-tree'; 23import { Instance, getSnapshot, ReferenceIdentifier } from 'mobx-state-tree';
27 24
28import SettingsWithId from '../utils/SettingsWithId';
29import generateId from '../utils/generateId'; 25import generateId from '../utils/generateId';
30import overrideProps from '../utils/overrideProps'; 26import overrideProps from '../utils/overrideProps';
31 27
32import { ProfileSettingsSnapshotWithId } from './Profile'; 28import { ProfileSettingsSnapshotWithId } from './Profile';
33import { serviceSettings } from './ServiceSettings'; 29import { serviceSettings, ServiceSettingsSnapshotIn } from './ServiceSettings';
34 30
35export interface ServiceConfig 31export interface ServiceConfig
36 extends Omit<ServiceSettingsSnapshotIn, 'profile'> { 32 extends Omit<ServiceSettingsSnapshotIn, 'profile'> {
@@ -89,8 +85,7 @@ export const service = overrideProps(originalService, {
89 85
90export interface Service extends Instance<typeof service> {} 86export interface Service extends Instance<typeof service> {}
91 87
92export type ServiceSettingsSnapshotWithId = 88export type ServiceSettingsSnapshotWithId = [string, ServiceSettingsSnapshotIn];
93 SettingsWithId<ServiceSettingsSnapshotIn>;
94 89
95export function addMissingServiceIdsAndProfiles( 90export function addMissingServiceIdsAndProfiles(
96 serviceConfigs: ServiceConfig[] | undefined, 91 serviceConfigs: ServiceConfig[] | undefined,
@@ -102,11 +97,11 @@ export function addMissingServiceIdsAndProfiles(
102 let { profile: profileId } = settings; 97 let { profile: profileId } = settings;
103 if (profileId === undefined) { 98 if (profileId === undefined) {
104 profileId = generateId(name); 99 profileId = generateId(name);
105 profiles.push({ id: profileId, settings: { name } }); 100 profiles.push([profileId, { name }]);
106 } 101 }
107 return { 102 return [
108 id: id === undefined ? generateId(name) : id, 103 id === undefined ? generateId(name) : id,
109 settings: { ...settings, profile: profileId }, 104 { ...settings, profile: profileId },
110 }; 105 ];
111 }); 106 });
112} 107}