feat: refactor async task and remove tokio as dep

This commit is contained in:
2025-02-18 16:43:30 +07:00
parent 48af00950a
commit 85c485a4e4
17 changed files with 421 additions and 484 deletions

View File

@@ -1,5 +1,4 @@
use anyhow::anyhow;
use async_utility::tokio::sync::oneshot;
use common::utils::{compare, room_hash, signer_public_key};
use gpui::{App, AppContext, Context, Entity, Global};
use itertools::Itertools;
@@ -31,8 +30,10 @@ impl ChatRegistry {
pub fn register(cx: &mut App) -> Entity<Self> {
Self::global(cx).unwrap_or_else(|| {
let entity = cx.new(Self::new);
// Set global state
cx.set_global(GlobalChatRegistry(entity.clone()));
// Observe and load metadata for any new rooms
cx.observe_new::<Room>(|this, _window, cx| {
let client = get_client();