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

updated Downloader with ifUpdateAvailable #328

Merged
merged 2 commits into from
Aug 19, 2017
Merged

updated Downloader with ifUpdateAvailable #328

merged 2 commits into from
Aug 19, 2017

Conversation

plata
Copy link
Collaborator

@plata plata commented Aug 16, 2017

requires PhoenicisOrg/phoenicis#979

If the download location is specified (to()), the new (ifUpdateAvailable()) method can be used to trigger a download only if the resource available via the given URL is newer than the local file.

It is currently used to avoid repeated downloads of the available Wine versions json.

@plata
Copy link
Collaborator Author

plata commented Aug 16, 2017

@qparis the last modified date reported for http://phoenicis.playonlinux.com/index.php/wine?os=linux is always 0. Can you change the server to return the correct date?

@@ -32,6 +32,10 @@ var Downloader = function () {
that._localFile = localFile;
return that;
};
that.ifUpdateAvailable = function (ifUpdateAvailable) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What exactly is the use of this function/field ifUpdateAvailable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Like I wrote in the description: It allows you to only download the file again if the file on the web server is newer than the one you have downloaded (i.e. it has been updated on the server).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a little confused about the type of the variable ifUpdateAvailable that should be passed to the function.
When taking a look at normal java APIs, like https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html I normally think that methods beginning with an if take a lambda function, but I believe your method takes a boolean right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it takes a boolean. Any proposal how it should be named?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe something like alwaysCheckForUpdates or only checkForUpdates?

@plata plata merged commit d86d4bf into PhoenicisOrg:master Aug 19, 2017
@plata plata deleted the update-available branch August 19, 2017 09:09
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.

2 participants