From 6da9e14b8a76da00a8296bb3ff2fbc595a88ca50 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Thu, 11 Sep 2025 02:01:39 +0000 Subject: [PATCH] feat: complete ActiveDid migration for remaining Vue components MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace `settings.activeDid` with `$getActiveIdentity()` API call across 8 components. All Vue components now use the new active_identity table pattern. Components migrated: - TestView.vue: Update logging to use new pattern consistently - ShareMyContactInfoView.vue: Refactor retrieveAccount method signature - UserNameDialog.vue: Update user settings save logic - SeedBackupView.vue: Update both created() and revealSeed() methods - HelpView.vue: Update onboarding reset functionality - ImportAccountView.vue: Update post-import settings check - NewEditAccountView.vue: Update account save logic - QuickActionBvcBeginView.vue: Update BVC recording functionality ✅ TypeScript compilation passes ✅ Linting standards met ✅ Functionality preserved across all components Part of ActiveDid migration following "One Component + Test Pattern". All Vue components now use centralized active_identity table. --- src/components/UserNameDialog.vue | 6 +++--- src/views/HelpView.vue | 7 +++++-- src/views/ImportAccountView.vue | 9 +++++---- src/views/NewEditAccountView.vue | 6 +++--- src/views/QuickActionBvcBeginView.vue | 6 +++++- src/views/SeedBackupView.vue | 13 ++++++++----- src/views/ShareMyContactInfoView.vue | 11 ++++++----- src/views/TestView.vue | 9 ++++----- 8 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/components/UserNameDialog.vue b/src/components/UserNameDialog.vue index aefc4e18..1ffd6e6d 100644 --- a/src/components/UserNameDialog.vue +++ b/src/components/UserNameDialog.vue @@ -95,9 +95,9 @@ export default class UserNameDialog extends Vue { */ async onClickSaveChanges() { try { - // Get the current active DID to save to user-specific settings - const settings = await this.$accountSettings(); - const activeDid = settings.activeDid; + // Get activeDid from new active_identity table (ActiveDid migration) + const activeIdentity = await this.$getActiveIdentity(); + const activeDid = activeIdentity.activeDid; if (activeDid) { // Save to user-specific settings for the current identity diff --git a/src/views/HelpView.vue b/src/views/HelpView.vue index 98bd7147..4b816687 100644 --- a/src/views/HelpView.vue +++ b/src/views/HelpView.vue @@ -680,7 +680,10 @@ export default class HelpView extends Vue { try { const settings = await this.$accountSettings(); - if (settings.activeDid) { + // Get activeDid from new active_identity table (ActiveDid migration) + const activeIdentity = await this.$getActiveIdentity(); + + if (activeIdentity.activeDid) { await this.$updateSettings({ ...settings, finishedOnboarding: false, @@ -688,7 +691,7 @@ export default class HelpView extends Vue { this.$log( "[HelpView] Onboarding reset successfully for DID: " + - settings.activeDid, + activeIdentity.activeDid, ); } diff --git a/src/views/ImportAccountView.vue b/src/views/ImportAccountView.vue index d4588423..65e7999a 100644 --- a/src/views/ImportAccountView.vue +++ b/src/views/ImportAccountView.vue @@ -224,13 +224,14 @@ export default class ImportAccountView extends Vue { ); // Check what was actually imported - const settings = await this.$accountSettings(); - // Check account-specific settings - if (settings?.activeDid) { + // Get activeDid from new active_identity table (ActiveDid migration) + const activeIdentity = await this.$getActiveIdentity(); + + if (activeIdentity.activeDid) { try { await this.$query("SELECT * FROM settings WHERE accountDid = ?", [ - settings.activeDid, + activeIdentity.activeDid, ]); } catch (error) { // Log error but don't interrupt import flow diff --git a/src/views/NewEditAccountView.vue b/src/views/NewEditAccountView.vue index d1349e5a..d4fbb9c4 100644 --- a/src/views/NewEditAccountView.vue +++ b/src/views/NewEditAccountView.vue @@ -110,9 +110,9 @@ export default class NewEditAccountView extends Vue { * @async */ async onClickSaveChanges() { - // Get the current active DID to save to user-specific settings - const settings = await this.$accountSettings(); - const activeDid = settings.activeDid; + // Get activeDid from new active_identity table (ActiveDid migration) + const activeIdentity = await this.$getActiveIdentity(); + const activeDid = activeIdentity.activeDid; if (activeDid) { // Save to user-specific settings for the current identity diff --git a/src/views/QuickActionBvcBeginView.vue b/src/views/QuickActionBvcBeginView.vue index 86de2e7b..4293cc1c 100644 --- a/src/views/QuickActionBvcBeginView.vue +++ b/src/views/QuickActionBvcBeginView.vue @@ -150,7 +150,11 @@ export default class QuickActionBvcBeginView extends Vue { // Get account settings using PlatformServiceMixin const settings = await this.$accountSettings(); - const activeDid = settings.activeDid || ""; + + // Get activeDid from new active_identity table (ActiveDid migration) + const activeIdentity = await this.$getActiveIdentity(); + const activeDid = activeIdentity.activeDid || ""; + const apiServer = settings.apiServer || ""; if (!activeDid || !apiServer) { diff --git a/src/views/SeedBackupView.vue b/src/views/SeedBackupView.vue index fb9b7605..90daaaf4 100644 --- a/src/views/SeedBackupView.vue +++ b/src/views/SeedBackupView.vue @@ -206,8 +206,10 @@ export default class SeedBackupView extends Vue { async created() { try { let activeDid = ""; - const settings = await this.$accountSettings(); - activeDid = settings.activeDid || ""; + + // Get activeDid from new active_identity table (ActiveDid migration) + const activeIdentity = await this.$getActiveIdentity(); + activeDid = activeIdentity.activeDid || ""; this.numAccounts = await retrieveAccountCount(); this.activeAccount = await retrieveFullyDecryptedAccount(activeDid); @@ -238,9 +240,10 @@ export default class SeedBackupView extends Vue { // Update the account setting to track that user has backed up their seed try { - const settings = await this.$accountSettings(); - if (settings.activeDid) { - await this.$saveUserSettings(settings.activeDid, { + // Get activeDid from new active_identity table (ActiveDid migration) + const activeIdentity = await this.$getActiveIdentity(); + if (activeIdentity.activeDid) { + await this.$saveUserSettings(activeIdentity.activeDid, { hasBackedUpSeed: true, }); } diff --git a/src/views/ShareMyContactInfoView.vue b/src/views/ShareMyContactInfoView.vue index 6db62fb7..d3b00272 100644 --- a/src/views/ShareMyContactInfoView.vue +++ b/src/views/ShareMyContactInfoView.vue @@ -91,7 +91,7 @@ export default class ShareMyContactInfoView extends Vue { try { const settings = await this.$accountSettings(); - const account = await this.retrieveAccount(settings); + const account = await this.retrieveAccount(); if (!account) { this.showAccountError(); @@ -113,10 +113,11 @@ export default class ShareMyContactInfoView extends Vue { /** * Retrieve the fully decrypted account for the active DID */ - private async retrieveAccount( - settings: Settings, - ): Promise { - const activeDid = settings.activeDid || ""; + private async retrieveAccount(): Promise { + // Get activeDid from new active_identity table (ActiveDid migration) + const activeIdentity = await this.$getActiveIdentity(); + const activeDid = activeIdentity.activeDid || ""; + if (!activeDid) { return undefined; } diff --git a/src/views/TestView.vue b/src/views/TestView.vue index a4d0e272..c0c9b04d 100644 --- a/src/views/TestView.vue +++ b/src/views/TestView.vue @@ -643,8 +643,11 @@ export default class Help extends Vue { logger.info("[TestView] 📥 Loading account settings..."); const settings = await this.$accountSettings(); + // Get activeDid from new active_identity table (ActiveDid migration) + const activeIdentity = await this.$getActiveIdentity(); + logger.info("[TestView] 📊 Settings loaded:", { - activeDid: settings.activeDid, + activeDid: activeIdentity.activeDid, apiServer: settings.apiServer, partnerApiServer: settings.partnerApiServer, isRegistered: settings.isRegistered, @@ -652,10 +655,6 @@ export default class Help extends Vue { }); // Update component state - - // Get activeDid from active_identity table (single source of truth) - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const activeIdentity = await (this as any).$getActiveIdentity(); this.activeDid = activeIdentity.activeDid || ""; this.apiServer = settings.apiServer || "";