@@ -7,15 +7,9 @@ import { lockDevice } from '@suite/locks';
77import {
88 metadataActions ,
99 metadataLabelingActions ,
10- selectHasLegacyLabelsMigrated ,
11- selectIsMetadataEnabled ,
1210 selectLabelingDataForAccount ,
13- selectSelectedProviderForLabels ,
1411} from '@suite/metadata' ;
15- import {
16- createEnsureWalletSuiteSyncOnWithMigration ,
17- createMetadataMigrationCompositionRoot ,
18- } from '@suite/metadata-migration' ;
12+ import { createMetadataMigrationCompositionRoot } from '@suite/metadata-migration' ;
1913import type { MetadataMigrationDep } from '@suite/metadata-migration' ;
2014import { closeModal , openModal } from '@suite/modal' ;
2115import {
@@ -48,7 +42,6 @@ import {
4842 selectIsSuiteSyncEnabled ,
4943 selectSuiteSyncWalletLabel ,
5044} from '@suite-common/suite-sync' ;
51- import { type SuiteSync } from '@suite-common/suite-sync-types' ;
5245import {
5346 type TokenDefinitionsState ,
5447 buildTokenDefinitionsFromStorage ,
@@ -115,22 +108,7 @@ export const createSuiteServicesCompositionRoot = (deps: SuiteAppDeps): SuiteSer
115108
116109 const analytics = createAnalytics ( ) ;
117110
118- const getCurrentAccountLabels = toGetter ( deps . getState , selectAllLabelsForAccount ) ;
119- const getAccountsByDeviceState = toGetter ( deps . getState , selectAccountsByDeviceState ) ;
120- const migrateLegacyLabelsToSuiteSyncRef : {
121- current : MetadataMigrationDep [ 'migrateLegacyLabelsToSuiteSync' ] | undefined ;
122- } = { current : undefined } ;
123-
124- const createDecoratedEnsureWalletSuiteSyncOn = createEnsureWalletSuiteSyncOnWithMigration ( {
125- dispatch : deps . dispatch ,
126- getMigrateLegacyLabelsToSuiteSync : ( ) => migrateLegacyLabelsToSuiteSyncRef . current ,
127- getIsMetadataEnabled : toGetter ( deps . getState , selectIsMetadataEnabled ) ,
128- getSelectedProviderForLabels : toGetter ( deps . getState , selectSelectedProviderForLabels ) ,
129- getHasLegacyLabelsMigrated : toGetter ( deps . getState , selectHasLegacyLabelsMigrated ) ,
130- getDeviceByStaticSessionId : toGetter ( deps . getState , selectDeviceByStaticSessionId ) ,
131- } ) ;
132-
133- const suiteSync : SuiteSync = createSuiteSyncDesktopCompositionRoot ( {
111+ const suiteSync = createSuiteSyncDesktopCompositionRoot ( {
134112 dispatch : deps . dispatch ,
135113 getState : deps . getState ,
136114 platformEncryption : deps . platformEncryption ,
@@ -144,18 +122,23 @@ export const createSuiteServicesCompositionRoot = (deps: SuiteAppDeps): SuiteSer
144122 dispatch : deps . dispatch ,
145123 deviceStaticSessionId : device ?. state ?. staticSessionId ?? null ,
146124 } ) ,
147- createDecoratedEnsureWalletSuiteSyncOn,
148125 } ) ;
149126
150- const { migrateLegacyLabelsToSuiteSync } = createMetadataMigrationCompositionRoot ( {
151- getState : deps . getState ,
152- getAccountsByDeviceState,
153- getCurrentWalletLabel : toGetter ( deps . getState , selectSuiteSyncWalletLabel ) ,
154- getCurrentAccountLabels,
155- labeling : suiteSync . labeling ,
156- } ) ;
127+ const getCurrentAccountLabels = toGetter ( deps . getState , selectAllLabelsForAccount ) ;
128+ const getAccountsByDeviceState = toGetter ( deps . getState , selectAccountsByDeviceState ) ;
129+
130+ const { ensureWalletSuiteSyncOnWithMigration, migrateLegacyLabelsToSuiteSync } =
131+ createMetadataMigrationCompositionRoot ( {
132+ dispatch : deps . dispatch ,
133+ getState : deps . getState ,
134+ getAccountsByDeviceState,
135+ getCurrentWalletLabel : toGetter ( deps . getState , selectSuiteSyncWalletLabel ) ,
136+ getCurrentAccountLabels,
137+ getDeviceByStaticSessionId : toGetter ( deps . getState , selectDeviceByStaticSessionId ) ,
138+ labeling : suiteSync . labeling ,
139+ } ) ;
157140
158- migrateLegacyLabelsToSuiteSyncRef . current = migrateLegacyLabelsToSuiteSync ;
141+ suiteSync . onWalletSuiteSyncOnEnsured ( ensureWalletSuiteSyncOnWithMigration ) ;
159142
160143 const { bip329 } = createBip329CompositionRoot ( {
161144 getIsSuiteSyncEnabled : toGetter ( deps . getState , selectIsSuiteSyncEnabled ) ,
0 commit comments