From a904209dae949c667054589ac97dbb781c4a220e Mon Sep 17 00:00:00 2001 From: Night_Hunter Date: Fri, 11 Oct 2024 22:11:28 +1300 Subject: [PATCH] if comparator not set use global --- plugins/updater/src/updater.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/updater/src/updater.rs b/plugins/updater/src/updater.rs index 1b608d88..30ba1160 100644 --- a/plugins/updater/src/updater.rs +++ b/plugins/updater/src/updater.rs @@ -263,6 +263,7 @@ impl UpdaterBuilder { app_name: self.app_name, current_version: self.current_version, version_comparator: self.version_comparator, + global_version_comparator: self.global_version_comparator, timeout: self.timeout, proxy: self.proxy, endpoints, @@ -295,6 +296,7 @@ pub struct Updater { app_name: String, current_version: Version, version_comparator: Option bool + Send + Sync>>, + global_version_comparator: Option, timeout: Option, proxy: Option, endpoints: Vec, @@ -405,7 +407,15 @@ impl Updater { let should_update = match self.version_comparator.as_ref() { 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 {