feat(settings): persist settings to storage

This commit is contained in:
Fernando López Guevara
2025-07-23 23:04:49 -03:00
committed by William Casarin
parent 5280028a82
commit b8207106d7
9 changed files with 339 additions and 67 deletions

View File

@@ -21,7 +21,7 @@ use crate::{
note::{custom_zap::CustomZapView, NewPostAction, PostAction, PostType, QuoteRepostView},
profile::EditProfileView,
search::{FocusState, SearchView},
settings::{SettingsAction, ShowNoteClientOptions},
settings::SettingsAction,
support::SupportView,
wallet::{get_default_zap_state, WalletAction, WalletState, WalletView},
AccountsView, PostReplyView, PostView, ProfileView, RelayView, SettingsView, ThreadView,
@@ -30,6 +30,8 @@ use crate::{
Damus,
};
use crate::ui::settings::ShowNoteClientOption;
use egui_nav::{Nav, NavAction, NavResponse, NavUiType, Percent, PopupResponse, PopupSheet};
use enostr::ProfileState;
use nostrdb::{Filter, Ndb, Transaction};
@@ -37,7 +39,6 @@ use notedeck::{
get_current_default_msats, tr, ui::is_narrow, Accounts, AppContext, NoteAction, NoteContext,
RelayAction,
};
use notedeck_ui::NoteOptions;
use tracing::error;
/// The result of processing a nav response
@@ -486,9 +487,13 @@ fn process_render_nav_action(
.process_relay_action(ui.ctx(), ctx.pool, action);
None
}
RenderNavAction::SettingsAction(action) => {
action.process_settings_action(app, ctx.theme, ctx.i18n, ctx.img_cache, ui.ctx())
}
RenderNavAction::SettingsAction(action) => action.process_settings_action(
app,
ctx.settings_handler,
ctx.i18n,
ctx.img_cache,
ui.ctx(),
),
};
if let Some(action) = router_action {
@@ -583,14 +588,7 @@ fn render_nav_body(
.map(RenderNavAction::RelayAction),
Route::Settings => {
let mut show_note_client = if app.note_options.contains(NoteOptions::ShowNoteClientTop)
{
ShowNoteClientOptions::Top
} else if app.note_options.contains(NoteOptions::ShowNoteClientBottom) {
ShowNoteClientOptions::Bottom
} else {
ShowNoteClientOptions::Hide
};
let mut show_note_client: ShowNoteClientOption = app.note_options.into();
let mut theme: String = (if ui.visuals().dark_mode {
"Dark"