-
Notifications
You must be signed in to change notification settings - Fork 47
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
Conversation
@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) { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
?
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.