|
|
@ -263,6 +263,7 @@ impl UpdaterBuilder {
|
|
|
|
app_name: self.app_name,
|
|
|
|
app_name: self.app_name,
|
|
|
|
current_version: self.current_version,
|
|
|
|
current_version: self.current_version,
|
|
|
|
version_comparator: self.version_comparator,
|
|
|
|
version_comparator: self.version_comparator,
|
|
|
|
|
|
|
|
global_version_comparator: self.global_version_comparator,
|
|
|
|
timeout: self.timeout,
|
|
|
|
timeout: self.timeout,
|
|
|
|
proxy: self.proxy,
|
|
|
|
proxy: self.proxy,
|
|
|
|
endpoints,
|
|
|
|
endpoints,
|
|
|
@ -295,6 +296,7 @@ pub struct Updater {
|
|
|
|
app_name: String,
|
|
|
|
app_name: String,
|
|
|
|
current_version: Version,
|
|
|
|
current_version: Version,
|
|
|
|
version_comparator: Option<Box<dyn Fn(Version, RemoteRelease) -> bool + Send + Sync>>,
|
|
|
|
version_comparator: Option<Box<dyn Fn(Version, RemoteRelease) -> bool + Send + Sync>>,
|
|
|
|
|
|
|
|
global_version_comparator: Option<GlobalVersionComparator>,
|
|
|
|
timeout: Option<Duration>,
|
|
|
|
timeout: Option<Duration>,
|
|
|
|
proxy: Option<Url>,
|
|
|
|
proxy: Option<Url>,
|
|
|
|
endpoints: Vec<Url>,
|
|
|
|
endpoints: Vec<Url>,
|
|
|
@ -405,7 +407,15 @@ impl Updater {
|
|
|
|
|
|
|
|
|
|
|
|
let should_update = match self.version_comparator.as_ref() {
|
|
|
|
let should_update = match self.version_comparator.as_ref() {
|
|
|
|
Some(comparator) => comparator(self.current_version.clone(), release.clone()),
|
|
|
|
Some(comparator) => comparator(self.current_version.clone(), release.clone()),
|
|
|
|
None => release.version > self.current_version,
|
|
|
|
None => {
|
|
|
|
|
|
|
|
match self.global_version_comparator.as_ref() {
|
|
|
|
|
|
|
|
Some(comparator) => comparator(self.current_version.clone(), release.clone()),
|
|
|
|
|
|
|
|
None => {
|
|
|
|
|
|
|
|
// default comparator
|
|
|
|
|
|
|
|
release.version > self.current_version
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let update = if should_update {
|
|
|
|
let update = if should_update {
|
|
|
|