Browse Source

feat: complete ActiveDid migration for remaining Vue components

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.
pull/188/head
Matthew Raymer 6 days ago
parent
commit
6da9e14b8a
  1. 6
      src/components/UserNameDialog.vue
  2. 7
      src/views/HelpView.vue
  3. 9
      src/views/ImportAccountView.vue
  4. 6
      src/views/NewEditAccountView.vue
  5. 6
      src/views/QuickActionBvcBeginView.vue
  6. 13
      src/views/SeedBackupView.vue
  7. 11
      src/views/ShareMyContactInfoView.vue
  8. 9
      src/views/TestView.vue

6
src/components/UserNameDialog.vue

@ -95,9 +95,9 @@ export default class UserNameDialog extends Vue {
*/ */
async onClickSaveChanges() { async onClickSaveChanges() {
try { try {
// Get the current active DID to save to user-specific settings // Get activeDid from new active_identity table (ActiveDid migration)
const settings = await this.$accountSettings(); const activeIdentity = await this.$getActiveIdentity();
const activeDid = settings.activeDid; const activeDid = activeIdentity.activeDid;
if (activeDid) { if (activeDid) {
// Save to user-specific settings for the current identity // Save to user-specific settings for the current identity

7
src/views/HelpView.vue

@ -680,7 +680,10 @@ export default class HelpView extends Vue {
try { try {
const settings = await this.$accountSettings(); 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({ await this.$updateSettings({
...settings, ...settings,
finishedOnboarding: false, finishedOnboarding: false,
@ -688,7 +691,7 @@ export default class HelpView extends Vue {
this.$log( this.$log(
"[HelpView] Onboarding reset successfully for DID: " + "[HelpView] Onboarding reset successfully for DID: " +
settings.activeDid, activeIdentity.activeDid,
); );
} }

9
src/views/ImportAccountView.vue

@ -224,13 +224,14 @@ export default class ImportAccountView extends Vue {
); );
// Check what was actually imported // Check what was actually imported
const settings = await this.$accountSettings();
// Check account-specific settings // 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 { try {
await this.$query("SELECT * FROM settings WHERE accountDid = ?", [ await this.$query("SELECT * FROM settings WHERE accountDid = ?", [
settings.activeDid, activeIdentity.activeDid,
]); ]);
} catch (error) { } catch (error) {
// Log error but don't interrupt import flow // Log error but don't interrupt import flow

6
src/views/NewEditAccountView.vue

@ -110,9 +110,9 @@ export default class NewEditAccountView extends Vue {
* @async * @async
*/ */
async onClickSaveChanges() { async onClickSaveChanges() {
// Get the current active DID to save to user-specific settings // Get activeDid from new active_identity table (ActiveDid migration)
const settings = await this.$accountSettings(); const activeIdentity = await this.$getActiveIdentity();
const activeDid = settings.activeDid; const activeDid = activeIdentity.activeDid;
if (activeDid) { if (activeDid) {
// Save to user-specific settings for the current identity // Save to user-specific settings for the current identity

6
src/views/QuickActionBvcBeginView.vue

@ -150,7 +150,11 @@ export default class QuickActionBvcBeginView extends Vue {
// Get account settings using PlatformServiceMixin // Get account settings using PlatformServiceMixin
const settings = await this.$accountSettings(); 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 || ""; const apiServer = settings.apiServer || "";
if (!activeDid || !apiServer) { if (!activeDid || !apiServer) {

13
src/views/SeedBackupView.vue

@ -206,8 +206,10 @@ export default class SeedBackupView extends Vue {
async created() { async created() {
try { try {
let activeDid = ""; 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.numAccounts = await retrieveAccountCount();
this.activeAccount = await retrieveFullyDecryptedAccount(activeDid); 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 // Update the account setting to track that user has backed up their seed
try { try {
const settings = await this.$accountSettings(); // Get activeDid from new active_identity table (ActiveDid migration)
if (settings.activeDid) { const activeIdentity = await this.$getActiveIdentity();
await this.$saveUserSettings(settings.activeDid, { if (activeIdentity.activeDid) {
await this.$saveUserSettings(activeIdentity.activeDid, {
hasBackedUpSeed: true, hasBackedUpSeed: true,
}); });
} }

11
src/views/ShareMyContactInfoView.vue

@ -91,7 +91,7 @@ export default class ShareMyContactInfoView extends Vue {
try { try {
const settings = await this.$accountSettings(); const settings = await this.$accountSettings();
const account = await this.retrieveAccount(settings); const account = await this.retrieveAccount();
if (!account) { if (!account) {
this.showAccountError(); this.showAccountError();
@ -113,10 +113,11 @@ export default class ShareMyContactInfoView extends Vue {
/** /**
* Retrieve the fully decrypted account for the active DID * Retrieve the fully decrypted account for the active DID
*/ */
private async retrieveAccount( private async retrieveAccount(): Promise<Account | undefined> {
settings: Settings, // Get activeDid from new active_identity table (ActiveDid migration)
): Promise<Account | undefined> { const activeIdentity = await this.$getActiveIdentity();
const activeDid = settings.activeDid || ""; const activeDid = activeIdentity.activeDid || "";
if (!activeDid) { if (!activeDid) {
return undefined; return undefined;
} }

9
src/views/TestView.vue

@ -643,8 +643,11 @@ export default class Help extends Vue {
logger.info("[TestView] 📥 Loading account settings..."); logger.info("[TestView] 📥 Loading account settings...");
const settings = await this.$accountSettings(); const settings = await this.$accountSettings();
// Get activeDid from new active_identity table (ActiveDid migration)
const activeIdentity = await this.$getActiveIdentity();
logger.info("[TestView] 📊 Settings loaded:", { logger.info("[TestView] 📊 Settings loaded:", {
activeDid: settings.activeDid, activeDid: activeIdentity.activeDid,
apiServer: settings.apiServer, apiServer: settings.apiServer,
partnerApiServer: settings.partnerApiServer, partnerApiServer: settings.partnerApiServer,
isRegistered: settings.isRegistered, isRegistered: settings.isRegistered,
@ -652,10 +655,6 @@ export default class Help extends Vue {
}); });
// Update component state // 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.activeDid = activeIdentity.activeDid || "";
this.apiServer = settings.apiServer || ""; this.apiServer = settings.apiServer || "";

Loading…
Cancel
Save