Revert "feat: migrate phase 1 critical identity components to active identity façade"

This reverts commit 09e6a7107a.
This commit is contained in:
Matthew Raymer
2025-08-22 11:24:58 +00:00
parent cf41665629
commit 6c1c109cbd
4 changed files with 44 additions and 70 deletions

View File

@@ -112,8 +112,7 @@ export default class ClaimAddRawView extends Vue {
*/ */
private async initializeSettings() { private async initializeSettings() {
const settings = await this.$accountSettings(); const settings = await this.$accountSettings();
// Use new façade method with legacy fallback this.activeDid = settings.activeDid || "";
this.activeDid = (await this.$getActiveDid()) || "";
this.apiServer = settings.apiServer || ""; this.apiServer = settings.apiServer || "";
} }

View File

@@ -538,8 +538,7 @@ export default class HomeView extends Vue {
// **CRITICAL**: Ensure correct API server for platform // **CRITICAL**: Ensure correct API server for platform
await this.ensureCorrectApiServer(); await this.ensureCorrectApiServer();
// Use new façade method with legacy fallback this.activeDid = settings.activeDid || "";
this.activeDid = (await this.$getActiveDid()) || "";
// Load contacts with graceful fallback // Load contacts with graceful fallback
try { try {

View File

@@ -46,7 +46,7 @@
<div class="flex items-center justify-between mb-2"> <div class="flex items-center justify-between mb-2">
<div <div
:class="identityListItemClasses" :class="identityListItemClasses"
@click="switchIdentity(ident.did)" @click="switchAccount(ident.did)"
> >
<font-awesome <font-awesome
v-if="ident.did === activeDid" v-if="ident.did === activeDid"
@@ -94,7 +94,7 @@
<a <a
href="#" href="#"
:class="secondaryButtonClasses" :class="secondaryButtonClasses"
@click="switchIdentity(undefined)" @click="switchAccount(undefined)"
> >
No Identity No Identity
</a> </a>
@@ -116,7 +116,6 @@ import {
NOTIFY_DELETE_IDENTITY_CONFIRM, NOTIFY_DELETE_IDENTITY_CONFIRM,
} from "@/constants/notifications"; } from "@/constants/notifications";
import { Account } from "@/db/tables/accounts"; import { Account } from "@/db/tables/accounts";
import { FLAGS } from "@/config/featureFlags";
@Component({ @Component({
components: { QuickNav }, components: { QuickNav },
@@ -201,8 +200,7 @@ export default class IdentitySwitcherView extends Vue {
async created() { async created() {
try { try {
const settings = await this.$accountSettings(); const settings = await this.$accountSettings();
// Use new façade method with legacy fallback this.activeDid = settings.activeDid || "";
this.activeDid = (await this.$getActiveDid()) || "";
this.apiServer = settings.apiServer || ""; this.apiServer = settings.apiServer || "";
this.apiServerInput = settings.apiServer || ""; this.apiServerInput = settings.apiServer || "";
@@ -223,63 +221,46 @@ export default class IdentitySwitcherView extends Vue {
} }
} }
async switchIdentity(did?: string) { async switchAccount(did?: string) {
try { // Save the new active DID to master settings
if (did) { await this.$saveSettings({ activeDid: did });
// Use new façade method instead of legacy settings
await this.$setActiveDid(did);
// Update local state // Check if we need to load user-specific settings for the new DID
this.activeDid = did; if (did) {
try {
// Legacy fallback - remove after Phase C const newSettings = await this.$accountSettings(did);
if (!FLAGS.USE_ACTIVE_IDENTITY_ONLY) { logger.info(
await this.$saveSettings({ activeDid: did }); "[IdentitySwitcher Settings Trace] ✅ New account settings loaded",
} {
did,
// Check if we need to load user-specific settings for the new DID settingsKeys: Object.keys(newSettings).filter(
try { (k) =>
const newSettings = await this.$accountSettings(did); k in newSettings &&
logger.info( newSettings[k as keyof typeof newSettings] !== undefined,
"[IdentitySwitcher Settings Trace] ✅ New account settings loaded", ),
{ },
did, );
settingsKeys: Object.keys(newSettings).filter( } catch (error) {
(k) => logger.warn(
k in newSettings && "[IdentitySwitcher Settings Trace] ⚠️ Error loading new account settings",
newSettings[k as keyof typeof newSettings] !== undefined, {
), did,
}, error: error instanceof Error ? error.message : String(error),
); },
} catch (error) { );
logger.warn( // Handle error silently - user settings will be loaded when needed
"[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
} }
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);
} }
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" });
} }
async deleteAccount(id: string) { async deleteAccount(id: string) {

View File

@@ -173,13 +173,8 @@ export default class ImportAccountView extends Vue {
try { try {
await saveNewIdentity(newId, mne, newDerivPath); await saveNewIdentity(newId, mne, newDerivPath);
// record that as the active DID using new façade // record that as the active DID
await this.$setActiveDid(newId.did); await this.$saveSettings({ activeDid: newId.did });
// Legacy fallback - remove after Phase C
if (!FLAGS.USE_ACTIVE_IDENTITY_ONLY) {
await this.$saveSettings({ activeDid: newId.did });
}
await this.$saveUserSettings(newId.did, { await this.$saveUserSettings(newId.did, {
isRegistered: false, isRegistered: false,
}); });