Simplify workspace notification code (#23414)
* Remove `NotificationHandle` trait in favor of just passing `AnyView` - id field wasn't used. * Remove `show_notification_once`, doesn't seem to be needed for its only use. Release Notes: - N/A
This commit is contained in:
parent
8c215d43ad
commit
64f9acf020
2 changed files with 8 additions and 91 deletions
|
@ -47,9 +47,7 @@ use itertools::Itertools;
|
|||
use language::{LanguageRegistry, Rope};
|
||||
pub use modal_layer::*;
|
||||
use node_runtime::NodeRuntime;
|
||||
use notifications::{
|
||||
simple_message_notification::MessageNotification, DetachAndPromptErr, NotificationHandle,
|
||||
};
|
||||
use notifications::{simple_message_notification::MessageNotification, DetachAndPromptErr};
|
||||
pub use pane::*;
|
||||
pub use pane_group::*;
|
||||
pub use persistence::{
|
||||
|
@ -370,7 +368,6 @@ fn prompt_and_open_paths(
|
|||
|
||||
pub fn init(app_state: Arc<AppState>, cx: &mut AppContext) {
|
||||
init_settings(cx);
|
||||
notifications::init(cx);
|
||||
theme_preview::init(cx);
|
||||
|
||||
cx.on_action(Workspace::close_global);
|
||||
|
@ -785,7 +782,7 @@ pub struct Workspace {
|
|||
status_bar: View<StatusBar>,
|
||||
modal_layer: View<ModalLayer>,
|
||||
titlebar_item: Option<AnyView>,
|
||||
notifications: Vec<(NotificationId, Box<dyn NotificationHandle>)>,
|
||||
notifications: Vec<(NotificationId, AnyView)>,
|
||||
project: Model<Project>,
|
||||
follower_states: HashMap<PeerId, FollowerState>,
|
||||
last_leaders_by_pane: HashMap<WeakView<Pane>, PeerId>,
|
||||
|
@ -3640,7 +3637,7 @@ impl Workspace {
|
|||
.children(
|
||||
self.notifications
|
||||
.iter()
|
||||
.map(|(_, notification)| notification.to_any()),
|
||||
.map(|(_, notification)| notification.clone().into_any()),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
@ -4895,7 +4892,7 @@ fn notify_if_database_failed(workspace: WindowHandle<Workspace>, cx: &mut AsyncA
|
|||
if (*db::ALL_FILE_DB_FAILED).load(std::sync::atomic::Ordering::Acquire) {
|
||||
struct DatabaseFailedNotification;
|
||||
|
||||
workspace.show_notification_once(
|
||||
workspace.show_notification(
|
||||
NotificationId::unique::<DatabaseFailedNotification>(),
|
||||
cx,
|
||||
|cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue