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:
@@ -19,15 +19,13 @@ pub fn render_timeline_route(
|
||||
accounts: &mut Accounts,
|
||||
kind: &TimelineKind,
|
||||
col: usize,
|
||||
textmode: bool,
|
||||
mut note_options: NoteOptions,
|
||||
depth: usize,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<RenderNavAction> {
|
||||
let note_options = {
|
||||
let mut options = NoteOptions::new(kind == &TimelineKind::Universe);
|
||||
options.set_textmode(textmode);
|
||||
options
|
||||
};
|
||||
if kind == &TimelineKind::Universe {
|
||||
note_options.set_hide_media(true);
|
||||
}
|
||||
|
||||
match kind {
|
||||
TimelineKind::List(_)
|
||||
@@ -63,6 +61,7 @@ pub fn render_timeline_route(
|
||||
col,
|
||||
ui,
|
||||
&accounts.mutefun(),
|
||||
note_options,
|
||||
)
|
||||
} else {
|
||||
// we render profiles like timelines if they are at the root
|
||||
@@ -88,7 +87,7 @@ pub fn render_timeline_route(
|
||||
unknown_ids,
|
||||
img_cache,
|
||||
id.selected_or_root(),
|
||||
textmode,
|
||||
note_options,
|
||||
&accounts.mutefun(),
|
||||
)
|
||||
.id_source(egui::Id::new(("threadscroll", col)))
|
||||
@@ -109,6 +108,7 @@ pub fn render_profile_route(
|
||||
col: usize,
|
||||
ui: &mut egui::Ui,
|
||||
is_muted: &MuteFun,
|
||||
note_options: NoteOptions,
|
||||
) -> Option<RenderNavAction> {
|
||||
let action = ProfileView::new(
|
||||
pubkey,
|
||||
@@ -120,7 +120,7 @@ pub fn render_profile_route(
|
||||
img_cache,
|
||||
unknown_ids,
|
||||
is_muted,
|
||||
NoteOptions::default(),
|
||||
note_options,
|
||||
)
|
||||
.ui(ui);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user