MCPcopy
hub / github.com/callumalpass/tasknotes / checkForVersionUpdate

Method checkForVersionUpdate

src/main.ts:513–551  ·  view source on GitHub ↗

* Check for version updates and show release notes if needed

()

Source from the content-addressed store, hash-verified

511 * Check for version updates and show release notes if needed
512 */
513 async checkForVersionUpdate(): Promise<void> {
514 try {
515 const currentVersion = this.manifest.version;
516 const lastSeenVersion = this.settings.lastSeenVersion;
517
518 // If this is a new install or version has changed, show release notes (if enabled)
519 if (lastSeenVersion && lastSeenVersion !== currentVersion) {
520 const showReleaseNotes = this.settings.showReleaseNotesOnUpdate ?? true;
521 if (showReleaseNotes) {
522 // Show release notes after a delay to ensure UI is ready
523 window.setTimeout(() => {
524 void (async () => {
525 await this.activateReleaseNotesView();
526 // Update lastSeenVersion immediately after showing the release notes
527 // This ensures they only show once per version
528 this.settings.lastSeenVersion = currentVersion;
529 await this.saveSettings();
530 })();
531 }, 1500); // Slightly longer delay than migration to avoid conflicts
532 } else {
533 // Still update lastSeenVersion even if not showing release notes
534 this.settings.lastSeenVersion = currentVersion;
535 await this.saveSettings();
536 }
537 }
538
539 // Update lastSeenVersion if it hasn't been set yet (new install)
540 if (!lastSeenVersion) {
541 this.settings.lastSeenVersion = currentVersion;
542 await this.saveSettings();
543 }
544 } catch (error) {
545 tasknotesLogger.error("Error checking for version update:", {
546 category: "configuration",
547 operation: "checking-version-update",
548 error: error,
549 });
550 }
551 }
552
553 async checkForNewReleaseOnStartup(): Promise<void> {
554 if (this.settings.checkForUpdatesOnStartup === false) {

Calls 4

saveSettingsMethod · 0.95
errorMethod · 0.80
setTimeoutMethod · 0.65

Tested by

no test coverage detected