Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always enable 'Check for Updates' menu button #11485

Merged
merged 8 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv

### Changed

- The 'Check for updates' menu bar button is now always enabled. [#11485](https://github.com/JabRef/jabref/pull/11485)
- JabRef respects the [configuration for storing files relative to the .bib file](https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks#directories-for-files) in more cases. [#11492](https://github.com/JabRef/jabref/pull/11492)

### Fixed

- We fixed an issue where the 'Check for updates' preference was not saved. [#11485](https://github.com/JabRef/jabref/pull/11485)
- We fixed an issue where an exception was thrown after changing "show preview as a tab" in the preferences. [#11509](https://github.com/JabRef/jabref/pull/11509)

### Removed
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/help/SearchForUpdateAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public SearchForUpdateAction(PreferencesService preferencesService,
this.preferencesService = preferencesService;
this.dialogService = dialogService;
this.taskExecutor = taskExecutor;

this.executable.bind(preferencesService.getInternalPreferences().versionCheckEnabledProperty());
}

@Override
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/org/jabref/gui/help/VersionWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,13 @@ private Optional<Version> getNewVersion() throws IOException {
}

public void checkForNewVersionAsync() {
if (!internalPreferences.isVersionCheckEnabled()) {
return;
}

Comment on lines -64 to -67
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change mean, jabref will now always check on startup, if a new version is present?
This can be very annoying, if you explicitly want to stay on an older version, if the newer one has a bug.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method will only execute when using Help -> Check for updates, so it shouldn't perform any checks.

The other method, checkForNewVersionDelayed() (Line 70), used to check for updates on startup, will only be called if it is enabled in the preferences.

EasyBind.subscribe(preferencesService.getInternalPreferences().versionCheckEnabledProperty(), enabled -> {
if (enabled) {
new VersionWorker(buildInfo.version,
dialogService,
taskExecutor,
preferencesService)
.checkForNewVersionDelayed();
}
});

BackgroundTask.wrap(this::getNewVersion)
.onSuccess(version -> showUpdateInfo(version, true))
.onFailure(exception -> showConnectionError(exception, true))
.executeWith(taskExecutor);
}

public void checkForNewVersionDelayed() {
if (!internalPreferences.isVersionCheckEnabled()) {
return;
}

BackgroundTask.wrap(this::getNewVersion)
.onSuccess(version -> showUpdateInfo(version, false))
.onFailure(exception -> showConnectionError(exception, false))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
import org.jabref.model.strings.StringUtil;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.FilePreferences;
import org.jabref.preferences.InternalPreferences;
import org.jabref.preferences.LibraryPreferences;
import org.jabref.preferences.MergeDialogPreferences;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.WorkspacePreferences;

Expand Down Expand Up @@ -93,7 +91,6 @@ public class GeneralTabViewModel implements PreferenceTabViewModel {
private final LibraryPreferences libraryPreferences;
private final FilePreferences filePreferences;
private final RemotePreferences remotePreferences;
private final MergeDialogPreferences mergeDialogPreferences;

private final Validator fontSizeValidator;
private final Validator customPathToThemeValidator;
Expand All @@ -102,8 +99,6 @@ public class GeneralTabViewModel implements PreferenceTabViewModel {
private final BooleanProperty remoteServerProperty = new SimpleBooleanProperty();
private final StringProperty remotePortProperty = new SimpleStringProperty("");
private final Validator remotePortValidator;
private final InternalPreferences internalPreferences;
private final BooleanProperty versionCheckProperty = new SimpleBooleanProperty();
private final FileUpdateMonitor fileUpdateMonitor;
private final BibEntryTypesManager entryTypesManager;
private final TrustStoreManager trustStoreManager;
Expand All @@ -115,8 +110,6 @@ public GeneralTabViewModel(DialogService dialogService, PreferencesService prefe
this.libraryPreferences = preferences.getLibraryPreferences();
this.filePreferences = preferences.getFilePreferences();
this.remotePreferences = preferences.getRemotePreferences();
this.internalPreferences = preferences.getInternalPreferences();
this.mergeDialogPreferences = preferences.getMergeDialogPreferences();
this.fileUpdateMonitor = fileUpdateMonitor;
this.entryTypesManager = entryTypesManager;

Expand Down Expand Up @@ -246,8 +239,6 @@ public void storeSettings() {
}
});

internalPreferences.setVersionCheckEnabled(versionCheckProperty.getValue());

getPortAsInt(remotePortProperty.getValue()).ifPresent(newPort -> {
if (remotePreferences.isDifferentPort(newPort)) {
remotePreferences.setPort(newPort);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<?import org.controlsfx.control.textfield.CustomPasswordField?>
<fx:root spacing="10.0" type="VBox" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.preferences.network.NetworkTab">
<Label styleClass="titleHeader" text="%Network" />
<CheckBox fx:id="versionCheck" text="%Check for latest version online"/>
<CheckBox fx:id="versionCheck" text="%Check for updates on startup"/>
<Label text="%If you encounter an issue or a bug, please check the latest version, whether the issue is still present." wrapText="true"/>

<Label styleClass="sectionHeader" text="%Proxy configuration" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private void setSSLValues() {

@Override
public void storeSettings() {
internalPreferences.setVersionCheckEnabled(versionCheckProperty.getValue());
proxyPreferences.setUseProxy(proxyUseProperty.getValue());
proxyPreferences.setHostname(proxyHostnameProperty.getValue().trim());
proxyPreferences.setPort(proxyPortProperty.getValue().trim());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/logic/util/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public Optional<Version> shouldBeUpdatedTo(List<Version> availableVersions) {
Optional<Version> newerVersion = Optional.empty();
for (Version version : availableVersions) {
if (this.shouldBeUpdatedTo(version)
&& (!newerVersion.isPresent() || version.isNewerThan(newerVersion.get()))) {
&& (newerVersion.isEmpty() || version.isNewerThan(newerVersion.get()))) {
newerVersion = Optional.of(version);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ Docs\ (This\ Year)=Docs (This Year)
Incorrect\ ISSN\ format=Incorrect ISSN format
Error\ accessing\ catalog=Error accessing catalog

Check\ for\ latest\ version\ online=Check for latest version online
Check\ for\ updates\ on\ startup=Check for updates on startup
If\ you\ encounter\ an\ issue\ or\ a\ bug,\ please\ check\ the\ latest\ version,\ whether\ the\ issue\ is\ still\ present.=If you encounter an issue or a bug, please check the latest version, whether the issue is still present.

Keep\ both=Keep both
Expand Down
Loading