Skip to content

Commit

Permalink
Fixed #68 #no-build
Browse files Browse the repository at this point in the history
  • Loading branch information
marvk committed Dec 18, 2021
1 parent 68639aa commit 0c670ba
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Ability to turn off Labels on uncontrolled Airports and uncontrolled Airports with arrivals and/or departures
- Added button to close the preloader after an issue occurred ([#66](https://github.com/marvk/vatprism/issues/66))

### Changed

- Reduced automatic refresh rate to 15 seconds from 30 seconds to match VATSIM api refresh rate

### Fixed

- VAT-Spy color scheme delivery and ground colors swapped ([#57](https://github.com/marvk/vatprism/issues/57))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ public PolygonRepository lakes(@Named("lakesShapefileUrl") final List<String> sh
return new PolygonRepository(shapefileUrls, shpUrls(shapefileUrls));
}

@Provides
@Singleton
@Named("vatsimApiRefreshRate")
public Duration vatsimApiRefreshRate() {
return Duration.ofSeconds(15);
}

private static List<URL> shpUrls(final List<String> shapefileUrls) {
return shapefileUrls.stream().map(AppModule::shpUrl).collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.marvk.fs.vatsim.map.view.main;

import com.google.inject.Inject;
import com.google.inject.name.Named;
import de.saxsys.mvvmfx.InjectScope;
import de.saxsys.mvvmfx.ScopeProvider;
import de.saxsys.mvvmfx.ViewModel;
Expand All @@ -14,7 +15,6 @@
import javafx.concurrent.ScheduledService;
import javafx.concurrent.Task;
import javafx.scene.paint.Color;
import javafx.util.Duration;
import lombok.extern.log4j.Log4j2;
import net.marvk.fs.vatsim.map.data.*;
import net.marvk.fs.vatsim.map.view.Notifications;
Expand All @@ -23,6 +23,7 @@
import net.marvk.fs.vatsim.map.view.ToolbarScope;
import net.marvk.fs.vatsim.map.view.filter.FilterScope;

import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -38,7 +39,6 @@ public class MainViewModel implements ViewModel {

private final Preferences preferences;

private static final Duration RELOAD_PERIOD = Duration.seconds(30);
private final ReloadService clientReloadService;

private final ReadOnlyBooleanWrapper onboarding = new ReadOnlyBooleanWrapper();
Expand All @@ -50,16 +50,17 @@ public class MainViewModel implements ViewModel {
public MainViewModel(
final ClientRepository clientRepository,
final Preferences preferences,
final VersionProvider versionProvider
final VersionProvider versionProvider,
@Named("vatsimApiRefreshRate") final Duration refreshRate
) {
this.preferences = preferences;

Notifications.RELOAD_CLIENTS.subscribe(this::reloadClients);

this.loadClientsAsync = new ReloadRepositoryCommand(clientRepository, this::clientReloadCompleted);
loadClientsAsync = new ReloadRepositoryCommand(clientRepository, this::clientReloadCompleted);
clientReloadService = new ReloadService(loadClientsAsync);
clientReloadService.setPeriod(RELOAD_PERIOD);
clientReloadService.setDelay(RELOAD_PERIOD);
clientReloadService.setPeriod(javafx.util.Duration.seconds(refreshRate.getSeconds()));
clientReloadService.setDelay(javafx.util.Duration.seconds(refreshRate.getSeconds()));

final StringProperty version = preferences.stringProperty("meta.version");
if (version.get() == null || "0.0.0".equals(version.get())) {
Expand Down

0 comments on commit 0c670ba

Please sign in to comment.