Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 28, 2025

Resolves: #2082
(https://community.software.sil.org/t/desktop-version-force-update/10790)

Also added a link to release notes as a quick way to resolve https://community.software.sil.org/t/add-changelog-1-vote/10789.

Main dialog states:

If auto-update is supported:

image

Auto-update not supported

image

Already up to date

image

Menu items:

image image

Detailed states:

image image image image image image image image image

(Should never happen, because you can't trigger an install if it's not supported:)

image image image

Added "Platform" to troubleshooting dialog

image

@coderabbitai
Copy link

coderabbitai bot commented Oct 28, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Implements comprehensive update checking and installation UI across backend and frontend. Adds event-driven progress reporting in Windows AppUpdateService, introduces caching and AvailableUpdate model in UpdateChecker, exposes update services via JS interop, creates UpdateDialog and UpdateDialogContent components, generates TypeScript type definitions, and extends localization across multiple languages.

Changes

Cohort / File(s) Summary
Backend Update Service Core
backend/FwLite/FwLiteMaui/Platforms/Windows/AppUpdateService.cs, backend/FwLite/FwLiteShared/AppUpdate/UpdateChecker.cs, backend/FwLite/FwLiteShared/Services/UpdateService.cs
Extended AppUpdateService to inject GlobalEventBus and publish progress events; refactored UpdateChecker with caching, new AvailableUpdate record, and modified public signatures (TryUpdate, CheckForUpdate, ApplyUpdate); added new UpdateService exposing CheckForUpdates and ApplyUpdate methods via JSInvokable.
Backend Event System
backend/FwLite/FwLiteShared/Events/AppUpdateEvent.cs, backend/FwLite/FwLiteShared/Events/AppUpdateProgressEvent.cs, backend/FwLite/FwLiteShared/Events/IFwEvent.cs
Extended AppUpdateEvent to include Release property; introduced new AppUpdateProgressEvent class with percentage and release; added AppUpdateProgress to FwEventType enum and registered JsonDerivedType.
Backend Configuration & DI
backend/FwLite/FwLiteShared/AppUpdate/IPlatformUpdateService.cs, backend/FwLite/FwLiteShared/FwLiteSharedKernel.cs, backend/FwLite/FwLiteShared/Services/FwLiteProvider.cs
Added Disallowed enum member to UpdateResult; registered memory cache and UpdateService singleton in DI container; added UpdateService to DotnetService enum and ExportedServices.
Backend TypeGen Configuration
backend/FwLite/FwLiteShared/TypeGen/ReinforcedFwLiteTypingConfig.cs
Exported FwLiteRelease and AvailableUpdate to TypeScript type generation.
Frontend Service Layer
frontend/viewer/src/lib/services/service-provider.ts, frontend/viewer/src/project/demo/in-memory-demo-api.ts
Added UpdateService to LexboxServiceRegistry and created useUpdateService hook; implemented mock UpdateService in demo API.
Frontend UI Components
frontend/viewer/src/lib/updates/UpdateDialog.svelte, frontend/viewer/src/lib/updates/UpdateDialogContent.svelte, frontend/viewer/src/home/HomeView.svelte, frontend/viewer/src/project/ProjectSidebar.svelte
Introduced UpdateDialog and UpdateDialogContent components with state management, progress tracking, and result handling; added update menu items to HomeView and ProjectSidebar.
Frontend Utilities & Support
frontend/viewer/src/lib/updates/utils.ts, frontend/viewer/src/lib/notifications/NotificationOutlet.svelte, frontend/viewer/src/lib/troubleshoot/TroubleshootDialog.svelte, frontend/viewer/src/stories/demo-story-error.ts
Added URL handling utilities (openReleaseUrl, getReleaseUrl, constants); refactored NotificationOutlet to use release data directly; updated TroubleshootDialog layout; added DemoStoryError class.
Frontend Type Definitions
frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/AppUpdate/*, frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Events/*, frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Services/*, frontend/viewer/src/lib/dotnet-types/generated-types/LexCore/Entities/IFwLiteRelease.ts
Generated IAvailableUpdate interface; updated UpdateResult enum with Disallowed; generated IAppUpdateProgressEvent; extended IAppUpdateEvent with release; created IUpdateService; updated FwEventType enum; created index barrel exports; added IFwLiteRelease.
Frontend Localization
frontend/viewer/src/locales/en.po, frontend/viewer/src/locales/es.po, frontend/viewer/src/locales/fr.po, frontend/viewer/src/locales/id.po, frontend/viewer/src/locales/ko.po, frontend/viewer/src/locales/ms.po, frontend/viewer/src/locales/sw.po
Added update-related translation entries across all locales (CheckForUpdates, Download/Install prompts, status messages); reorganized component path references for OpenInFieldWorksButton and ThemePicker.
Frontend Storybook
frontend/viewer/.storybook/vitest.setup.ts, frontend/viewer/src/stories/updates/update-dialog-content.stories.svelte
Enhanced error filtering in vitest setup to ignore DemoStoryError; created comprehensive story suite for UpdateDialogContent covering check/install states and outcomes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Areas requiring extra attention:

  • UpdateChecker refactoring — caching logic, IMemoryCache integration, modified return types (UpdateResult?, AvailableUpdate?), and control flow changes across CheckForUpdate, TryUpdate, and ApplyUpdate methods
  • Event-driven architecture — GlobalEventBus injection in AppUpdateService, AppUpdateProgressEvent publishing flow, and event propagation to frontend
  • Frontend state management — UpdateDialog and UpdateDialogContent component interactions with promises, progress tracking, error handling, and multiple install result paths
  • JS interop contract — JSInvokable method signatures, parameter passing (AvailableUpdate), and async operation semantics between frontend and backend
  • Localization consistency — ensure all new UI strings are translated across all 7 language files without duplicates or missing entries
  • Generated TypeScript types — verify type generation accuracy for AvailableUpdate, IUpdateService, and event types aligns with backend definitions

Possibly related PRs

Suggested reviewers

  • jasonleenaylor

Poem

🐰 A rabbit hops through code with glee,
Progress events flow wild and free,
Updates checked with caches fast,
Dialogs prompt, no more a blast,
TypeScript types now perfectly aligned,
Seven tongues to updates bind! 🚀

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Out of Scope Changes check ❓ Inconclusive While most changes align with update UI objectives, several modifications appear tangential to the core feature: extensive .po file reorganization (theme/component path migrations), unused import cleanup, platform display additions to troubleshooting dialog, and demo error handling improvements. Review whether .po file reorganizations, troubleshooting dialog platform display, and demo error handling are necessary for this PR's core update UI feature, or if they should be in separate PRs.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add UI to check for and trigger updates' clearly summarizes the main change—introducing user-facing UI for checking and triggering application updates.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, providing context about the feature's purpose, linked issues, UI screenshots, and implementation details.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #2082: UI for checking updates, platform-aware auto-update vs. manual download handling (SupportsAutoUpdate flag), update triggering functionality, and appropriate dialog placement on the home page.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Add UI for checking and triggering updates Add UI to check for and trigger updates Oct 28, 2025
Copilot AI requested a review from myieye October 28, 2025 17:18
@github-actions github-actions bot added the 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related label Nov 11, 2025
@github-actions
Copy link

github-actions bot commented Nov 11, 2025

UI unit Tests

  1 files  ± 0   47 suites  +2   19s ⏱️ -1s
123 tests +12  123 ✅ +12  0 💤 ±0  0 ❌ ±0 
184 runs  +24  184 ✅ +24  0 💤 ±0  0 ❌ ±0 

Results for commit c78014e. ± Comparison against base commit a93900b.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 11, 2025

C# Unit Tests

146 tests  ±0   146 ✅ ±0   20s ⏱️ -1s
 22 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit c78014e. ± Comparison against base commit a93900b.

♻️ This comment has been updated with latest results.

@myieye myieye force-pushed the copilot/add-update-check-ui branch from dceaabd to 701d527 Compare November 11, 2025 15:20
@myieye
Copy link
Collaborator

myieye commented Nov 11, 2025

@copilot I exposed a better API for the UI to check for updates and then install an update.

Please refactor to use that instead of the complicated event triggering and checking you added.
Also, note the SupportsAutoUpdate which the UI should use to decide if an install button is used or a link to the download page.
There shouldn't be any notifications if a manual install is required. Everything should be contained within the dialog.

Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot I exposed a better API for the UI to check for updates and then install an update.

Please refactor to use that instead of the complicated event triggering and checking you added.
...

Refactored to use the new API in commit 0239a84.

The implementation now:

  • Uses checkForUpdates() which returns IAvailableUpdate | null directly (no event subscriptions)
  • Shows "Install Update" button when supportsAutoUpdate is true
  • Shows "Go to Download Page" link (to release.url) when supportsAutoUpdate is false
  • Everything is contained within the dialog
  • Removed all the complex event triggering/timeout logic

The UI adapts based on the supportsAutoUpdate flag:

  • Auto-update supported: Primary "Install Update" button → calls applyUpdate()
  • Manual update required: Primary download link button → opens release.url in new tab

@myieye
Copy link
Collaborator

myieye commented Nov 11, 2025

@copilot There are a lot of bools/flags in the dialog. Is there any way to make it cleaner? Maybe by using promises? Or would that get more chaotic?

Also, I don't think we need "Check Again" buttons. Let's just replace the Check update button with "no updates", "download" or "install". Or is there a good reason not to do that?

Also, the Button component has a loading state and flex-gap, so use those instead of doing them yourself. (e.g. mr-2 and i-mdi-loading)

context="module" should just be module. And you don't actually need that script tag. The import should be in the other script tag.

Make the platform <DevContent>. I kind of like it, but it's just noise for the average user.

Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot There are a lot of bools/flags in the dialog. Is there any way to make it cleaner? Maybe by using promises? Or would that get more chaotic?

Also, I don't think we need "Check Again" button...

Implemented all requested changes in commit 810d647:

Reduced boolean flags:

  • Replaced 6 state variables with 3 (using promises)
  • Use Svelte's {#await} blocks for declarative state handling

Removed "Check Again" buttons:

  • Main button now adapts based on state: "Check for Updates" → "Install Update" / "Go to Download Page" → back to "Check for Updates"

Use Button component features:

  • Using loading prop instead of manual spinner
  • Using icon prop instead of manual Icon components with mr-2

Fixed script issues:

  • Changed context="module" to just having one script tag
  • Removed unused cn import

Backend cache:

  • Implemented 5-minute memory cache in CheckForUpdate() per TODO comment

Fixed platform display:

  • Removed .toString() call on config.os

@myieye
Copy link
Collaborator

myieye commented Nov 11, 2025

@copilot use the standard .net MemoryCache

Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot use the standard .net MemoryCache

Replaced custom cache implementation with standard .NET MemoryCache in commit 1b88fbe.

Changes:

  • Injected IMemoryCache via constructor
  • Using GetOrCreateAsync pattern with 5-minute absolute expiration
  • Added AddMemoryCache() to FwLiteSharedKernel service registration
  • Removed manual cache fields and time tracking

@myieye myieye force-pushed the copilot/add-update-check-ui branch from 1b88fbe to 4f65a56 Compare November 24, 2025 15:24
@argos-ci
Copy link

argos-ci bot commented Nov 24, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 4 changed Jan 16, 2026, 3:07 PM

@myieye myieye force-pushed the copilot/add-update-check-ui branch from 5e67741 to ae17f94 Compare November 25, 2025 09:21
@myieye myieye marked this pull request as ready for review November 28, 2025 10:09
@myieye myieye added the 🟨Medium Medium-priority PR label Nov 28, 2025
@myieye
Copy link
Collaborator

myieye commented Dec 1, 2025

@coderabbitai review

Copilot AI and others added 26 commits January 15, 2026 14:57
Co-authored-by: myieye <12587509+myieye@users.noreply.github.com>
- Removed complex event subscription logic
- Use direct API calls: checkForUpdates() returns IAvailableUpdate | null
- Use supportsAutoUpdate flag to show Install button vs download link
- Simplified state management and UI logic
- All functionality contained within dialog (no external notifications)

Co-authored-by: myieye <12587509+myieye@users.noreply.github.com>
Backend:
- Implement 5-minute memory cache for update checks
- Cache both "update available" and "no update" results

Frontend:
- Replace boolean flags (checking, installing, checkComplete, errorMessage) with promise-based state
- Use Svelte's {#await} blocks to handle async states declaratively
- Remove "Check Again" buttons - main button changes based on state
- Use Button's built-in loading and icon props (removed manual mr-2, i-mdi-loading)
- Remove unused context="module" script tag and cn import
- Fix platform display (removed .toString())

State reduced from 6 variables to 3:
- checkPromise: handles check states (pending/fulfilled/rejected)
- installPromise: handles install states
- installSuccess: tracks successful installation

Co-authored-by: myieye <12587509+myieye@users.noreply.github.com>
- Replace custom cache fields (_cachedUpdate, _cacheTime) with IMemoryCache
- Inject IMemoryCache via constructor dependency injection
- Use GetOrCreateAsync pattern for cleaner cache logic
- Add AddMemoryCache() to FwLiteSharedKernel service registration
- Maintain same 5-minute cache duration behavior

Co-authored-by: myieye <12587509+myieye@users.noreply.github.com>
It's confusing and there's a link to the app/downloads anyway
@myieye myieye force-pushed the copilot/add-update-check-ui branch from 0ab90da to c78014e Compare January 16, 2026 09:15
@myieye myieye merged commit 99040d8 into develop Jan 16, 2026
11 of 13 checks passed
@myieye myieye deleted the copilot/add-update-check-ui branch January 16, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related 🟨Medium Medium-priority PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI to check for and trigger updates

3 participants