add NotedeckOptions and feature flags, add notebook feature
This switches from bools to flags in our Args struct. We also add notebook as an optional feature flag (--notebook) since its not ready.
This commit is contained in:
@@ -97,7 +97,13 @@ pub async fn android_main(app: AndroidApp) {
|
||||
|
||||
chrome.add_app(NotedeckApp::Columns(Box::new(columns)));
|
||||
chrome.add_app(NotedeckApp::Dave(Box::new(dave)));
|
||||
chrome.add_app(NotedeckApp::Notebook(Box::new(notebook)));
|
||||
|
||||
if notedeck
|
||||
.options()
|
||||
.contains(NotedeckOptions::FeaturesNotebook)
|
||||
{
|
||||
chrome.add_app(NotedeckApp::Notebook(Box::default()));
|
||||
}
|
||||
|
||||
// test dav
|
||||
chrome.set_active(0);
|
||||
|
||||
@@ -6,7 +6,8 @@ use egui::{vec2, Button, Color32, Label, Layout, Rect, RichText, ThemePreference
|
||||
use egui_extras::{Size, StripBuilder};
|
||||
use nostrdb::{ProfileRecord, Transaction};
|
||||
use notedeck::{
|
||||
tr, App, AppAction, AppContext, Localization, NotedeckTextStyle, UserAccount, WalletType,
|
||||
tr, App, AppAction, AppContext, Localization, NotedeckOptions, NotedeckTextStyle, UserAccount,
|
||||
WalletType,
|
||||
};
|
||||
use notedeck_columns::{
|
||||
column::SelectionResult, timeline::kind::ListKind, timeline::TimelineKind, Damus,
|
||||
@@ -612,10 +613,10 @@ fn accounts_button(ui: &mut egui::Ui) -> egui::Response {
|
||||
|
||||
fn notebook_button(ui: &mut egui::Ui) -> egui::Response {
|
||||
expanding_button(
|
||||
"columns-button",
|
||||
"notebook-button",
|
||||
40.0,
|
||||
app_images::new_message_image(),
|
||||
app_images::new_message_image(),
|
||||
app_images::algo_image(),
|
||||
app_images::algo_image(),
|
||||
ui,
|
||||
)
|
||||
}
|
||||
@@ -898,7 +899,7 @@ fn bottomup_sidebar(
|
||||
.add(wallet_button())
|
||||
.on_hover_cursor(egui::CursorIcon::PointingHand);
|
||||
|
||||
if ctx.args.debug {
|
||||
if ctx.args.options.contains(NotedeckOptions::Debug) {
|
||||
ui.weak(format!("{}", ctx.frame_history.fps() as i32));
|
||||
ui.weak(format!(
|
||||
"{:10.1}",
|
||||
|
||||
@@ -10,14 +10,13 @@ static GLOBAL: AccountingAllocator<std::alloc::System> =
|
||||
AccountingAllocator::new(std::alloc::System);
|
||||
|
||||
use notedeck::enostr::Error;
|
||||
use notedeck::{DataPath, DataPathType, Notedeck};
|
||||
use notedeck::{DataPath, DataPathType, Notedeck, NotedeckOptions};
|
||||
use notedeck_chrome::{
|
||||
setup::{generate_native_options, setup_chrome},
|
||||
Chrome, NotedeckApp,
|
||||
};
|
||||
use notedeck_columns::Damus;
|
||||
use notedeck_dave::Dave;
|
||||
use notedeck_notebook::Notebook;
|
||||
use tracing::error;
|
||||
use tracing_appender::non_blocking::WorkerGuard;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
@@ -98,7 +97,6 @@ async fn main() {
|
||||
let mut chrome = Chrome::new();
|
||||
let columns = Damus::new(&mut notedeck.app_context(), &args);
|
||||
let dave = Dave::new(cc.wgpu_render_state.as_ref());
|
||||
let notebook = Notebook::default();
|
||||
|
||||
setup_chrome(
|
||||
ctx,
|
||||
@@ -121,7 +119,13 @@ async fn main() {
|
||||
|
||||
chrome.add_app(NotedeckApp::Columns(Box::new(columns)));
|
||||
chrome.add_app(NotedeckApp::Dave(Box::new(dave)));
|
||||
chrome.add_app(NotedeckApp::Notebook(Box::new(notebook)));
|
||||
|
||||
if notedeck
|
||||
.options()
|
||||
.contains(NotedeckOptions::FeatureNotebook)
|
||||
{
|
||||
chrome.add_app(NotedeckApp::Notebook(Box::default()));
|
||||
}
|
||||
|
||||
chrome.set_active(0);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::{fonts, theme};
|
||||
|
||||
use eframe::NativeOptions;
|
||||
use egui::{FontId, ThemePreference};
|
||||
use notedeck::{AppSizeHandler, DataPath, NotedeckTextStyle};
|
||||
use notedeck::{AppSizeHandler, DataPath, NotedeckOptions, NotedeckTextStyle};
|
||||
use notedeck_ui::app_images;
|
||||
use tracing::info;
|
||||
|
||||
@@ -13,16 +13,20 @@ pub fn setup_chrome(
|
||||
note_body_font_size: f32,
|
||||
zoom_factor: f32,
|
||||
) {
|
||||
let is_mobile = args
|
||||
.is_mobile
|
||||
.unwrap_or(notedeck::ui::is_compiled_as_mobile());
|
||||
let is_mobile =
|
||||
args.options.contains(NotedeckOptions::Mobile) || notedeck::ui::is_compiled_as_mobile();
|
||||
|
||||
let is_oled = notedeck::ui::is_oled();
|
||||
|
||||
// Some people have been running notedeck in debug, let's catch that!
|
||||
if !args.tests && cfg!(debug_assertions) && !args.debug {
|
||||
if !args.options.contains(NotedeckOptions::Tests)
|
||||
&& cfg!(debug_assertions)
|
||||
&& !args.options.contains(NotedeckOptions::Debug)
|
||||
{
|
||||
println!("--- WELCOME TO DAMUS NOTEDECK! ---");
|
||||
println!("It looks like are running notedeck in debug mode, unless you are a developer, this is not likely what you want.");
|
||||
println!(
|
||||
"It looks like are running notedeck in debug mode, unless you are a developer, this is not likely what you want."
|
||||
);
|
||||
println!("If you are a developer, run `cargo run -- --debug` to skip this message.");
|
||||
println!("For everyone else, try again with `cargo run --release`. Enjoy!");
|
||||
println!("---------------------------------");
|
||||
|
||||
Reference in New Issue
Block a user