From fbb8e6b8c792c1022e5d80bd279d7a352078cc71 Mon Sep 17 00:00:00 2001 From: Martynas Kazlauskas Date: Fri, 24 Jan 2025 13:47:52 +0200 Subject: [PATCH] feat: always use extension storage ignore posthog feature flag --- .../src/lib/scripts/background/wallet.ts | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/apps/browser-extension-wallet/src/lib/scripts/background/wallet.ts b/apps/browser-extension-wallet/src/lib/scripts/background/wallet.ts index 6ef33caf8c..89db9fd925 100644 --- a/apps/browser-extension-wallet/src/lib/scripts/background/wallet.ts +++ b/apps/browser-extension-wallet/src/lib/scripts/background/wallet.ts @@ -308,26 +308,18 @@ export const extensionStorageStoresFactory: StoresFactory = { }) }; -// Used for migrations to get feature flags, which are enabled per chainId -// This is coupled with WalletManager implementation (getWalletStoreId function) -const getNetworkMagic = (storeName: string) => Number.parseInt(storeName.split('-')[1]) as Cardano.NetworkMagic; - const storesFactory: StoresFactory = { async create(props) { - const featureFlags = await getFeatureFlags(getNetworkMagic(props.name)); - if (isExperimentEnabled(featureFlags, ExperimentName.EXTENSION_STORAGE)) { - const extensionStores = await extensionStorageStoresFactory.create(props); - if (await shouldAttemptWalletStoresMigration(extensionStores)) { - const pouchdbStores = await pouchdbStoresFactory.create(props); - if (await migrateWalletStores(pouchdbStores, extensionStores, logger)) { - // TODO: safe to destroy pouchdb stores on successful migration - // once EXTENSION_STORAGE experiment runs in production for some time - // and we are sure that it's working well - } + const extensionStores = await extensionStorageStoresFactory.create(props); + if (await shouldAttemptWalletStoresMigration(extensionStores)) { + const pouchdbStores = await pouchdbStoresFactory.create(props); + if (await migrateWalletStores(pouchdbStores, extensionStores, logger)) { + // TODO: safe to destroy pouchdb stores on successful migration + // once EXTENSION_STORAGE experiment runs in production for some time + // and we are sure that it's working well } - return extensionStores; } - return pouchdbStoresFactory.create(props); + return extensionStores; } };