diff --git a/src/views/ClaimAddRawView.vue b/src/views/ClaimAddRawView.vue index ca7de046..8784c7ef 100644 --- a/src/views/ClaimAddRawView.vue +++ b/src/views/ClaimAddRawView.vue @@ -112,8 +112,7 @@ export default class ClaimAddRawView extends Vue { */ private async initializeSettings() { const settings = await this.$accountSettings(); - // Use new façade method with legacy fallback - this.activeDid = (await this.$getActiveDid()) || ""; + this.activeDid = settings.activeDid || ""; this.apiServer = settings.apiServer || ""; } diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 5388f53e..4aa3523d 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -538,8 +538,7 @@ export default class HomeView extends Vue { // **CRITICAL**: Ensure correct API server for platform await this.ensureCorrectApiServer(); - // Use new façade method with legacy fallback - this.activeDid = (await this.$getActiveDid()) || ""; + this.activeDid = settings.activeDid || ""; // Load contacts with graceful fallback try { diff --git a/src/views/IdentitySwitcherView.vue b/src/views/IdentitySwitcherView.vue index fc63f8ff..3dcc6972 100644 --- a/src/views/IdentitySwitcherView.vue +++ b/src/views/IdentitySwitcherView.vue @@ -46,7 +46,7 @@
No Identity @@ -116,7 +116,6 @@ import { NOTIFY_DELETE_IDENTITY_CONFIRM, } from "@/constants/notifications"; import { Account } from "@/db/tables/accounts"; -import { FLAGS } from "@/config/featureFlags"; @Component({ components: { QuickNav }, @@ -201,8 +200,7 @@ export default class IdentitySwitcherView extends Vue { async created() { try { const settings = await this.$accountSettings(); - // Use new façade method with legacy fallback - this.activeDid = (await this.$getActiveDid()) || ""; + this.activeDid = settings.activeDid || ""; this.apiServer = settings.apiServer || ""; this.apiServerInput = settings.apiServer || ""; @@ -223,63 +221,46 @@ export default class IdentitySwitcherView extends Vue { } } - async switchIdentity(did?: string) { - try { - if (did) { - // Use new façade method instead of legacy settings - await this.$setActiveDid(did); - - // Update local state - this.activeDid = did; - - // Legacy fallback - remove after Phase C - if (!FLAGS.USE_ACTIVE_IDENTITY_ONLY) { - await this.$saveSettings({ activeDid: did }); - } + async switchAccount(did?: string) { + // Save the new active DID to master settings + await this.$saveSettings({ activeDid: did }); - // Check if we need to load user-specific settings for the new DID - try { - const newSettings = await this.$accountSettings(did); - logger.info( - "[IdentitySwitcher Settings Trace] ✅ New account settings loaded", - { - did, - settingsKeys: Object.keys(newSettings).filter( - (k) => - k in newSettings && - newSettings[k as keyof typeof newSettings] !== undefined, - ), - }, - ); - } catch (error) { - logger.warn( - "[IdentitySwitcher Settings Trace] ⚠️ Error loading new account settings", - { - did, - error: error instanceof Error ? error.message : String(error), - }, - ); - // Handle error silently - user settings will be loaded when needed - } - } else { - // Handle "No Identity" case - this.activeDid = ""; - // Note: We don't clear active DID in database for safety + // Check if we need to load user-specific settings for the new DID + if (did) { + try { + const newSettings = await this.$accountSettings(did); + logger.info( + "[IdentitySwitcher Settings Trace] ✅ New account settings loaded", + { + did, + settingsKeys: Object.keys(newSettings).filter( + (k) => + k in newSettings && + newSettings[k as keyof typeof newSettings] !== undefined, + ), + }, + ); + } catch (error) { + logger.warn( + "[IdentitySwitcher Settings Trace] ⚠️ Error loading new account settings", + { + did, + error: error instanceof Error ? error.message : String(error), + }, + ); + // Handle error silently - user settings will be loaded when needed } + } - logger.info( - "[IdentitySwitcher Settings Trace] 🔄 Navigating to home to trigger watcher", - { - newDid: did, - }, - ); + logger.info( + "[IdentitySwitcher Settings Trace] 🔄 Navigating to home to trigger watcher", + { + newDid: did, + }, + ); - // Navigate to home page to trigger the watcher - this.$router.push({ name: "home" }); - } catch (error) { - logger.error("[IdentitySwitcher] Error switching identity", error); - this.notify.error("Error switching identity", TIMEOUTS.SHORT); - } + // Navigate to home page to trigger the watcher + this.$router.push({ name: "home" }); } async deleteAccount(id: string) { diff --git a/src/views/ImportDerivedAccountView.vue b/src/views/ImportDerivedAccountView.vue index 371a0e33..9127326b 100644 --- a/src/views/ImportDerivedAccountView.vue +++ b/src/views/ImportDerivedAccountView.vue @@ -173,13 +173,8 @@ export default class ImportAccountView extends Vue { try { await saveNewIdentity(newId, mne, newDerivPath); - // record that as the active DID using new façade - await this.$setActiveDid(newId.did); - - // Legacy fallback - remove after Phase C - if (!FLAGS.USE_ACTIVE_IDENTITY_ONLY) { - await this.$saveSettings({ activeDid: newId.did }); - } + // record that as the active DID + await this.$saveSettings({ activeDid: newId.did }); await this.$saveUserSettings(newId.did, { isRegistered: false, });