dave: bubble note actions to chrome
This allows chrome to pass note actions to other apps
This commit is contained in:
@@ -12,7 +12,7 @@ use crate::{
|
||||
Result,
|
||||
};
|
||||
|
||||
use notedeck::{Accounts, AppContext, DataPath, DataPathType, FilterState, UnknownIds};
|
||||
use notedeck::{Accounts, AppAction, AppContext, DataPath, DataPathType, FilterState, UnknownIds};
|
||||
use notedeck_ui::NoteOptions;
|
||||
|
||||
use enostr::{ClientMessage, Keypair, PoolRelay, Pubkey, RelayEvent, RelayMessage, RelayPool};
|
||||
@@ -639,7 +639,7 @@ fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus, ctx: &mut App
|
||||
}
|
||||
|
||||
impl notedeck::App for Damus {
|
||||
fn update(&mut self, ctx: &mut AppContext<'_>, ui: &mut egui::Ui) {
|
||||
fn update(&mut self, ctx: &mut AppContext<'_>, ui: &mut egui::Ui) -> Option<AppAction> {
|
||||
/*
|
||||
self.app
|
||||
.frame_history
|
||||
@@ -648,6 +648,8 @@ impl notedeck::App for Damus {
|
||||
|
||||
update_damus(self, ctx, ui.ctx());
|
||||
render_damus(self, ctx, ui);
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ mod search;
|
||||
mod subscriptions;
|
||||
mod support;
|
||||
mod test_data;
|
||||
mod timeline;
|
||||
pub mod timeline;
|
||||
pub mod ui;
|
||||
mod unknowns;
|
||||
mod view_state;
|
||||
|
||||
@@ -5,8 +5,7 @@ use egui::{
|
||||
};
|
||||
use egui::{Layout, TextEdit};
|
||||
use enostr::Keypair;
|
||||
use notedeck::fonts::get_font_size;
|
||||
use notedeck::NotedeckTextStyle;
|
||||
use notedeck::{fonts::get_font_size, AppAction, NotedeckTextStyle};
|
||||
|
||||
pub struct AccountLoginView<'a> {
|
||||
manager: &'a mut AcquireKeyState,
|
||||
@@ -155,8 +154,14 @@ mod preview {
|
||||
}
|
||||
|
||||
impl App for AccountLoginPreview {
|
||||
fn update(&mut self, _app_ctx: &mut AppContext<'_>, ui: &mut egui::Ui) {
|
||||
fn update(
|
||||
&mut self,
|
||||
_app_ctx: &mut AppContext<'_>,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<AppAction> {
|
||||
AccountLoginView::new(&mut self.manager).ui(ui);
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ mod preview {
|
||||
};
|
||||
|
||||
use super::ConfigureDeckView;
|
||||
use notedeck::{App, AppContext};
|
||||
use notedeck::{App, AppAction, AppContext};
|
||||
|
||||
pub struct ConfigureDeckPreview {
|
||||
state: DeckState,
|
||||
@@ -316,8 +316,14 @@ mod preview {
|
||||
}
|
||||
|
||||
impl App for ConfigureDeckPreview {
|
||||
fn update(&mut self, _app_ctx: &mut AppContext<'_>, ui: &mut egui::Ui) {
|
||||
fn update(
|
||||
&mut self,
|
||||
_app_ctx: &mut AppContext<'_>,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<AppAction> {
|
||||
ConfigureDeckView::new(&mut self.state).ui(ui);
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ mod preview {
|
||||
};
|
||||
|
||||
use super::EditDeckView;
|
||||
use notedeck::{App, AppContext};
|
||||
use notedeck::{App, AppAction, AppContext};
|
||||
|
||||
pub struct EditDeckPreview {
|
||||
state: DeckState,
|
||||
@@ -75,8 +75,13 @@ mod preview {
|
||||
}
|
||||
|
||||
impl App for EditDeckPreview {
|
||||
fn update(&mut self, _app_ctx: &mut AppContext<'_>, ui: &mut egui::Ui) {
|
||||
fn update(
|
||||
&mut self,
|
||||
_app_ctx: &mut AppContext<'_>,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<AppAction> {
|
||||
EditDeckView::new(&mut self.state).ui(ui);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -691,7 +691,7 @@ mod preview {
|
||||
use crate::media_upload::Nip94Event;
|
||||
|
||||
use super::*;
|
||||
use notedeck::{App, AppContext};
|
||||
use notedeck::{App, AppAction, AppContext};
|
||||
|
||||
pub struct PostPreview {
|
||||
draft: Draft,
|
||||
@@ -730,7 +730,7 @@ mod preview {
|
||||
}
|
||||
|
||||
impl App for PostPreview {
|
||||
fn update(&mut self, app: &mut AppContext<'_>, ui: &mut egui::Ui) {
|
||||
fn update(&mut self, app: &mut AppContext<'_>, ui: &mut egui::Ui) -> Option<AppAction> {
|
||||
let txn = Transaction::new(app.ndb).expect("txn");
|
||||
let mut note_context = NoteContext {
|
||||
ndb: app.ndb,
|
||||
@@ -749,6 +749,8 @@ mod preview {
|
||||
NoteOptions::default(),
|
||||
)
|
||||
.ui(&txn, ui);
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use notedeck::AppAction;
|
||||
|
||||
pub struct PreviewConfig {
|
||||
pub is_mobile: bool,
|
||||
}
|
||||
@@ -20,7 +22,12 @@ impl PreviewApp {
|
||||
}
|
||||
|
||||
impl notedeck::App for PreviewApp {
|
||||
fn update(&mut self, app_ctx: &mut notedeck::AppContext<'_>, ui: &mut egui::Ui) {
|
||||
fn update(
|
||||
&mut self,
|
||||
app_ctx: &mut notedeck::AppContext<'_>,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<AppAction> {
|
||||
self.view.update(app_ctx, ui);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ fn button(text: &str, width: f32) -> egui::Button<'static> {
|
||||
}
|
||||
|
||||
mod preview {
|
||||
use notedeck::App;
|
||||
use notedeck::{App, AppAction};
|
||||
|
||||
use crate::{
|
||||
profile_state::ProfileState,
|
||||
@@ -190,8 +190,13 @@ mod preview {
|
||||
}
|
||||
|
||||
impl App for EditProfilePreivew {
|
||||
fn update(&mut self, ctx: &mut notedeck::AppContext<'_>, ui: &mut egui::Ui) {
|
||||
fn update(
|
||||
&mut self,
|
||||
ctx: &mut notedeck::AppContext<'_>,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<AppAction> {
|
||||
EditProfileView::new(&mut self.state, ctx.img_cache).ui(ui);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ fn get_connection_icon(status: RelayStatus) -> egui::Image<'static> {
|
||||
mod preview {
|
||||
use super::*;
|
||||
use crate::test_data::sample_pool;
|
||||
use notedeck::{App, AppContext};
|
||||
use notedeck::{App, AppAction, AppContext};
|
||||
|
||||
pub struct RelayViewPreview {
|
||||
pool: RelayPool,
|
||||
@@ -289,7 +289,7 @@ mod preview {
|
||||
}
|
||||
|
||||
impl App for RelayViewPreview {
|
||||
fn update(&mut self, app: &mut AppContext<'_>, ui: &mut egui::Ui) {
|
||||
fn update(&mut self, app: &mut AppContext<'_>, ui: &mut egui::Ui) -> Option<AppAction> {
|
||||
self.pool.try_recv();
|
||||
let mut id_string_map = HashMap::new();
|
||||
RelayView::new(
|
||||
@@ -298,6 +298,7 @@ mod preview {
|
||||
&mut id_string_map,
|
||||
)
|
||||
.ui(ui);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user