refactor
This commit is contained in:
@@ -81,6 +81,17 @@ impl Workspace {
|
||||
|
||||
let mut subscriptions = smallvec![];
|
||||
|
||||
subscriptions.push(
|
||||
// Observe sign in state changes
|
||||
cx.observe_in(&nostr, window, move |this, nostr, window, cx| {
|
||||
if nostr.read(cx).current_user().is_some() {
|
||||
this.set_center_layout(window, cx);
|
||||
} else {
|
||||
this.import_identity(window, cx);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
subscriptions.push(
|
||||
// Observe system appearance and update theme
|
||||
cx.observe_window_appearance(window, |_this, window, cx| {
|
||||
@@ -90,7 +101,7 @@ impl Workspace {
|
||||
|
||||
subscriptions.push(
|
||||
// Subscribe to the nostr events
|
||||
cx.subscribe_in(&nostr, window, move |_this, _state, event, window, cx| {
|
||||
cx.subscribe_in(&nostr, window, move |this, _state, event, window, cx| {
|
||||
match event {
|
||||
StateEvent::Connecting => {
|
||||
let note = Notification::new()
|
||||
@@ -108,6 +119,10 @@ impl Workspace {
|
||||
|
||||
window.push_notification(note, cx);
|
||||
}
|
||||
StateEvent::SignerChanged => {
|
||||
this.set_center_layout(window, cx);
|
||||
window.close_all_modals(cx);
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -462,7 +462,7 @@ impl Sidebar {
|
||||
});
|
||||
|
||||
RoomEntry::new(range.start + ix)
|
||||
.name(profile.name())
|
||||
.name(profile.name().trim())
|
||||
.avatar(profile.avatar())
|
||||
.on_click(handler)
|
||||
.selected(selected)
|
||||
|
||||
Reference in New Issue
Block a user