Skip to content

Show restart notification when restart-required settings change - #770

Open
mrtineuAI wants to merge 2 commits into
slovensko-digital:mainfrom
mrtineuAI:fix/662-restart-notification
Open

mrtineuAI wants to merge 2 commits into
slovensko-digital:mainfrom
mrtineuAI:fix/662-restart-notification

Conversation

@mrtineuAI

Copy link
Copy Markdown

Fixes #662.

Some settings only take effect after an application restart (currently the local Autogram API server toggle — the trusted-countries list already refreshes live on save). Users often missed the small hint next to the setting and were confused when the change didn't seem to apply.

This change notifies the user upon saving: after clicking "Save settings", if any restart-required setting was changed since the last save, a modal dialog appears asking them to restart the application. The same notification is shown after confirming a settings reset, when the reset flips such a setting.

Changes:

  • UserSettings.restartRequiredSettingsChanged() / restartRequiredSettingsChangedByReset() — detect the change (same prefs-comparison pattern as the existing tlCountriesChanged())
  • New modal settings-restart-dialog.fxml + SettingsRestartDialogController, shown from SettingsDialogController.onSaveButtonAction and SettingsResetDialogController.onConfirmResetButtonAction
  • New settings.restart.title / settings.restart.text strings in SK and EN bundles
  • 2 new unit tests in UserSettingsTest

Verified:

  • Scripted GUI click-throughs (real app under xvfb, real mouse clicks): before the fix, toggling the server setting and saving showed no notification (issue replicated); after the fix the "Application restart required" dialog appears and closes via its button; saving with no changes shows nothing; the reset flow also notifies; Slovak localization renders correctly.
  • Unit tests: 10/10 pass (UserSettingsTest, incl. the 2 new tests).

Fixes slovensko-digital#662.

Some settings (e.g. enabling/disabling the local Autogram API server)
only take effect after an application restart. Users often missed the
small hint next to the setting and were confused when the change didn't
seem to apply.

The settings dialog now shows a modal notification after saving (or
resetting) whenever such a setting was changed.
@mrtineuAI

Copy link
Copy Markdown
Author

Demo video of the fix in action (scripted click-through of the real app):

https://github.com/mrtineuAI/autogram/releases/download/demo-662/autogram-662-demo.mp4

The video shows: opening Settings, switching to the Other tab, toggling "Enable Autogram API" (a setting that requires an application restart), clicking "Save settings" — and the new "Application restart required" dialog appearing.

The dialog shown after changing a restart-required setting now offers
to restart the application directly, instead of only informing the
user to do it manually.

ApplicationRestarter spawns a new JVM with the same JVM arguments,
classpath and program arguments, then exits the current instance.
@mrtineuAI

Copy link
Copy Markdown
Author

Update: the dialog now has a Restart button (primary) next to Close. Clicking it relaunches Autogram on the spot — same JVM arguments, classpath and program arguments — and exits the old instance.

Demo (scripted click-through of the real app):

autogram-662-restart-demo.mp4

The video shows: toggling "Enable Autogram API" → Save → the dialog with Restart/Close → clicking Restart → the app closing and starting again. (The "Failed to start server" notice at the end is specific to the demo machine, where another Autogram instance already occupies the API port — it also confirms the restarted app picked up the changed setting.)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tell user to restart the app if such settings were chaged

1 participant