Show a notification on auto-update check action if updates are disabled
This commit is contained in:
parent
c7e19c0bcd
commit
808a0626c0
1 changed files with 8 additions and 10 deletions
|
@ -85,15 +85,7 @@ pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut AppCo
|
||||||
AutoUpdateSetting::register(cx);
|
AutoUpdateSetting::register(cx);
|
||||||
|
|
||||||
cx.observe_new_views(|workspace: &mut Workspace, _cx| {
|
cx.observe_new_views(|workspace: &mut Workspace, _cx| {
|
||||||
workspace
|
workspace.register_action(|_, action: &Check, cx| check(action, cx));
|
||||||
.register_action(|_, action: &Check, cx| check(action, cx))
|
|
||||||
.register_action(|_, _action: &CheckThatAutoUpdaterWorks, cx| {
|
|
||||||
let prompt = cx.prompt(gpui::PromptLevel::Info, "It does!", &["Ok"]);
|
|
||||||
cx.spawn(|_, _cx| async move {
|
|
||||||
prompt.await.ok();
|
|
||||||
})
|
|
||||||
.detach();
|
|
||||||
});
|
|
||||||
|
|
||||||
// @nate - code to trigger update notification on launch
|
// @nate - code to trigger update notification on launch
|
||||||
// workspace.show_notification(0, _cx, |cx| {
|
// workspace.show_notification(0, _cx, |cx| {
|
||||||
|
@ -130,9 +122,15 @@ pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut AppCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check(_: &Check, cx: &mut AppContext) {
|
pub fn check(_: &Check, cx: &mut ViewContext<Workspace>) {
|
||||||
if let Some(updater) = AutoUpdater::get(cx) {
|
if let Some(updater) = AutoUpdater::get(cx) {
|
||||||
updater.update(cx, |updater, cx| updater.poll(cx));
|
updater.update(cx, |updater, cx| updater.poll(cx));
|
||||||
|
} else {
|
||||||
|
drop(cx.prompt(
|
||||||
|
gpui::PromptLevel::Info,
|
||||||
|
"Auto-updates disabled for non-bundled app.",
|
||||||
|
&["Ok"],
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue