|
|
@ -310,7 +310,6 @@ import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin"; |
|
|
|
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify"; |
|
|
|
import { |
|
|
|
NOTIFY_CONTACT_LOADING_ISSUE, |
|
|
|
NOTIFY_FEED_LOADING_ISSUE, |
|
|
|
NOTIFY_CONFIRMATION_ERROR, |
|
|
|
} from "@/constants/notifications"; |
|
|
|
import * as Package from "../../package.json"; |
|
|
@ -486,6 +485,10 @@ export default class HomeView extends Vue { |
|
|
|
if (newDid !== oldDid) { |
|
|
|
// Re-initialize identity with new settings (loads settings internally) |
|
|
|
await this.initializeIdentity(); |
|
|
|
} else { |
|
|
|
logger.info( |
|
|
|
"[HomeView Settings Trace] 📍 DID unchanged, skipping re-initialization", |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -528,11 +531,7 @@ export default class HomeView extends Vue { |
|
|
|
// Load settings with better error context using ultra-concise mixin |
|
|
|
let settings; |
|
|
|
try { |
|
|
|
settings = await this.$settings({ |
|
|
|
apiServer: "", |
|
|
|
activeDid: "", |
|
|
|
isRegistered: false, |
|
|
|
}); |
|
|
|
settings = await this.$accountSettings(); |
|
|
|
} catch (error) { |
|
|
|
this.$logAndConsole( |
|
|
|
`[HomeView] Failed to retrieve settings: ${error}`, |
|
|
@ -600,65 +599,21 @@ export default class HomeView extends Vue { |
|
|
|
// Ultra-concise settings update with automatic cache invalidation! |
|
|
|
await this.$saveMySettings({ isRegistered: true }); |
|
|
|
this.isRegistered = true; |
|
|
|
// Force Vue to re-render the template |
|
|
|
await this.$nextTick(); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
// Consolidate logging: Only log unexpected errors, not expected 400s |
|
|
|
const axiosError = error as any; |
|
|
|
if (axiosError?.response?.status !== 400) { |
|
|
|
this.$logAndConsole( |
|
|
|
`[HomeView] Registration check failed: ${error}`, |
|
|
|
true, |
|
|
|
); |
|
|
|
} |
|
|
|
// Continue as unregistered - this is expected for new users |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Initialize feed and offers |
|
|
|
try { |
|
|
|
// Start feed update in background |
|
|
|
this.updateAllFeed().catch((error) => { |
|
|
|
this.$logAndConsole( |
|
|
|
`[HomeView] Background feed update failed: ${error}`, |
|
|
|
true, |
|
|
|
logger.warn( |
|
|
|
"[HomeView Settings Trace] ⚠️ Registration check failed", |
|
|
|
{ |
|
|
|
error: error instanceof Error ? error.message : String(error), |
|
|
|
}, |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
// Load new offers if we have an active DID |
|
|
|
if (this.activeDid) { |
|
|
|
const [offersToUser, offersToProjects] = await Promise.all([ |
|
|
|
getNewOffersToUser( |
|
|
|
this.axios, |
|
|
|
this.apiServer, |
|
|
|
this.activeDid, |
|
|
|
this.lastAckedOfferToUserJwtId, |
|
|
|
), |
|
|
|
getNewOffersToUserProjects( |
|
|
|
this.axios, |
|
|
|
this.apiServer, |
|
|
|
this.activeDid, |
|
|
|
this.lastAckedOfferToUserProjectsJwtId, |
|
|
|
), |
|
|
|
]); |
|
|
|
|
|
|
|
this.numNewOffersToUser = offersToUser.data.length; |
|
|
|
this.newOffersToUserHitLimit = offersToUser.hitLimit; |
|
|
|
this.numNewOffersToUserProjects = offersToProjects.data.length; |
|
|
|
this.newOffersToUserProjectsHitLimit = offersToProjects.hitLimit; |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.$logAndConsole( |
|
|
|
`[HomeView] Failed to initialize feed/offers: ${error}`, |
|
|
|
true, |
|
|
|
); |
|
|
|
// Don't throw - we can continue with empty feed |
|
|
|
this.notify.warning(NOTIFY_FEED_LOADING_ISSUE.message, TIMEOUTS.LONG); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.handleError(error); |
|
|
|
throw error; // Re-throw to be caught by mounted() |
|
|
|
} catch (err: unknown) { |
|
|
|
logger.error("[HomeView Settings Trace] ❌ initializeIdentity() failed", { |
|
|
|
error: err instanceof Error ? err.message : String(err), |
|
|
|
}); |
|
|
|
throw err; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -683,10 +638,8 @@ export default class HomeView extends Vue { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Loads user settings from storage using ultra-concise mixin utilities |
|
|
|
* Sets component state for: |
|
|
|
* - API server, Active DID, Feed filters and view settings |
|
|
|
* - Registration status, Notification acknowledgments |
|
|
|
* Loads user settings from database using ultra-concise mixin |
|
|
|
* Used for displaying settings in feed and actions |
|
|
|
* |
|
|
|
* @internal |
|
|
|
* Called by mounted() and reloadFeedOnChange() |
|
|
@ -816,7 +769,7 @@ export default class HomeView extends Vue { |
|
|
|
* Called by mounted() |
|
|
|
*/ |
|
|
|
private async checkOnboarding() { |
|
|
|
const settings = await this.$settings(); |
|
|
|
const settings = await this.$accountSettings(); |
|
|
|
if (!settings.finishedOnboarding) { |
|
|
|
(this.$refs.onboardingDialog as OnboardingDialog).open(OnboardPage.Home); |
|
|
|
} |
|
|
|