diff --git a/src/app.rs b/src/app.rs index 9ea9c5bb..c5ae0b2f 100644 --- a/src/app.rs +++ b/src/app.rs @@ -7,6 +7,7 @@ use anyhow::Result; use radicle::cob::issue::IssueId; use radicle::cob::patch::PatchId; use radicle::identity::{Id, Project}; +use radicle::prelude::Signer; use radicle::profile::Profile; use radicle_tui::ui::widget; @@ -113,9 +114,9 @@ pub struct App { /// Creates a new application using a tui-realm-application, mounts all /// components and sets focus to a default one. impl App { - pub fn new(profile: Profile, id: Id, project: Project) -> Self { + pub fn new(profile: Profile, id: Id, project: Project, signer: Box) -> Self { Self { - context: Context::new(profile, id, project), + context: Context::new(profile, id, project, signer), pages: PageStack::default(), theme: theme::default_dark(), quit: false, diff --git a/src/main.rs b/src/main.rs index 5ece2393..cb545a52 100644 --- a/src/main.rs +++ b/src/main.rs @@ -104,7 +104,7 @@ fn execute() -> anyhow::Result<()> { info!("Launching window..."); let mut window = Window::default(); - window.run(&mut app::App::new(profile, id, project), 1000 / FPS)?; + window.run(&mut app::App::new(profile, id, project, signer), 1000 / FPS)?; Ok(()) } diff --git a/src/ui/context.rs b/src/ui/context.rs index d396596c..e672ea3c 100644 --- a/src/ui/context.rs +++ b/src/ui/context.rs @@ -1,6 +1,6 @@ use radicle::cob::issue::{Issue, IssueId}; use radicle::cob::patch::{Patch, PatchId}; -use radicle::prelude::{Id, Project}; +use radicle::prelude::{Id, Project, Signer}; use radicle::Profile; use radicle::storage::git::Repository; @@ -12,10 +12,11 @@ pub struct Context { repository: Repository, issues: Vec<(IssueId, Issue)>, patches: Vec<(PatchId, Patch)>, + signer: Box, } impl Context { - pub fn new(profile: Profile, id: Id, project: Project) -> Self { + pub fn new(profile: Profile, id: Id, project: Project, signer: Box) -> Self { let repository = profile.storage.repository(id).unwrap(); let issues = crate::cob::issue::all(&repository).unwrap_or_default(); let patches = crate::cob::patch::all(&repository).unwrap_or_default(); @@ -27,6 +28,7 @@ impl Context { repository, issues, patches, + signer, } } @@ -53,4 +55,9 @@ impl Context { pub fn patches(&self) -> &Vec<(PatchId, Patch)> { &self.patches } + + #[allow(clippy::borrowed_box)] + pub fn signer(&self) -> &Box { + &self.signer + } }