notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

view_state.rs (1043B)


      1 use std::collections::HashMap;
      2 
      3 use enostr::Pubkey;
      4 
      5 use crate::deck_state::DeckState;
      6 use crate::login_manager::AcquireKeyState;
      7 use crate::ui::search::SearchQueryState;
      8 use enostr::ProfileState;
      9 use notedeck_ui::media::MediaViewerState;
     10 
     11 /// Various state for views
     12 ///
     13 /// TODO(jb55): we likely want to encapsulate these better,
     14 /// or at least document where they are used
     15 #[derive(Default)]
     16 pub struct ViewState {
     17     pub login: AcquireKeyState,
     18     pub id_to_deck_state: HashMap<egui::Id, DeckState>,
     19     pub id_state_map: HashMap<egui::Id, AcquireKeyState>,
     20     pub id_string_map: HashMap<egui::Id, String>,
     21     pub searches: HashMap<egui::Id, SearchQueryState>,
     22     pub pubkey_to_profile_state: HashMap<Pubkey, ProfileState>,
     23 
     24     /// Keeps track of what urls we are actively viewing in the
     25     /// fullscreen media viewier, as well as any other state we want to
     26     /// keep track of
     27     pub media_viewer: MediaViewerState,
     28 }
     29 
     30 impl ViewState {
     31     pub fn login_mut(&mut self) -> &mut AcquireKeyState {
     32         &mut self.login
     33     }
     34 }