diff --git a/Cargo.toml b/Cargo.toml
index ded1960..0050bd0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,43 +5,74 @@ edition = "2021"
[features]
default = []
-desktop = ["dioxus/desktop"]
-web = ["dioxus/web"]
[dependencies]
-dioxus = "0.5.*"
-dioxus-free-icons = { version = "0.8", features = ["material-design-icons-navigation", "ionicons"] }
-dioxus-sdk = { version = "0.5.*", features = ["utils"] }
-
-# matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk.git", branch = "main", default-features = false, features = ["js", "rustls-tls"] }
-matrix-sdk = { version = "0.7.*", default-features = false, features = ["js", "rustls-tls"] }
-
+# Errors
anyhow = "1.0.75"
-url = "2.5.0"
-dirs = "5.0.1"
-ctrlc-async = "3.2.2"
thiserror = "1.0.50"
-turf = "0.8.*"
-tokio = { version = "1.34.0", default-features = false, features = ["rt", "sync"] }
-log = "0.4.20"
-futures-util = "0.3.29"
-futures = "0.3.29"
-rand = "0.8.5"
-reqwest = "0.11.24"
-validator = { version = "0.17.0", features = ["derive"] }
-const_format = "0.2.32"
-zxcvbn = "2.2.2"
+
+# Async
async-std = "1.12.0"
-tracing = "0.1.40"
-tracing-web = "0.1.3"
-tracing-subscriber = "0.3.18"
+async-trait = "0.1.80"
+futures = "0.3.29"
+futures-util = "0.3.29"
+tokio = { version = "1.34.0", default-features = false, features = ["rt", "sync"] }
+tokio-stream = "0.1.15"
+
+# Utils
+base64 = "0.22.0"
+const_format = "0.2.32"
+rand = "0.8.5"
+validator = { version = "0.17.0", features = ["derive"] }
+# Http client
+reqwest = "0.11.24"
+# Password strength estimation
+zxcvbn = "2.2.2"
+# Image processing/conversion
+image = "0.25.1"
+# Get the application version
git-version = "0.3.9"
+# Conditional compilation
+cfg-if = "1.0.0"
+
+# Logging/tracing
+tracing = "0.1.40"
+tracing-forest = "0.1.6"
+
+# SCSS -> CSS + usage in rust code
+turf = "0.8.0"
+
+# Dioxus
+dioxus = { version = "0.5", default-features = false }
+dioxus-free-icons = { version = "0.8", features = ["ionicons", "font-awesome-solid"] }
+modx = "0.1.2"
+
+[patch.crates-io]
+dioxus = { git = "https://github.com/DioxusLabs/dioxus.git" }
[target.'cfg(target_family = "wasm")'.dependencies]
+# Logging/tracing
+tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
+tracing-web = "0.1.3"
+# Dioxus
+dioxus = { features = ["web"] }
web-sys = "0.3.69"
+# Matrix
+matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk.git", default-features = false, features = ["rustls-tls", "js"] }
+
+[target.'cfg(not(target_family = "wasm"))'.dependencies]
+# Utils
+time = "0.3.36"
+# Logging/tracing
+tracing-subscriber = { version = "0.3.18", features = ["env-filter", "time"] }
+# Dioxus
+dioxus = { features = ["desktop"] }
+# Matrix
+matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk.git", default-features = false, features = ["rustls-tls"] }
[build-dependencies]
regex = "1.10.3"
+
[package.metadata.turf]
minify = true
diff --git a/public/images/add_user.png b/public/images/add_user.png
deleted file mode 100644
index f13708a..0000000
Binary files a/public/images/add_user.png and /dev/null differ
diff --git a/public/images/add_user2.png b/public/images/add_user2.png
deleted file mode 100644
index 82eea87..0000000
Binary files a/public/images/add_user2.png and /dev/null differ
diff --git a/public/images/aerobutton_border.png b/public/images/aerobutton_border.png
deleted file mode 100644
index 1f1c388..0000000
Binary files a/public/images/aerobutton_border.png and /dev/null differ
diff --git a/public/images/aerobutton_border_down.png b/public/images/aerobutton_border_down.png
deleted file mode 100644
index 656a1f3..0000000
Binary files a/public/images/aerobutton_border_down.png and /dev/null differ
diff --git a/public/images/ban_user.png b/public/images/ban_user.png
deleted file mode 100644
index 1a679ed..0000000
Binary files a/public/images/ban_user.png and /dev/null differ
diff --git a/public/images/brush.png b/public/images/brush.png
deleted file mode 100644
index c5e2ff4..0000000
Binary files a/public/images/brush.png and /dev/null differ
diff --git a/public/images/button_border.png b/public/images/button_border.png
deleted file mode 100644
index 2102a4c..0000000
Binary files a/public/images/button_border.png and /dev/null differ
diff --git a/public/images/button_border_disabled.png b/public/images/button_border_disabled.png
deleted file mode 100644
index a5a0298..0000000
Binary files a/public/images/button_border_disabled.png and /dev/null differ
diff --git a/public/images/button_border_focus.png b/public/images/button_border_focus.png
deleted file mode 100644
index 83f333f..0000000
Binary files a/public/images/button_border_focus.png and /dev/null differ
diff --git a/public/images/default-avatar.png b/public/images/default-avatar.png
deleted file mode 100644
index 295d49d..0000000
Binary files a/public/images/default-avatar.png and /dev/null differ
diff --git a/public/images/directory.png b/public/images/directory.png
deleted file mode 100644
index 061952d..0000000
Binary files a/public/images/directory.png and /dev/null differ
diff --git a/public/images/games.png b/public/images/games.png
deleted file mode 100644
index 11cfa77..0000000
Binary files a/public/images/games.png and /dev/null differ
diff --git a/public/images/letter.png b/public/images/letter.png
deleted file mode 100644
index 6d10b8e..0000000
Binary files a/public/images/letter.png and /dev/null differ
diff --git a/public/images/logo-msn.png b/public/images/logo-msn.png
deleted file mode 100644
index 9590615..0000000
Binary files a/public/images/logo-msn.png and /dev/null differ
diff --git a/public/images/medias.png b/public/images/medias.png
deleted file mode 100644
index b5db00b..0000000
Binary files a/public/images/medias.png and /dev/null differ
diff --git a/public/images/news.png b/public/images/news.png
deleted file mode 100644
index 1063df2..0000000
Binary files a/public/images/news.png and /dev/null differ
diff --git a/public/images/phone.png b/public/images/phone.png
deleted file mode 100644
index ce1af32..0000000
Binary files a/public/images/phone.png and /dev/null differ
diff --git a/public/images/settings.png b/public/images/settings.png
deleted file mode 100644
index 6a23c2b..0000000
Binary files a/public/images/settings.png and /dev/null differ
diff --git a/public/images/status_away.png b/public/images/status_away.png
deleted file mode 100644
index 39486a6..0000000
Binary files a/public/images/status_away.png and /dev/null differ
diff --git a/public/images/status_busy.png b/public/images/status_busy.png
deleted file mode 100644
index 471ff6b..0000000
Binary files a/public/images/status_busy.png and /dev/null differ
diff --git a/public/images/status_online.png b/public/images/status_online.png
deleted file mode 100644
index dd53972..0000000
Binary files a/public/images/status_online.png and /dev/null differ
diff --git a/public/images/tbc_transfert.png b/public/images/tbc_transfert.png
deleted file mode 100644
index 4ec8570..0000000
Binary files a/public/images/tbc_transfert.png and /dev/null differ
diff --git a/public/images/webcam.svg b/public/images/webcam.svg
deleted file mode 100644
index 7c3f49d..0000000
--- a/public/images/webcam.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/images/wizz.png.old b/public/images/wizz.png.old
deleted file mode 100644
index d7b1d5d..0000000
Binary files a/public/images/wizz.png.old and /dev/null differ
diff --git a/src/base.rs b/src/base.rs
deleted file mode 100644
index 515beca..0000000
--- a/src/base.rs
+++ /dev/null
@@ -1,197 +0,0 @@
-// Cf. https://dioxuslabs.com/learn/0.4/reference/use_coroutine
-// In order to use/run the rx.next().await statement you will need to extend the [Stream] trait
-// (used by [UnboundedReceiver]) by adding 'futures_util' as a dependency to your project
-// and adding the use futures_util::stream::StreamExt;
-use std::cell::RefCell;
-
-use dioxus::prelude::*;
-use futures_util::stream::StreamExt;
-use log::{debug, error, warn};
-use matrix_sdk::ruma::OwnedRoomId;
-use tokio::select;
-
-use crate::domain::model::room::{ByIdRooms, Room};
-use crate::domain::model::session::Session;
-use crate::infrastructure::messaging::matrix::client::{Client, RoomEvent};
-use crate::infrastructure::messaging::matrix::requester::{Receivers, Requester};
-use crate::infrastructure::messaging::matrix::worker_tasks::LoginStyle;
-use crate::ui::components::chats_window::interface::Interface as ChatsWinInterface;
-
-// #[derive(Clone, Debug)]
-// pub struct UserInfo {
-// pub avatar_url: Option,
-// pub display_name: Option,
-// pub blurhash: Option,
-// }
-
-// impl UserInfo {
-// pub fn new(
-// avatar_url: Option,
-// display_name: Option,
-// blurhash: Option,
-// ) -> Self {
-// Self {
-// avatar_url,
-// display_name,
-// blurhash,
-// }
-// }
-// }
-
-// pub type ByIdUserInfos = HashMap;
-
-// #[derive(Clone)]
-// pub struct Store {
-// pub is_logged: bool,
-// pub rooms: ByIdRooms,
-// pub user_infos: ByIdUserInfos,
-// pub user_id: Option,
-// }
-
-// impl Store {
-// pub fn new() -> Self {
-// Self {
-// is_logged: false,
-// rooms: HashMap::new(),
-// user_infos: HashMap::new(),
-// user_id: None,
-// }
-// }
-// }
-
-// impl PartialEq for Store {
-// fn eq(&self, other: &Self) -> bool {
-// self.is_logged == other.is_logged
-// && self.user_id == other.user_id
-// && self.user_infos.len() == other.user_infos.len()
-// && self
-// .user_infos
-// .keys()
-// .all(|k| other.user_infos.contains_key(k))
-// && self.rooms.len() == other.rooms.len()
-// && self.rooms.keys().all(|k| other.rooms.contains_key(k))
-// }
-// }
-
-// impl Eq for Store {}
-
-pub struct AppSettings {
- pub requester: Option>,
-}
-
-impl AppSettings {
- pub fn new() -> Self {
- Self { requester: None }
- }
-
- pub fn set_requester(&mut self, requester: RefCell) {
- self.requester = Some(requester);
- }
-}
-
-async fn on_room(room_id: OwnedRoomId, room: Room, by_id_rooms: &GlobalSignal) {
- // TODO: Update rooms
- by_id_rooms
- .write()
- .insert(room_id, RefCell::::new(room));
-}
-
-async fn on_joining_invitation(
- room_id: OwnedRoomId,
- room: Room,
- by_id_rooms: &GlobalSignal,
-) {
- debug!("You're invited to join the \"{}\" room", room.id());
- // TODO: Update rooms
- by_id_rooms
- .write()
- .insert(room_id, RefCell::::new(room));
-}
-
-async fn on_room_topic(room_id: OwnedRoomId, topic: String, by_id_rooms: &GlobalSignal) {
- if let Some(room) = by_id_rooms.read().get(&room_id) {
- let mut room = room.borrow_mut();
- room.set_topic(Some(topic));
- } else {
- warn!("No room found with the \"{}\" id", room_id);
- }
-}
-
-pub async fn sync_messages(by_id_rooms: &GlobalSignal, room_id: OwnedRoomId) {
- error!("== sync_messages ==");
-
-}
-
-pub async fn sync_rooms(
- mut rx: UnboundedReceiver,
- receivers: Receivers,
- by_id_rooms: &GlobalSignal,
-) {
- if let Some(_is_logged) = rx.next().await {
- let mut rooms_receiver = receivers.room_receiver.borrow_mut();
-
- loop {
- // TODO: Remove select if no more receivers will be used.
- select! {
- res = rooms_receiver.recv() => {
- if let Ok(room_event) = res {
- match room_event {
- RoomEvent::MemberEvent(room_id, room) => on_room(room_id, room, &by_id_rooms).await,
- RoomEvent::InviteEvent(room_id, room) => on_joining_invitation(room_id, room, &by_id_rooms).await,
- RoomEvent::TopicEvent(room_id, topic) => on_room_topic(room_id, topic, &by_id_rooms).await,
- };
- }
- },
- }
- }
- }
-}
-
-pub async fn login(
- mut rx: UnboundedReceiver,
- app_settings: &GlobalSignal,
- session: &GlobalSignal,
-) {
- while let Some(is_logged) = rx.next().await {
- if !is_logged {
- let homeserver_url = session.read().homeserver_url.clone();
- let username = session.read().username.clone();
- let password = session.read().password.clone();
-
- if homeserver_url.is_some() && username.is_some() && password.is_some() {
- let client = Client::spawn(homeserver_url.unwrap()).await;
-
- if let Err(err) = client.init().await {
- error!("Following error occureds during client init: {}", err);
- }
-
- match client
- .login(LoginStyle::Password(username.unwrap(), password.unwrap()))
- .await
- {
- Ok(_) => {
- debug!("successfully logged");
- session.write().is_logged = true;
- }
- Err(err) => {
- error!("Error during login: {err}");
- // TODO: Handle invalid login
- // invalid_login.modify(|_| true);
- }
- }
- app_settings.write().set_requester(RefCell::new(client));
- } else {
- warn!("At least one of the following values is/are invalid: homeserver, username or password");
- }
- } else {
- warn!("already logged... skip login");
- }
- }
- error!("=== LOGIN END ===");
-}
-
-pub static APP_SETTINGS: GlobalSignal = Signal::global(AppSettings::new);
-pub static ROOMS: GlobalSignal = Signal::global(ByIdRooms::new);
-pub static SESSION: GlobalSignal = Signal::global(Session::new);
-pub static CHATS_WIN_INTERFACE: GlobalSignal =
- Signal::global(ChatsWinInterface::new);
diff --git a/src/domain/model/account.rs b/src/domain/model/account.rs
new file mode 100644
index 0000000..642c829
--- /dev/null
+++ b/src/domain/model/account.rs
@@ -0,0 +1,136 @@
+use std::{cell::RefCell, collections::HashMap, rc::Rc};
+
+use async_trait::async_trait;
+use tracing::{error, instrument, trace};
+
+use super::{
+ common::PresenceState,
+ messaging_interface::{
+ AccountMessagingConsumerInterface, AccountMessagingProviderInterface,
+ RoomMessagingConsumerInterface, SpaceMessagingConsumerInterface,
+ },
+ room::{Room, RoomId},
+ space::{Space, SpaceId},
+ store_interface::{
+ AccountStoreProviderInterface, RoomStoreConsumerInterface, SpaceStoreConsumerInterface,
+ },
+};
+
+type Rooms = HashMap>;
+type Spaces = HashMap>;
+
+pub struct Account {
+ display_name: RefCell