forked from trent_larson/crowd-funder-for-time-pwa
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 || "";
|
||||
|
||||
Reference in New Issue
Block a user