SudokuFX
Loading...
Searching...
No Matches
fr.softsf.sudokufx.service.external.VersionService Class Reference

Service for checking if the application version is up to date by querying the GitHub API. More...

Collaboration diagram for fr.softsf.sudokufx.service.external.VersionService:

Public Member Functions

 VersionService (HttpClient httpClient, ObjectMapper objectMapper, SpinnerService spinnerService)
 Constructs a new VersionService with required infrastructure services.
Task< Boolean > checkLatestVersion ()
 Checks if the current application version matches the latest release on GitHub.

Static Public Attributes

static final int MAX_TAG_NAME_LENGTH = 256
static final int MAX_TAGS_RESPONSE_SIZE = 65_536

Private Member Functions

boolean parseResponse (byte[] data)
 Parses the byte array directly.

Private Attributes

final HttpClient httpClient
final ObjectMapper objectMapper
final SpinnerService spinnerService

Static Private Attributes

static final String CURRENT_VERSION
static final int HTTP_STATUS_OK = 200
static final Logger LOG = LoggerFactory.getLogger(VersionService.class)

Detailed Description

Service for checking if the application version is up to date by querying the GitHub API.

It retrieves the latest release tag from the repository and compares it with the current application version.

Constructor & Destructor Documentation

◆ VersionService()

fr.softsf.sudokufx.service.external.VersionService.VersionService ( HttpClient httpClient,
ObjectMapper objectMapper,
SpinnerService spinnerService )

Constructs a new VersionService with required infrastructure services.

Parameters
httpClientthe HttpClient used for API requests
objectMapperthe ObjectMapper for JSON deserialization
spinnerServicethe SpinnerService for UI loading feedback
Here is the call graph for this function:

Member Function Documentation

◆ checkLatestVersion()

Task< Boolean > fr.softsf.sudokufx.service.external.VersionService.checkLatestVersion ( )

Checks if the current application version matches the latest release on GitHub.

Returns
a Task returning true if up-to-date, false if update available
Here is the call graph for this function:

◆ parseResponse()

boolean fr.softsf.sudokufx.service.external.VersionService.parseResponse ( byte[] data)
private

Parses the byte array directly.

Parameters
datathe byte array containing the JSON response, limited by MAX_TAGS_RESPONSE_SIZE
Returns
true if versions match or if parsing fails; false if a different version is detected

Member Data Documentation

◆ CURRENT_VERSION

final String fr.softsf.sudokufx.service.external.VersionService.CURRENT_VERSION
staticprivate
Initial value:
=
JVMApplicationProperties.INSTANCE.getAppVersion().replaceFirst("^v", "")
Utility enum for managing JVM application properties.
Definition JVMApplicationProperties.java:17
INSTANCE
Definition JVMApplicationProperties.java:18

◆ HTTP_STATUS_OK

final int fr.softsf.sudokufx.service.external.VersionService.HTTP_STATUS_OK = 200
staticprivate

◆ httpClient

final HttpClient fr.softsf.sudokufx.service.external.VersionService.httpClient
private

◆ LOG

final Logger fr.softsf.sudokufx.service.external.VersionService.LOG = LoggerFactory.getLogger(VersionService.class)
staticprivate

◆ MAX_TAG_NAME_LENGTH

final int fr.softsf.sudokufx.service.external.VersionService.MAX_TAG_NAME_LENGTH = 256
static

◆ MAX_TAGS_RESPONSE_SIZE

final int fr.softsf.sudokufx.service.external.VersionService.MAX_TAGS_RESPONSE_SIZE = 65_536
static

◆ objectMapper

final ObjectMapper fr.softsf.sudokufx.service.external.VersionService.objectMapper
private

◆ spinnerService

final SpinnerService fr.softsf.sudokufx.service.external.VersionService.spinnerService
private

The documentation for this class was generated from the following file: