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