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:
@@ -76,8 +76,11 @@ impl<'a> NoteView<'a> {
|
||||
note_cache: &'a mut NoteCache,
|
||||
img_cache: &'a mut ImageCache,
|
||||
note: &'a nostrdb::Note<'a>,
|
||||
mut flags: NoteOptions,
|
||||
) -> Self {
|
||||
let flags = NoteOptions::actionbar | NoteOptions::note_previews;
|
||||
flags.set_actionbar(true);
|
||||
flags.set_note_previews(true);
|
||||
|
||||
let parent: Option<NoteKey> = None;
|
||||
Self {
|
||||
ndb,
|
||||
@@ -89,11 +92,6 @@ impl<'a> NoteView<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn note_options(mut self, options: NoteOptions) -> Self {
|
||||
*self.options_mut() = options;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn textmode(mut self, enable: bool) -> Self {
|
||||
self.options_mut().set_textmode(enable);
|
||||
self
|
||||
@@ -287,7 +285,14 @@ impl<'a> NoteView<'a> {
|
||||
.text_style(style.text_style()),
|
||||
);
|
||||
});
|
||||
NoteView::new(self.ndb, self.note_cache, self.img_cache, ¬e_to_repost).show(ui)
|
||||
NoteView::new(
|
||||
self.ndb,
|
||||
self.note_cache,
|
||||
self.img_cache,
|
||||
¬e_to_repost,
|
||||
self.flags,
|
||||
)
|
||||
.show(ui)
|
||||
} else {
|
||||
self.show_standard(ui)
|
||||
}
|
||||
@@ -393,6 +398,7 @@ impl<'a> NoteView<'a> {
|
||||
self.ndb,
|
||||
self.img_cache,
|
||||
self.note_cache,
|
||||
self.flags,
|
||||
)
|
||||
})
|
||||
.inner;
|
||||
@@ -464,6 +470,7 @@ impl<'a> NoteView<'a> {
|
||||
self.ndb,
|
||||
self.img_cache,
|
||||
self.note_cache,
|
||||
self.flags,
|
||||
);
|
||||
|
||||
if action.is_some() {
|
||||
|
||||
Reference in New Issue
Block a user