CanScan
Loading...
Searching...
No Matches
fr.softsf.canscan.service.VersionService Enum Reference

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

Collaboration diagram for fr.softsf.canscan.service.VersionService:

Public Member Functions

 VersionService ()
 Enum constructor initializing the infrastructure.
SwingWorker< VersionValue, Void > checkLatestVersion (String currentVersion, JButton updateButton)
 Checks if the current application version matches the latest release on GitHub.

Public Attributes

 INSTANCE

Static Public Attributes

static final int HTTP_FORBIDDEN = 403
static final int HTTP_NOT_FOUND = 404

Private Member Functions

VersionValue parseResponse (byte[] data, String cleanCurrentVersion)
 Parses the byte array directly.
void updateButtonState (JButton button, boolean enabled, String tooltip)
 Updates the UI button state.

Private Attributes

final HttpClient httpClient
final ObjectMapper objectMapper

Static Private Attributes

static final String CLOSE_HTML = "</html>"
static final String GITHUB_TAGS_API_URL
static final int HTTP_STATUS_OK = 200
static final String LATEST_RELEASES_REPO_URL
static final int MAX_TAG_NAME_LENGTH = 256
static final int MAX_TAGS_RESPONSE_SIZE = 65_536
static final String OPEN_HTML = "<html>"
static final String TOOLTIP_PREFIX = "Mise à jour :<br>"

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.canscan.service.VersionService.VersionService ( )

Enum constructor initializing the infrastructure.

Member Function Documentation

◆ checkLatestVersion()

SwingWorker< VersionValue, Void > fr.softsf.canscan.service.VersionService.checkLatestVersion ( String currentVersion,
JButton updateButton )

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

Parameters
currentVersionCurrent application version
updateButtonTarget button for state updates
Returns
a SwingWorker returning a VersionValue
Here is the call graph for this function:

◆ parseResponse()

VersionValue fr.softsf.canscan.service.VersionService.parseResponse ( byte[] data,
String cleanCurrentVersion )
private

Parses the byte array directly.

Parameters
datathe byte array containing the JSON response
cleanCurrentVersionthe current version without prefix
Returns
an evaluated VersionValue

◆ updateButtonState()

void fr.softsf.canscan.service.VersionService.updateButtonState ( JButton button,
boolean enabled,
String tooltip )
private

Updates the UI button state.

Member Data Documentation

◆ CLOSE_HTML

final String fr.softsf.canscan.service.VersionService.CLOSE_HTML = "</html>"
staticprivate

◆ GITHUB_TAGS_API_URL

final String fr.softsf.canscan.service.VersionService.GITHUB_TAGS_API_URL
staticprivate
Initial value:
=
"https://api.github.com/repos/Lob2018/CanScan/tags"

◆ HTTP_FORBIDDEN

final int fr.softsf.canscan.service.VersionService.HTTP_FORBIDDEN = 403
static

◆ HTTP_NOT_FOUND

final int fr.softsf.canscan.service.VersionService.HTTP_NOT_FOUND = 404
static

◆ HTTP_STATUS_OK

final int fr.softsf.canscan.service.VersionService.HTTP_STATUS_OK = 200
staticprivate

◆ httpClient

final HttpClient fr.softsf.canscan.service.VersionService.httpClient
private

◆ INSTANCE

fr.softsf.canscan.service.VersionService.INSTANCE

◆ LATEST_RELEASES_REPO_URL

final String fr.softsf.canscan.service.VersionService.LATEST_RELEASES_REPO_URL
staticprivate
Initial value:
=
"Lien : https://github.com/Lob2018/CanScan/releases/latest"

◆ MAX_TAG_NAME_LENGTH

final int fr.softsf.canscan.service.VersionService.MAX_TAG_NAME_LENGTH = 256
staticprivate

◆ MAX_TAGS_RESPONSE_SIZE

final int fr.softsf.canscan.service.VersionService.MAX_TAGS_RESPONSE_SIZE = 65_536
staticprivate

◆ objectMapper

final ObjectMapper fr.softsf.canscan.service.VersionService.objectMapper
private

◆ OPEN_HTML

final String fr.softsf.canscan.service.VersionService.OPEN_HTML = "<html>"
staticprivate

◆ TOOLTIP_PREFIX

final String fr.softsf.canscan.service.VersionService.TOOLTIP_PREFIX = "Mise à jour :<br>"
staticprivate

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