commit 4469918fd2a0be6803483cfdcffcae38447de633
parent cb7a3adacf5c84e6d9d0ec74c94c186a3d5e39c5
Author: William Casarin <jb55@jb55.com>
Date: Wed, 26 Mar 2025 09:20:46 -0700
dave: prepare for android
Diffstat:
8 files changed, 70 insertions(+), 211 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -1031,7 +1031,7 @@ dependencies = [
"bitflags 1.3.2",
"core-foundation 0.9.4",
"core-graphics-types",
- "foreign-types 0.5.0",
+ "foreign-types",
"libc",
]
@@ -1496,15 +1496,6 @@ dependencies = [
]
[[package]]
-name = "encoding_rs"
-version = "0.8.35"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
name = "endi"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1745,21 +1736,12 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "foreign-types"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
-dependencies = [
- "foreign-types-shared 0.1.1",
-]
-
-[[package]]
-name = "foreign-types"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"
dependencies = [
"foreign-types-macros",
- "foreign-types-shared 0.3.1",
+ "foreign-types-shared",
]
[[package]]
@@ -1775,12 +1757,6 @@ dependencies = [
[[package]]
name = "foreign-types-shared"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
-
-[[package]]
-name = "foreign-types-shared"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
@@ -2112,25 +2088,6 @@ dependencies = [
]
[[package]]
-name = "h2"
-version = "0.4.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75249d144030531f8dee69fe9cea04d3edf809a017ae445e2abdff6629e86633"
-dependencies = [
- "atomic-waker",
- "bytes",
- "fnv",
- "futures-core",
- "futures-sink",
- "http",
- "indexmap",
- "slab",
- "tokio",
- "tokio-util",
- "tracing",
-]
-
-[[package]]
name = "half"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2269,7 +2226,6 @@ dependencies = [
"bytes",
"futures-channel",
"futures-util",
- "h2",
"http",
"http-body",
"httparse",
@@ -2299,22 +2255,6 @@ dependencies = [
]
[[package]]
-name = "hyper-tls"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
-dependencies = [
- "bytes",
- "http-body-util",
- "hyper",
- "hyper-util",
- "native-tls",
- "tokio",
- "tokio-native-tls",
- "tower-service",
-]
-
-[[package]]
name = "hyper-util"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2881,7 +2821,7 @@ dependencies = [
"bitflags 2.9.0",
"block",
"core-graphics-types",
- "foreign-types 0.5.0",
+ "foreign-types",
"log",
"objc",
"paste",
@@ -2964,23 +2904,6 @@ dependencies = [
]
[[package]]
-name = "native-tls"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e"
-dependencies = [
- "libc",
- "log",
- "openssl",
- "openssl-probe",
- "openssl-sys",
- "schannel",
- "security-framework 2.11.1",
- "security-framework-sys",
- "tempfile",
-]
-
-[[package]]
name = "natord"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3306,7 +3229,6 @@ dependencies = [
"nostrdb",
"notedeck",
"rand 0.9.0",
- "reqwest",
"serde",
"serde_json",
"time",
@@ -3699,50 +3621,12 @@ dependencies = [
]
[[package]]
-name = "openssl"
-version = "0.10.72"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da"
-dependencies = [
- "bitflags 2.9.0",
- "cfg-if",
- "foreign-types 0.3.2",
- "libc",
- "once_cell",
- "openssl-macros",
- "openssl-sys",
-]
-
-[[package]]
-name = "openssl-macros"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
name = "openssl-probe"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
-name = "openssl-sys"
-version = "0.9.107"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4398,23 +4282,19 @@ checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb"
dependencies = [
"base64 0.22.1",
"bytes",
- "encoding_rs",
"futures-core",
"futures-util",
- "h2",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-rustls",
- "hyper-tls",
"hyper-util",
"ipnet",
"js-sys",
"log",
"mime",
"mime_guess",
- "native-tls",
"once_cell",
"percent-encoding",
"pin-project-lite",
@@ -4427,9 +4307,7 @@ dependencies = [
"serde_json",
"serde_urlencoded",
"sync_wrapper",
- "system-configuration",
"tokio",
- "tokio-native-tls",
"tokio-rustls",
"tokio-util",
"tower",
@@ -5141,27 +5019,6 @@ dependencies = [
]
[[package]]
-name = "system-configuration"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"
-dependencies = [
- "bitflags 2.9.0",
- "core-foundation 0.9.4",
- "system-configuration-sys",
-]
-
-[[package]]
-name = "system-configuration-sys"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
name = "system-deps"
version = "6.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5380,16 +5237,6 @@ dependencies = [
]
[[package]]
-name = "tokio-native-tls"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
-dependencies = [
- "native-tls",
- "tokio",
-]
-
-[[package]]
name = "tokio-rustls"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5853,12 +5700,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
[[package]]
-name = "vcpkg"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
-
-[[package]]
name = "vec1"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/crates/notedeck_chrome/Cargo.toml b/crates/notedeck_chrome/Cargo.toml
@@ -3,7 +3,7 @@ name = "notedeck_chrome"
version = { workspace = true }
authors = ["William Casarin <jb55@jb55.com>", "kernelkind <kernelkind@gmail.com>"]
edition = "2021"
-default-run = "notedeck"
+#default-run = "notedeck"
#rust-version = "1.60"
license = "GPLv3"
description = "The nostr browser"
diff --git a/crates/notedeck_chrome/src/android.rs b/crates/notedeck_chrome/src/android.rs
@@ -3,8 +3,9 @@
use egui_winit::winit::platform::android::activity::AndroidApp;
use notedeck_columns::Damus;
+use notedeck_dave::Dave;
-use crate::setup::setup_chrome;
+use crate::{setup::setup_chrome, chrome::Chrome};
use notedeck::Notedeck;
use serde_json::Value;
use std::fs;
@@ -13,7 +14,7 @@ use std::path::PathBuf;
#[no_mangle]
#[tokio::main]
pub async fn android_main(app: AndroidApp) {
- use tracing_logcat::{LogcatMakeWriter, LogcatTag};
+ //use tracing_logcat::{LogcatMakeWriter, LogcatTag};
use tracing_subscriber::{prelude::*, EnvFilter};
std::env::set_var("RUST_BACKTRACE", "full");
@@ -24,8 +25,8 @@ pub async fn android_main(app: AndroidApp) {
// "enostr=debug,notedeck_columns=debug,notedeck_chrome=debug",
//);
- let writer =
- LogcatMakeWriter::new(LogcatTag::Target).expect("Failed to initialize logcat writer");
+ //let writer =
+ //LogcatMakeWriter::new(LogcatTag::Target).expect("Failed to initialize logcat writer");
let fmt_layer = tracing_subscriber::fmt::layer()
.with_level(false)
@@ -62,12 +63,15 @@ pub async fn android_main(app: AndroidApp) {
let mut notedeck = Notedeck::new(ctx, path, &app_args);
setup_chrome(ctx, ¬edeck.args(), notedeck.theme());
- let damus = Damus::new(&mut notedeck.app_context(), &app_args);
+ let context = &mut notedeck.app_context();
+ let dave = Dave::new(cc.wgpu_render_state.as_ref());
+ let columns = Damus::new(context, &app_args);
+ let mut chrome = Chrome::new();
// ensure we recognized all the arguments
let completely_unrecognized: Vec<String> = notedeck
.unrecognized_args()
- .intersection(damus.unrecognized_args())
+ .intersection(columns.unrecognized_args())
.cloned()
.collect();
assert!(
@@ -76,7 +80,13 @@ pub async fn android_main(app: AndroidApp) {
completely_unrecognized
);
- notedeck.set_app(damus);
+ chrome.add_app(columns);
+ chrome.add_app(dave);
+
+ // test dav
+ chrome.set_active(1);
+
+ notedeck.set_app(chrome);
Ok(Box::new(notedeck))
}),
diff --git a/crates/notedeck_chrome/src/chrome.rs b/crates/notedeck_chrome/src/chrome.rs
@@ -0,0 +1,37 @@
+
+// Entry point for wasm
+//#[cfg(target_arch = "wasm32")]
+//use wasm_bindgen::prelude::*;
+
+pub struct Chrome {
+ active: i32,
+ apps: Vec<Box<dyn notedeck::App>>,
+}
+
+impl Chrome {
+ pub fn new() -> Self {
+ Chrome {
+ active: 0,
+ apps: vec![],
+ }
+ }
+
+ pub fn add_app(&mut self, app: impl notedeck::App + 'static) {
+ self.apps.push(Box::new(app));
+ }
+
+ pub fn set_active(&mut self, app: i32) {
+ self.active = app;
+ }
+}
+
+impl notedeck::App for Chrome {
+ fn update(&mut self, ctx: &mut notedeck::AppContext, ui: &mut egui::Ui) {
+ let active = self.active;
+ self.apps[active as usize].update(ctx, ui);
+ //for i in 0..self.apps.len() {
+ // self.apps[i].update(ctx, ui);
+ //}
+ }
+}
+
diff --git a/crates/notedeck_chrome/src/lib.rs b/crates/notedeck_chrome/src/lib.rs
@@ -4,3 +4,7 @@ pub mod theme;
#[cfg(target_os = "android")]
mod android;
+
+mod chrome;
+
+pub use chrome::Chrome;
diff --git a/crates/notedeck_chrome/src/notedeck.rs b/crates/notedeck_chrome/src/notedeck.rs
@@ -1,49 +1,16 @@
-#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
+//#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
// hide console window on Windows in release
-use notedeck_chrome::setup::{generate_native_options, setup_chrome};
use notedeck::{DataPath, DataPathType, Notedeck};
+use notedeck_chrome::{
+ setup::{generate_native_options, setup_chrome},
+ Chrome,
+};
use notedeck_columns::Damus;
use notedeck_dave::Dave;
use tracing_appender::non_blocking::WorkerGuard;
use tracing_subscriber::EnvFilter;
-// Entry point for wasm
-//#[cfg(target_arch = "wasm32")]
-//use wasm_bindgen::prelude::*;
-
-struct Chrome {
- active: i32,
- apps: Vec<Box<dyn notedeck::App>>,
-}
-
-impl Chrome {
- pub fn new() -> Self {
- Chrome {
- active: 0,
- apps: vec![],
- }
- }
-
- pub fn add_app(&mut self, app: impl notedeck::App + 'static) {
- self.apps.push(Box::new(app));
- }
-
- pub fn set_active(&mut self, app: i32) {
- self.active = app;
- }
-}
-
-impl notedeck::App for Chrome {
- fn update(&mut self, ctx: &mut notedeck::AppContext, ui: &mut egui::Ui) {
- let active = self.active;
- self.apps[active as usize].update(ctx, ui);
- //for i in 0..self.apps.len() {
- // self.apps[i].update(ctx, ui);
- //}
- }
-}
-
fn setup_logging(path: &DataPath) -> Option<WorkerGuard> {
#[allow(unused_variables)] // need guard to live for lifetime of program
let (maybe_non_blocking, maybe_guard) = {
diff --git a/crates/notedeck_dave/Cargo.toml b/crates/notedeck_dave/Cargo.toml
@@ -19,4 +19,4 @@ time = "0.3.41"
rand = "0.9.0"
bytemuck = "1.22.0"
futures = "0.3.31"
-reqwest = "0.12.15"
+#reqwest = "0.12.15"
diff --git a/crates/notedeck_dave/src/lib.rs b/crates/notedeck_dave/src/lib.rs
@@ -394,8 +394,8 @@ impl Dave {
});
if let Some(avatar) = &mut self.avatar {
- let avatar_size = Vec2::splat(100.0);
- let pos = Vec2::splat(10.0).to_pos2();
+ let avatar_size = Vec2::splat(300.0);
+ let pos = Vec2::splat(100.0).to_pos2();
let pos = Rect::from_min_max(pos, pos + avatar_size);
avatar.render(pos, ui);
}