mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-22 10:44:20 +01:00
feat: add scramble flag for development text scrambling
This commit introduces a new scramble option to help reduce distractions
during development by scrambling text using rot13. When enabled via the
new `--scramble` flag, text displayed in various views is transformed,
making it easier to focus on layout and behavior without reading the
actual content.
App & Args Updates
- Added a `scramble: bool` field to the main application state (in `app.rs`).
- Extended argument parsing (in `args.rs`) to recognize the `--scramble` flag.
NoteOptions Enhancement
- Introduced a new bit flag `scramble_text` in `NoteOptions` with
corresponding setter/getter methods.
UI Adjustments
- Propagated the scramble flag through note rendering functions across
navigation, timeline, and note view modules.
- Updated several UI components (e.g., in `nav.rs`, `route.rs`, and
`contents.rs`) to accept and apply the new note options.
Rot13 Implementation
- Implemented a helper function (`rot13`) to scramble text
conditionally when the scramble option is enabled.
This feature is intended for development builds only, offering a way to
obscure text content during UI tweaks and testing.
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -16,7 +16,7 @@ use crate::{
|
||||
column::NavTitle,
|
||||
configure_deck::ConfigureDeckView,
|
||||
edit_deck::{EditDeckResponse, EditDeckView},
|
||||
note::{PostAction, PostType},
|
||||
note::{NoteOptions, PostAction, PostType},
|
||||
profile::EditProfileView,
|
||||
support::SupportView,
|
||||
RelayView, View,
|
||||
@@ -243,6 +243,13 @@ fn render_nav_body(
|
||||
col: usize,
|
||||
inner_rect: egui::Rect,
|
||||
) -> Option<RenderNavAction> {
|
||||
let note_options = {
|
||||
let mut options = NoteOptions::default();
|
||||
options.set_textmode(app.textmode);
|
||||
options.set_scramble_text(app.scramble);
|
||||
options
|
||||
};
|
||||
|
||||
match top {
|
||||
Route::Timeline(kind) => render_timeline_route(
|
||||
ctx.ndb,
|
||||
@@ -253,7 +260,7 @@ fn render_nav_body(
|
||||
ctx.accounts,
|
||||
kind,
|
||||
col,
|
||||
app.textmode,
|
||||
note_options,
|
||||
depth,
|
||||
ui,
|
||||
),
|
||||
@@ -310,6 +317,7 @@ fn render_nav_body(
|
||||
ctx.img_cache,
|
||||
¬e,
|
||||
inner_rect,
|
||||
note_options,
|
||||
)
|
||||
.id_source(id)
|
||||
.show(ui)
|
||||
@@ -345,6 +353,7 @@ fn render_nav_body(
|
||||
draft,
|
||||
¬e,
|
||||
inner_rect,
|
||||
note_options,
|
||||
)
|
||||
.id_source(id)
|
||||
.show(ui)
|
||||
@@ -366,6 +375,7 @@ fn render_nav_body(
|
||||
ctx.note_cache,
|
||||
kp,
|
||||
inner_rect,
|
||||
note_options,
|
||||
)
|
||||
.ui(&txn, ui);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user