Remove dummy store

This commit is contained in:
Joscha 2022-06-23 22:25:23 +02:00
parent e0db158ece
commit 28263e6a5c
5 changed files with 8 additions and 175 deletions

View file

@ -13,7 +13,7 @@ use toss::terminal::Terminal;
use crate::chat::Chat;
use crate::euph;
use crate::logger::{LogMsg, Logger};
use crate::store::dummy::{DummyMsg, DummyStore};
use crate::vault::{EuphMsg, EuphVault, Vault};
#[derive(Debug)]
pub enum UiEvent {
@ -33,10 +33,11 @@ enum Visible {
pub struct Ui {
event_tx: UnboundedSender<UiEvent>,
vault: Vault,
visible: Visible,
room: euph::Room,
chat: Chat<DummyMsg, DummyStore>,
chat: Chat<EuphMsg, EuphVault>,
log_chat: Chat<LogMsg, Logger>,
}
@ -45,6 +46,7 @@ impl Ui {
pub async fn run(
terminal: &mut Terminal,
vault: Vault,
logger: Logger,
logger_rx: mpsc::UnboundedReceiver<()>,
) -> anyhow::Result<()> {
@ -58,20 +60,7 @@ impl Ui {
Self::poll_crossterm_events(event_tx_clone, weak_crossterm_lock)
});
// Prepare dummy message store and chat for testing
let store = DummyStore::new()
.msg(DummyMsg::new(1, "nick", "content"))
.msg(DummyMsg::new(2, "Some1Else", "reply").parent(1))
.msg(DummyMsg::new(3, "Some1Else", "deeper reply").parent(2))
.msg(DummyMsg::new(4, "abc123", "even deeper reply").parent(3))
.msg(DummyMsg::new(5, "Some1Else", "another reply").parent(1))
.msg(DummyMsg::new(6, "Some1Else", "third reply").parent(1))
.msg(DummyMsg::new(8, "nick", "reply to nothing").parent(7))
.msg(DummyMsg::new(9, "nick", "another reply to nothing").parent(7))
.msg(DummyMsg::new(10, "abc123", "reply to reply to nothing").parent(8))
.msg(DummyMsg::new(11, "nick", "yet another reply to nothing").parent(7))
.msg(DummyMsg::new(12, "abc123", "beep\nboop").parent(11));
let chat = Chat::new(store);
let chat = Chat::new(vault.euph("test".to_string()));
// Run main UI.
//
@ -84,6 +73,7 @@ impl Ui {
// the rest of the UI is also shut down and the client stops.
let mut ui = Self {
event_tx: event_tx.clone(),
vault,
visible: Visible::Log,
room: euph::Room::new("test".to_string()),
chat,