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 5 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() {
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

7
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,
);
}

9
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

6
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

6
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) {

13
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,
});
}

11
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<Account | undefined> {
const activeDid = settings.activeDid || "";
private async retrieveAccount(): Promise<Account | undefined> {
// Get activeDid from new active_identity table (ActiveDid migration)
const activeIdentity = await this.$getActiveIdentity();
const activeDid = activeIdentity.activeDid || "";
if (!activeDid) {
return undefined;
}

9
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 || "";

Loading…
Cancel
Save