Add application menu item for checking for updates

This commit is contained in:
Max Brunsfeld 2022-04-04 18:05:26 -07:00
parent 9c469f2fdb
commit fb2caf3c58
3 changed files with 13 additions and 0 deletions

View file

@ -70,6 +70,12 @@ pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut Mutab
}
}
pub fn check(cx: &mut MutableAppContext) {
if let Some(updater) = AutoUpdater::get(cx) {
updater.update(cx, |updater, cx| updater.poll(cx));
}
}
impl AutoUpdater {
fn get(cx: &mut MutableAppContext) -> Option<ModelHandle<Self>> {
cx.default_global::<Option<ModelHandle<Self>>>().clone()