init notebook

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin committed 2025-07-31 15:07:50 -07:00
1 parent a8c6baeacb
commit 1ab4eeb48c
10 files changed
+556 -24

No files matched your search

Generated
+147 -12
View File
@@ -1008,6 +1008,7 @@ dependencies = [
"iana-time-zone",
"js-sys",
"num-traits",
"serde",
"wasm-bindgen",
"windows-link",
]
@@ -1263,6 +1264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e"
dependencies = [
"powerfmt",
"serde",
]
[[package]]
@@ -1408,6 +1410,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"
[[package]]
name = "dyn-clone"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
[[package]]
name = "ecolor"
version = "0.31.1"
@@ -1626,7 +1634,7 @@ version = "0.3.0"
dependencies = [
"bech32",
"ewebsock",
"hashbrown",
"hashbrown 0.15.4",
"hex",
"mio",
"nostr 0.37.0",
@@ -2300,7 +2308,7 @@ checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"
dependencies = [
"bitflags 2.9.1",
"gpu-descriptor-types",
"hashbrown",
"hashbrown 0.15.4",
]
[[package]]
@@ -2322,6 +2330,12 @@ dependencies = [
"crunchy",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.15.4"
@@ -2366,6 +2380,17 @@ dependencies = [
"arrayvec",
]
[[package]]
name = "hex_color"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d37f101bf4c633f7ca2e4b5e136050314503dd198e78e325ea602c327c484ef0"
dependencies = [
"arrayvec",
"rand 0.8.5",
"serde",
]
[[package]]
name = "hex_lit"
version = "0.1.1"
@@ -2695,6 +2720,17 @@ version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408"
[[package]]
name = "indexmap"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
"serde",
]
[[package]]
name = "indexmap"
version = "2.9.0"
@@ -2702,7 +2738,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
dependencies = [
"equivalent",
"hashbrown",
"hashbrown 0.15.4",
"serde",
]
@@ -2890,6 +2926,19 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "jsoncanvas"
version = "0.1.6"
source = "git+https://github.com/jb55/jsoncanvas?rev=ae60f96e4d022cf037e086b793cacc3225bc14e5#ae60f96e4d022cf037e086b793cacc3225bc14e5"
dependencies = [
"hex_color",
"serde",
"serde_json",
"serde_with",
"thiserror 1.0.69",
"url",
]
[[package]]
name = "khronos-egl"
version = "6.0.0"
@@ -3212,7 +3261,7 @@ dependencies = [
"cfg_aliases",
"codespan-reporting",
"hexf-parse",
"indexmap",
"indexmap 2.9.0",
"log",
"rustc-hash 1.1.0",
"spirv",
@@ -3445,7 +3494,7 @@ dependencies = [
"fluent",
"fluent-langneg",
"fluent-resmgr",
"hashbrown",
"hashbrown 0.15.4",
"hex",
"image",
"jni 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3490,6 +3539,7 @@ dependencies = [
"notedeck",
"notedeck_columns",
"notedeck_dave",
"notedeck_notebook",
"notedeck_ui",
"profiling",
"puffin",
@@ -3523,11 +3573,11 @@ dependencies = [
"egui_virtual_list",
"ehttp",
"enostr",
"hashbrown",
"hashbrown 0.15.4",
"hex",
"human_format",
"image",
"indexmap",
"indexmap 2.9.0",
"nostrdb",
"notedeck",
"notedeck_ui",
@@ -3584,6 +3634,15 @@ dependencies = [
"tracing",
]
[[package]]
name = "notedeck_notebook"
version = "0.5.9"
dependencies = [
"egui",
"jsoncanvas",
"notedeck",
]
[[package]]
name = "notedeck_ui"
version = "0.5.9"
@@ -3595,7 +3654,7 @@ dependencies = [
"egui_extras",
"ehttp",
"enostr",
"hashbrown",
"hashbrown 0.15.4",
"image",
"nostrdb",
"notedeck",
@@ -4424,7 +4483,7 @@ source = "git+https://github.com/jb55/puffin?rev=c6a6242adaf90b6292c0f462d2acd34
dependencies = [
"egui",
"egui_extras",
"indexmap",
"indexmap 2.9.0",
"natord",
"once_cell",
"parking_lot",
@@ -4752,6 +4811,26 @@ dependencies = [
"thiserror 1.0.69",
]
[[package]]
name = "ref-cast"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf"
dependencies = [
"ref-cast-impl",
]
[[package]]
name = "ref-cast-impl"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.104",
]
[[package]]
name = "regex"
version = "1.11.1"
@@ -5113,6 +5192,30 @@ dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "schemars"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f"
dependencies = [
"dyn-clone",
"ref-cast",
"serde",
"serde_json",
]
[[package]]
name = "schemars"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
dependencies = [
"dyn-clone",
"ref-cast",
"serde",
"serde_json",
]
[[package]]
name = "scoped-tls"
version = "1.0.1"
@@ -5266,7 +5369,7 @@ version = "1.0.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
dependencies = [
"indexmap",
"indexmap 2.9.0",
"itoa",
"memchr",
"ryu",
@@ -5305,6 +5408,38 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_with"
version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5"
dependencies = [
"base64 0.22.1",
"chrono",
"hex",
"indexmap 1.9.3",
"indexmap 2.9.0",
"schemars 0.9.0",
"schemars 1.0.4",
"serde",
"serde_derive",
"serde_json",
"serde_with_macros",
"time",
]
[[package]]
name = "serde_with_macros"
version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f"
dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 2.0.104",
]
[[package]]
name = "sha1"
version = "0.10.6"
@@ -5905,7 +6040,7 @@ version = "0.22.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [
"indexmap",
"indexmap 2.9.0",
"serde",
"serde_spanned",
"toml_datetime",
@@ -6688,7 +6823,7 @@ dependencies = [
"bitflags 2.9.1",
"cfg_aliases",
"document-features",
"indexmap",
"indexmap 2.9.0",
"log",
"naga",
"once_cell",
+2
View File
@@ -6,6 +6,7 @@ members = [
"crates/notedeck_chrome",
"crates/notedeck_columns",
"crates/notedeck_dave",
"crates/notedeck_notebook",
"crates/notedeck_ui",
"crates/enostr", "crates/tokenator", "crates/notedeck_dave", "crates/notedeck_ui",
@@ -48,6 +49,7 @@ notedeck = { path = "crates/notedeck" }
notedeck_chrome = { path = "crates/notedeck_chrome" }
notedeck_columns = { path = "crates/notedeck_columns" }
notedeck_dave = { path = "crates/notedeck_dave" }
notedeck_notebook = { path = "crates/notedeck_notebook" }
notedeck_ui = { path = "crates/notedeck_ui" }
tokenator = { path = "crates/tokenator" }
once_cell = "1.19.0"
+1
View File
@@ -16,6 +16,7 @@ egui = { workspace = true }
notedeck_columns = { workspace = true }
notedeck_ui = { workspace = true }
notedeck_dave = { workspace = true }
notedeck_notebook = { workspace = true }
notedeck = { workspace = true }
nostrdb = { workspace = true }
puffin = { workspace = true, optional = true }
+5 -2
View File
@@ -5,6 +5,7 @@ use egui_winit::winit::platform::android::activity::AndroidApp;
use notedeck::enostr::Error;
use notedeck_columns::Damus;
use notedeck_dave::Dave;
use notedeck_notebook::Notebook;
use crate::{app::NotedeckApp, chrome::Chrome, setup::setup_chrome};
use notedeck::Notedeck;
@@ -80,6 +81,7 @@ pub async fn android_main(app: AndroidApp) {
let context = &mut notedeck.app_context();
let dave = Dave::new(cc.wgpu_render_state.as_ref());
let columns = Damus::new(context, &app_args);
let notebook = Notebook::new();
let mut chrome = Chrome::new();
// ensure we recognized all the arguments
@@ -93,8 +95,9 @@ pub async fn android_main(app: AndroidApp) {
return Err(Error::Empty.into());
}
chrome.add_app(NotedeckApp::Columns(columns));
chrome.add_app(NotedeckApp::Dave(dave));
chrome.add_app(NotedeckApp::Columns(Box::new(columns)));
chrome.add_app(NotedeckApp::Dave(Box::new(dave)));
chrome.add_app(NotedeckApp::Notebook(Box::new(notebook)));
// test dav
chrome.set_active(0);
+5 -2
View File
@@ -1,11 +1,13 @@
use notedeck::{AppAction, AppContext};
use notedeck_columns::Damus;
use notedeck_dave::Dave;
use notedeck_notebook::Notebook;
#[allow(clippy::large_enum_variant)]
pub enum NotedeckApp {
Dave(Dave),
Columns(Damus),
Dave(Box<Dave>),
Columns(Box<Damus>),
Notebook(Box<Notebook>),
Other(Box<dyn notedeck::App>),
}
@@ -14,6 +16,7 @@ impl notedeck::App for NotedeckApp {
match self {
NotedeckApp::Dave(dave) => dave.update(ctx, ui),
NotedeckApp::Columns(columns) => columns.update(ctx, ui),
NotedeckApp::Notebook(notebook) => notebook.update(ctx, ui),
NotedeckApp::Other(other) => other.update(ctx, ui),
}
}
+43 -6
View File
@@ -12,6 +12,7 @@ use notedeck_columns::{
column::SelectionResult, timeline::kind::ListKind, timeline::TimelineKind, Damus,
};
use notedeck_dave::{Dave, DaveAvatar};
use notedeck_notebook::Notebook;
use notedeck_ui::{app_images, AnimationHelper, ProfilePic};
static ICON_WIDTH: f32 = 40.0;
@@ -199,6 +200,16 @@ impl Chrome {
None
}
fn get_notebook(&mut self) -> Option<&mut Notebook> {
for app in &mut self.apps {
if let NotedeckApp::Notebook(notebook) = app {
return Some(notebook);
}
}
None
}
fn switch_to_dave(&mut self) {
for (i, app) in self.apps.iter().enumerate() {
if let NotedeckApp::Dave(_) = app {
@@ -207,6 +218,14 @@ impl Chrome {
}
}
fn switch_to_notebook(&mut self) {
for (i, app) in self.apps.iter().enumerate() {
if let NotedeckApp::Notebook(_) = app {
self.active = i as i32;
}
}
}
fn switch_to_columns(&mut self) {
for (i, app) in self.apps.iter().enumerate() {
if let NotedeckApp::Columns(_) = app {
@@ -428,13 +447,11 @@ impl Chrome {
ui.add(milestone_name(i18n));
ui.add_space(16.0);
//let dark_mode = ui.ctx().style().visuals.dark_mode;
if columns_button(ui)
.on_hover_cursor(egui::CursorIcon::PointingHand)
.clicked()
{
if columns_button(ui)
.on_hover_cursor(egui::CursorIcon::PointingHand)
.clicked()
{
self.active = 0;
}
self.active = 0;
}
ui.add_space(32.0);
@@ -446,6 +463,16 @@ impl Chrome {
self.switch_to_dave();
}
}
//ui.add_space(32.0);
if let Some(_notebook) = self.get_notebook() {
if notebook_button(ui)
.on_hover_cursor(egui::CursorIcon::PointingHand)
.clicked()
{
self.switch_to_notebook();
}
}
}
}
@@ -583,6 +610,16 @@ fn accounts_button(ui: &mut egui::Ui) -> egui::Response {
)
}
fn notebook_button(ui: &mut egui::Ui) -> egui::Response {
expanding_button(
"columns-button",
40.0,
app_images::new_message_image(),
app_images::new_message_image(),
ui,
)
}
fn dave_sidebar_rect(ui: &mut egui::Ui) -> Rect {
let size = vec2(60.0, 60.0);
let available = ui.available_rect_before_wrap();
+5 -2
View File
@@ -17,6 +17,7 @@ use notedeck_chrome::{
};
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;
@@ -97,6 +98,7 @@ 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,
@@ -117,8 +119,9 @@ async fn main() {
return Err(Error::Empty.into());
}
chrome.add_app(NotedeckApp::Columns(columns));
chrome.add_app(NotedeckApp::Dave(dave));
chrome.add_app(NotedeckApp::Columns(Box::new(columns)));
chrome.add_app(NotedeckApp::Dave(Box::new(dave)));
chrome.add_app(NotedeckApp::Notebook(Box::new(notebook)));
chrome.set_active(0);
+9
View File
@@ -0,0 +1,9 @@
[package]
name = "notedeck_notebook"
edition = "2024"
version.workspace = true
[dependencies]
jsoncanvas = { git = "https://github.com/jb55/jsoncanvas", rev = "ae60f96e4d022cf037e086b793cacc3225bc14e5" }
notedeck = { workspace = true }
egui = { workspace = true }
+232
View File
@@ -0,0 +1,232 @@
{
"nodes": [
{
"id": "c450e9832ffe7a3d",
"type": "text",
"text": "```\nIncident Identifier: 3AAF0AF2-37A5-4104-957C-D0205F54B5BB\nDistributor ID: com.apple.TestFlight\nHardware Model: iPhone15,2\nProcess: DamusNotificationService [15759]\nPath: /private/var/containers/Bundle/Application/58C02D0F-9151-4F13-BD68-547D0D89A8E6/damus.app/PlugIns/DamusNotificationService.appex/DamusNotificationService\nIdentifier: com.jb55.damus2.DamusNotificationService\nVersion: 1.15 (1048)\nAppVariant: 1:iPhone15,2:18\nBeta: YES\nCode Type: ARM-64 (Native)\nRole: Unspecified\nParent Process: launchd [1]\nCoalition: com.jb55.damus2.DamusNotificationService [7022]\n\nDate/Time: 2025-07-14 12:26:33.8942 -1000\nLaunch Time: 2025-07-14 12:15:17.0329 -1000\nOS Version: iPhone OS 18.5 (22F76)\nRelease Type: User\nBaseband Version: 3.60.02\nReport Version: 104\n\nException Type: EXC_CRASH (SIGKILL)\nException Codes: 0x0000000000000000, 0x0000000000000000\nTermination Reason: RUNNINGBOARD 0xdead10cc \n\nTriggered by Thread: 0\n\n\nThread 0 name:\nThread 0 Crashed:\n0 libsystem_kernel.dylib \t0x00000001d9dc7ce4 mach_msg2_trap + 8\n1 libsystem_kernel.dylib \t0x00000001d9dcb39c mach_msg2_internal + 76 (mach_msg.c:201)\n2 libsystem_kernel.dylib \t0x00000001d9dcb2b8 mach_msg_overwrite + 428 (mach_msg.c:0)\n3 libsystem_kernel.dylib \t0x00000001d9dcb100 mach_msg + 24 (mach_msg.c:323)\n4 CoreFoundation \t0x0000000188bba900 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)\n5 CoreFoundation \t0x0000000188bb91f0 __CFRunLoopRun + 1208 (CFRunLoop.c:3021)\n6 CoreFoundation \t0x0000000188bbac3c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3434)\n7 Foundation \t0x000000018783279c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:375)\n8 Foundation \t0x0000000187837108 -[NSRunLoop(NSRunLoop) run] + 64 (NSRunLoop.m:400)\n9 libxpc.dylib \t0x0000000213332d34 _xpc_objc_main + 336 (main.m:267)\n10 libxpc.dylib \t0x00000002133352a4 _xpc_main + 64 (init.c:1293)\n11 libxpc.dylib \t0x0000000213335484 xpc_main + 64 (init.c:1376)\n12 Foundation \t0x00000001879409dc -[NSXPCListener resume] + 308 (NSXPCListener.m:471)\n13 PlugInKit \t0x00000001b9e67f84 -[PKService runUsingServiceListener:] + 364 (PKService.m:219)\n14 PlugInKit \t0x00000001b9e67e10 -[PKService run] + 20 (PKService.m:185)\n15 PlugInKit \t0x00000001b9e67adc +[PKService main] + 520 (PKService.m:126)\n16 PlugInKit \t0x00000001b9e682d8 +[PKService _defaultRun:arguments:] + 16 (PKService.m:265)\n17 ExtensionFoundation \t0x000000019816fc20 EXExtensionMain + 288 (EXExtensionMain.m:0)\n18 Foundation \t0x00000001879ac274 NSExtensionMain + 200 (NSExtensionMain.m:21)\n19 dyld \t0x00000001afa8ff08 start + 6040 (dyldMain.cpp:1450)\n\nThread 1:\n0 libsystem_pthread.dylib \t0x00000002132ccaa4 start_wqthread + 0\n\nThread 2:\n0 libsystem_kernel.dylib \t0x00000001d9dc7c60 semaphore_wait_trap + 8\n1 libdispatch.dylib \t0x0000000190b368e0 _dispatch_sema4_wait + 28 (lock.c:139)\n2 libdispatch.dylib \t0x0000000190b36e90 _dispatch_semaphore_wait_slow + 132 (semaphore.c:132)\n3 CFNetwork \t0x000000018a27d12c CFURLConnectionSendSynchronousRequest + 356 (CFURLConnection_Synchronous.c:209)\n4 CFNetwork \t0x000000018a2982c0 +[NSURLConnection sendSynchronousRequest:returningResponse:error:] + 296 (NSURLConnection.mm:478)\n5 Foundation \t0x00000001878c9dec -[NSData(NSData) initWithContentsOfURL:options:maxLength:error:] + 240 (NSData.m:992)\n6 ImageIO \t0x000000018e7cabf8 IIOCreateDataWithContentsOfURL + 56 (IIOObjUtils.mm:50)\n7 ImageIO \t0x000000018e685cd4 IIOImageSource::IIOImageSource(__CFURL const*, IIODictionary*) + 920 (CGImageSource.cpp:561)\n8 ImageIO \t0x000000018e6856e8 CGImageSourceCreateWithURL + 260 (CGImageSource.cpp:4600)\n9 DamusNotificationService \t0x0000000102733770 closure #2 in NotificationService.didReceive(_:withContentHandler:) + 104 (NotificationService.swift:113)\n10 DamusNotificationService \t0x000000010273d03d <deduplicated_symbol> + 1\n11 DamusNotificationService \t0x0000000102778c55 specialized thunk for @escaping @isolated(any) @callee_guaranteed @async () -> (@out A) + 1 (/<compiler-generated>:0)\n12 DamusNotificationService \t0x000000010273e885 <deduplicated_symbol> + 1\n13 libswift_Concurrency.dylib \t0x000000019478d241 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1 (Task.cpp:537)\n\nThread 3:\n0 libLine truncated
"x": -69,
"y": -82,
"width": 889,
"height": 1062
},
{
"id": "8ba807ac67740bc0",
"type": "text",
"text": "# 1st most common crash",
"x": 167,
"y": -320,
"width": 373,
"height": 80
},
{
"id": "906aae4882968fc5",
"type": "text",
"text": "`0xdead10cc` (`3735883980`) — pronounced “dead lock”\n\nThe operating system terminated the app because it held on to a file lock or SQLite database lock during suspension. Request additional background execution time on the main thread with [`beginBackgroundTask(withName:expirationHandler:)`](https://developer.apple.com/documentation/UIKit/UIApplication/beginBackgroundTask\\(withName:expirationHandler:\\)). Make this request well before starting to write to the file in order to complete those operations and relinquish the lock before the app suspends. In an app extension, use [`beginActivity(options:reason:)`](https://developer.apple.com/documentation/Foundation/ProcessInfo/beginActivity\\(options:reason:\\)) to manage this work.",
"x": -480,
"y": 1260,
"width": 659,
"height": 273
},
{
"id": "e619c24d803fc838",
"type": "text",
"text": "Holding ndb db file in notification target",
"x": 279,
"y": 1192,
"width": 281,
"height": 108,
"color": "2"
},
{
"id": "4f83ab4aa30b00f1",
"type": "text",
"text": "```\nIncident Identifier: F46AD3DE-40FA-483E-9E70-D48DAB7643E6\nDistributor ID: com.apple.TestFlight\nHardware Model: iPhone16,1\nProcess: damus [1140]\nPath: /private/var/containers/Bundle/Application/3D9243CC-8814-4347-80D5-C0BACEF9D2CD/damus.app/damus\nIdentifier: com.jb55.damus2\nVersion: 1.12 (682)\nAppStoreTools: 16C5031b\nAppVariant: 1:iPhone16,1:18\nBeta: YES\nCode Type: ARM-64 (Native)\nRole: unknown\nParent Process: launchd [1]\nCoalition: com.jb55.damus2 [1234]\n\nDate/Time: 2024-12-21 13:26:52.2609 +0800\nLaunch Time: 2024-12-21 13:26:50.6386 +0800\nOS Version: iPhone OS 18.1.1 (22B91)\nRelease Type: User\nBaseband Version: 2.20.03\nReport Version: 104\n\nException Type: EXC_CRASH (SIGKILL)\nException Codes: 0x0000000000000000, 0x0000000000000000\nTermination Reason: RUNNINGBOARD 0xdead10cc \n\nTriggered by Thread: 0\n\n\nThread 0 name:\nThread 0 Crashed:\n0 libsystem_kernel.dylib \t0x00000001e4352688 mach_msg2_trap + 8 (:-1)\n1 libsystem_kernel.dylib \t0x00000001e4355d98 mach_msg2_internal + 80 (mach_msg.c:201)\n2 libsystem_kernel.dylib \t0x00000001e4355cb0 mach_msg_overwrite + 424 (mach_msg.c:0)\n3 libsystem_kernel.dylib \t0x00000001e4355afc mach_msg + 24 (mach_msg.c:323)\n4 CoreFoundation \t0x0000000193f91a84 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)\n5 CoreFoundation \t0x0000000193f91130 __CFRunLoopRun + 1212 (CFRunLoop.c:3021)\n6 CoreFoundation \t0x0000000193f90830 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434)\n7 GraphicsServices \t0x00000001dff701c4 GSEventRunModal + 164 (GSEvent.c:2196)\n8 UIKitCore \t0x0000000196af6eb0 -[UIApplication _run] + 816 (UIApplication.m:3844)\n9 UIKitCore \t0x0000000196ba55b4 UIApplicationMain + 340 (UIApplication.m:5496)\n10 SwiftUI \t0x00000001986f9f98 closure #1 in KitRendererCommon(_:) + 168 (UIKitApp.swift:68)\n11 SwiftUI \t0x00000001986da664 runApp<A>(_:) + 100 (UIKitApp.swift:16)\n12 SwiftUI \t0x00000001986dd490 static App.main() + 180 (App.swift:121)\n13 damus \t0x000000010516f630 static damusApp.$main() + 56 (damusApp.swift:0)\n14 damus \t0x000000010516f630 main + 68\n15 dyld \t0x00000001b997eec8 start + 2724 (dyldMain.cpp:1334)\n\nThread 1:\n0 libsystem_pthread.dylib \t0x000000021c4c4480 start_wqthread + 0 (:-1)\n\nThread 2:\n0 libsystem_pthread.dylib \t0x000000021c4c4480 start_wqthread + 0 (:-1)\n\nThread 3:\n0 libsystem_pthread.dylib \t0x000000021c4c4480 start_wqthread + 0 (:-1)\n\nThread 4:\n0 libsystem_pthread.dylib \t0x000000021c4c4480 start_wqthread + 0 (:-1)\n\nThread 5:\n0 libsystem_pthread.dylib \t0x000000021c4c4480 start_wqthread + 0 (:-1)\n\nThread 6:\n0 libsystem_pthread.dylib \t0x000000021c4c4480 start_wqthread + 0 (:-1)\n\nThread 7:\n0 libsystem_pthread.dylib \t0x000000021c4c4480 start_wqthread + 0 (:-1)\n\nThread 8:\n0 libsystem_pthread.dylib \t0x000000021c4c4480 start_wqthread + 0 (:-1)\n\nThread 9 name:\nThread 9:\n0 libsystem_kernel.dylib \t0x00000001e4352688 mach_msg2_trap + 8 (:-1)\n1 libsystem_kernel.dylib \t0x00000001e4355d98 mach_msg2_internal + 80 (mach_msg.c:201)\n2 libsystem_kernel.dylib \t0x00000001e4355cb0 mach_msg_overwrite + 424 (mach_msg.c:0)\n3 libsystem_kernel.dylib \t0x00000001e4355afc mach_msg + 24 (mach_msg.c:323)\n4 CoreFoundation \t0x0000000193f91a84 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)\n5 CoreFoundation \t0x0000000193f91130 __CFRunLoopRun + 1212 (CFRunLoop.c:3021)\n6 CoreFoundation \t0x0000000193f90830 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434)\n7 Foundation \t0x0000000192c38500 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)\n8 Foundation \t0x0000000192c38350 -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)\n9 UIKitCore \t0x0000000196b0a358 -[UIEventFetcher threadMain] + 420 (UIEventFetcher.m:1241)\n10 Foundation \t0x0000000192c496c8 __NSThread__start__ + 724 (NSThread.m:991)\n11 libsystem_pthread.dylib \t0x000000021c4c937c _pthread_start + 136 (pthread.c:931)\n12 libsystem_pthread.dylib \t0x000000021c4c4494 thread_start + 8 (:-1)\n\nThread 10:\n0 libsystem_kernel.dylib \t0x00000001e4357f90 __psynch_cvwait + 8 (:-1)\n1 libsystem_pthread.dylib \t0x000000021c4c6a50 _pthread_cond_wait + 1204 (pthread_cond.c:862)\n2 damus \t0x0000000104e6703c prot_queue_pop_all + 60 (protected_queue.h:190)\n3 damus Line truncated
"x": 2320,
"y": -82,
"width": 1060,
"height": 1120
},
{
"id": "b27baddab9517a38",
"type": "text",
"text": "# 2nd most common crash",
"x": 1415,
"y": -300,
"width": 385,
"height": 77
},
{
"id": "0df74aca0192124e",
"type": "text",
"text": "Holding ndb db file in main target",
"x": 2710,
"y": 1160,
"width": 281,
"height": 108,
"color": "2"
},
{
"id": "e48e5b32c0265d73",
"type": "text",
"text": "# 3rd most common crash",
"x": 2635,
"y": -280,
"width": 430,
"height": 102
},
{
"id": "c04db70a0e694555",
"type": "text",
"text": "```swift\nlet sender_profile = {\n let txn = state.ndb.lookup_profile(nostr_event.pubkey)\n let profile = txn?.unsafeUnownedValue?.profile\n let picture = ((profile?.picture.map { URL(string: $0) }) ?? URL(string: robohash(nostr_event.pubkey)))! // <-- Force unwrap error\n return ProfileBuf(picture: picture,\n name: profile?.name,\n display_name: profile?.display_name,\n nip05: profile?.nip05)\n }()\n```",
"x": 3596,
"y": 45,
"width": 1384,
"height": 375
},
{
"id": "d275d9d3cca27202",
"type": "text",
"text": "# 4th most common crash",
"x": 4073,
"y": -240,
"width": 430,
"height": 102
},
{
"id": "39b704e37669fc83",
"type": "text",
"text": "```\nIncident Identifier: 0B12A949-43C3-4B05-820B-643210EAA9FB\nDistributor ID: com.apple.TestFlight\nHardware Model: iPhone14,4\nProcess: damus [2492]\nPath: /private/var/containers/Bundle/Application/7FFD6048-6DD6-4092-A83F-B80314A637A5/damus.app/damus\nIdentifier: com.jb55.damus2\nVersion: 1.14 (914)\nAppStoreTools: 16E137\nAppVariant: 1:iPhone14,4:18\nBeta: YES\nCode Type: ARM-64 (Native)\nRole: Background\nParent Process: launchd [1]\nCoalition: com.jb55.damus2 [1048]\n\nDate/Time: 2025-04-16 14:36:08.5474 -0700\nLaunch Time: 2025-04-16 14:34:59.0919 -0700\nOS Version: iPhone OS 18.4 (22E240)\nRelease Type: User\nBaseband Version: 4.51.04\nReport Version: 104\n\nException Type: EXC_BAD_ACCESS (SIGSEGV)\nException Subtype: KERN_INVALID_ADDRESS at 0x00000000000000d0\nException Codes: 0x0000000000000001, 0x00000000000000d0\nVM Region Info: 0xd0 is not in any region. Bytes before following region: 4331470640\n REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 1022d0000-102618000 [ 3360K] r-x/r-x SM=COW /var/containers/Bundle/Application/7FFD6048-6DD6-4092-A83F-B80314A637A5/damus.app/damus\nTermination Reason: SIGNAL 11 Segmentation fault: 11\nTerminating Process: exc handler [2492]\n\nTriggered by Thread: 38\n```\n\n```\nThread 38 name:\nThread 38 Crashed:\n0 libsystem_pthread.dylib \t0x00000002234344c0 pthread_mutex_lock + 12 (pthread_mutex.c:1709)\n1 damus \t0x00000001022e5a28 prot_queue_push + 32 (protected_queue.h:91)\n2 damus \t0x00000001022e4570 threadpool_dispatch + 48 (threadpool.h:76)\n3 damus \t0x00000001022e4570 ndb_ingester_queue_event + 64 (nostrdb.c:2950)\n4 damus \t0x00000001022e4570 ndb_process_event + 136 (nostrdb.c:3211)\n5 damus \t0x0000000102305394 closure #1 in Ndb.process_client_event(_:) + 76\n6 damus \t0x0000000102305340 closure #1 in Ndb.process_event(_:) + 20\n7 damus \t0x0000000102353f08 partial apply for closure #1 in Ndb.process_event(_:) + 20 (/<compiler-generated>:0)\n8 libswiftCore.dylib \t0x000000019776c384 _StringGuts._slowWithCString<A>(_:) + 76 (StringGuts.swift:239)\n9 damus \t0x0000000102702420 specialized String.withCString<A>(_:) + 176 (/<compiler-generated>:0)\n10 damus \t0x000000010234e70c Ndb.process_event(_:) + 28 (Ndb.swift:530)\n11 damus \t0x000000010234e70c $s5damus9RelayPoolC9add_relayyyAC0B10DescriptorVAC0B5ErrorOYKFyAA14WebSocketEventOcfU0_ + 436 (RelayPool.swift:139)\n12 damus \t0x00000001025e8bb4 RelayConnection.receive(event:) + 416 (RelayConnection.swift:118)\n13 damus \t0x00000001025e9670 closure #2 in RelayConnection.connect(force:) + 68 (RelayConnection.swift:79)\n14 Combine \t0x00000001a2605b18 Subscribers.Sink.receive(_:) + 92 (Sink.swift:128)\n15 Combine \t0x00000001a2605aac protocol witness for Subscriber.receive(_:) in conformance Subscribers.Sink<A, B> + 24 (<compiler-generated>:0)\n16 Combine \t0x00000001a260494c closure #1 in Publishers.ReceiveOn.Inner.receive(_:) + 284 (ReceiveOn.swift:169)\n17 libswiftDispatch.dylib \t0x00000001a2525a48 thunk for @escaping @callee_guaranteed () -> () + 36 (:-1)\n18 libdispatch.dylib \t0x00000001a0e49aac _dispatch_call_block_and_release + 32 (init.c:1575)\n19 libdispatch.dylib \t0x00000001a0e63584 _dispatch_client_callout + 16 (client_callout.mm:85)\n20 libdispatch.dylib \t0x00000001a0e7fe84 <deduplicated_symbol> + 32 (:-1)\n21 libdispatch.dylib \t0x00000001a0e5bf24 _dispatch_root_queue_drain + 736 (queue.c:7342)\n22 libdispatch.dylib \t0x00000001a0e5c54c _dispatch_worker_thread2 + 156 (queue.c:7410)\n23 libsystem_pthread.dylib \t0x0000000223435624 _pthread_wqthread + 232 (pthread.c:2709)\n24 libsystem_pthread.dylib \t0x00000002234329f8 start_wqthread + 8 (:-1)\n```",
"x": 5120,
"y": -2,
"width": 1240,
"height": 1722
},
{
"id": "e182bb08633f0c8e",
"type": "text",
"text": "# 5th most common crash",
"x": 5525,
"y": -240,
"width": 430,
"height": 102
},
{
"id": "a7b2dd98e8fb8b98",
"type": "text",
"text": "Unsafe \"force unwrap\"",
"x": 4157,
"y": 489,
"width": 250,
"height": 60,
"color": "2"
},
{
"id": "a3718eb8e2f9f28d",
"type": "text",
"text": "Probably memory or concurrency issue related to Ndb",
"x": 5619,
"y": 1899,
"width": 341,
"height": 101,
"color": "2"
},
{
"id": "915e462d7852f6bb",
"type": "text",
"text": "Memory error related to ndb",
"x": 1483,
"y": 2520,
"width": 250,
"height": 60,
"color": "2"
},
{
"id": "3d398a7223484f22",
"type": "text",
"text": "```\nIncident Identifier: CF913FAA-5091-4EF7-8D0B-E29C25BFC366\nDistributor ID: com.apple.TestFlight\nHardware Model: iPhone17,2\nProcess: DamusNotificationService [35444]\nPath: /private/var/containers/Bundle/Application/C48A3744-BAD0-41F2-812F-AA9F65FE651E/damus.app/PlugIns/DamusNotificationService.appex/DamusNotificationService\nIdentifier: com.jb55.damus2.DamusNotificationService\nVersion: 1.14 (914)\nAppVariant: 1:iPhone17,2:18\nBeta: YES\nCode Type: ARM-64 (Native)\nRole: Unspecified\nParent Process: launchd [1]\nCoalition: com.jb55.damus2.DamusNotificationService [1098]\n\nDate/Time: 2025-04-22 11:08:47.5725 -0700\nLaunch Time: 2025-04-22 10:20:47.0779 -0700\nOS Version: iPhone OS 18.3.2 (22D82)\nRelease Type: User\nBaseband Version: 1.40.03\nReport Version: 104\n\nException Type: EXC_BAD_ACCESS (SIGSEGV)\nException Subtype: KERN_INVALID_ADDRESS at 0x0000000000000009\nException Codes: 0x0000000000000001, 0x0000000000000009\nVM Region Info: 0x9 is not in any region. Bytes before following region: 4332535799\n REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 1023d4000-102608000 [ 2256K] r-x/r-x SM=COW /var/containers/Bundle/Application/C48A3744-BAD0-41F2-812F-AA9F65FE651E/damus.app/PlugIns/DamusNotificationService.appex/DamusNotificationService\nTermination Reason: SIGNAL 11 Segmentation fault: 11\nTerminating Process: exc handler [35444]\n\nTriggered by Thread: 1\n\n\nThread 0 name:\nThread 0:\n0 libsystem_kernel.dylib \t0x00000001e63b0788 mach_msg2_trap + 8 (:-1)\n1 libsystem_kernel.dylib \t0x00000001e63b3e98 mach_msg2_internal + 80 (mach_msg.c:201)\n2 libsystem_kernel.dylib \t0x00000001e63b3db0 mach_msg_overwrite + 424 (mach_msg.c:0)\n3 libsystem_kernel.dylib \t0x00000001e63b3bfc mach_msg + 24 (mach_msg.c:323)\n4 CoreFoundation \t0x0000000194ccb804 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2637)\n5 CoreFoundation \t0x0000000194ccaeb0 __CFRunLoopRun + 1212 (CFRunLoop.c:3021)\n6 CoreFoundation \t0x0000000194d1d284 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434)\n7 Foundation \t0x00000001938830e8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)\n8 Foundation \t0x000000019387f2b0 -[NSRunLoop(NSRunLoop) run] + 64 (NSRunLoop.m:398)\n9 libxpc.dylib \t0x000000021fa7fdb4 _xpc_objc_main + 336 (main.m:267)\n10 libxpc.dylib \t0x000000021fa82320 _xpc_main + 64 (init.c:1291)\n11 libxpc.dylib \t0x000000021fa82500 xpc_main + 64 (init.c:1374)\n12 Foundation \t0x0000000193a509a8 -[NSXPCListener resume] + 308 (NSXPCListener.m:471)\n13 PlugInKit \t0x00000001c5a3944c -[PKService runUsingServiceListener:] + 364 (PKService.m:219)\n14 PlugInKit \t0x00000001c5a392d8 -[PKService run] + 20 (PKService.m:185)\n15 PlugInKit \t0x00000001c5a38f94 +[PKService main] + 524 (PKService.m:126)\n16 PlugInKit \t0x00000001c5a397a8 +[PKService _defaultRun:arguments:] + 16 (PKService.m:265)\n17 ExtensionFoundation \t0x00000001a401e724 EXExtensionMain + 288 (EXExtensionMain.m:0)\n18 Foundation \t0x0000000193b17350 NSExtensionMain + 204 (NSExtensionMain.m:21)\n19 dyld \t0x00000001baf79de8 start + 2724 (dyldMain.cpp:1338)\n\nThread 1 name:\nThread 1 Crashed:\n0 DamusNotificationService \t0x00000001023e0fe8 mdb_cursor_open + 60 (mdb.c:7687)\n1 DamusNotificationService \t0x00000001023e4270 ndb_get_tsid + 92 (nostrdb.c:1335)\n2 DamusNotificationService \t0x00000001023e4384 ndb_lookup_tsid + 64 (nostrdb.c:1390)\n3 DamusNotificationService \t0x000000010241e13c specialized closure #1 in Ndb.lookup_profile_with_txn_inner<A>(pubkey:txn:) + 100 (Ndb.swift:416)\n4 DamusNotificationService \t0x000000010241e3e8 specialized closure #1 in Ndb.lookup_profile_with_txn_inner<A>(pubkey:txn:) + 16 (/<compiler-generated>:0)\n5 DamusNotificationService \t0x000000010241e3e8 specialized closure #1 in Ndb.lookup_profile_with_txn_inner<A>(pubkey:txn:) + 16\n6 DamusNotificationService \t0x000000010241e3e8 specialized __DataStorage.withUnsafeBytes<A>(in:apply:) + 20\n7 DamusNotificationService \t0x000000010241e3e8 specialized __DataStorage.withUnsafeBytes<A>(in:apply:) + 20\n8 DamusNotificationService \t0x000000010241e3e8 specialized Data._Representation.withUnsafeBytes<A>(_:) + 508\n9 DamusNotificationService \t0x000000010241e3e8 0x1023d4000 + 304104 (/<compiler-generated>:0)\n10 DamusNotificationService \t0x000000010241e3e8 0x1023d4000 + 304104 (/<Line truncated
"x": 1000,
"y": -82,
"width": 1225,
"height": 2442
}
],
"edges": [
{
"id": "7921adc708cb3a7b",
"fromNode": "8ba807ac67740bc0",
"fromSide": "bottom",
"toNode": "c450e9832ffe7a3d",
"toSide": "top"
},
{
"id": "8cd54328766e3a74",
"fromNode": "b27baddab9517a38",
"fromSide": "bottom",
"toNode": "3d398a7223484f22",
"toSide": "top"
},
{
"id": "141570202b1594fa",
"fromNode": "c450e9832ffe7a3d",
"fromSide": "bottom",
"toNode": "906aae4882968fc5",
"toSide": "top"
},
{
"id": "c04c77ad678215f6",
"fromNode": "c450e9832ffe7a3d",
"fromSide": "bottom",
"toNode": "e619c24d803fc838",
"toSide": "top"
},
{
"id": "b1642de657a7849f",
"fromNode": "3d398a7223484f22",
"fromSide": "bottom",
"toNode": "915e462d7852f6bb",
"toSide": "top"
},
{
"id": "fa6c9971a72041f4",
"fromNode": "e48e5b32c0265d73",
"fromSide": "bottom",
"toNode": "4f83ab4aa30b00f1",
"toSide": "top"
},
{
"id": "0b9d1757cec27068",
"fromNode": "4f83ab4aa30b00f1",
"fromSide": "bottom",
"toNode": "0df74aca0192124e",
"toSide": "top"
},
{
"id": "fcf498e888535135",
"fromNode": "d275d9d3cca27202",
"fromSide": "bottom",
"toNode": "c04db70a0e694555",
"toSide": "top"
},
{
"id": "ac60f0136f93b0da",
"fromNode": "e182bb08633f0c8e",
"fromSide": "bottom",
"toNode": "39b704e37669fc83",
"toSide": "top"
},
{
"id": "a5963df395dff2cb",
"fromNode": "c04db70a0e694555",
"fromSide": "bottom",
"toNode": "a7b2dd98e8fb8b98",
"toSide": "top"
},
{
"id": "f18aa25135d3bf72",
"fromNode": "39b704e37669fc83",
"fromSide": "bottom",
"toNode": "a3718eb8e2f9f28d",
"toSide": "top"
}
]
}
+107
View File
@@ -0,0 +1,107 @@
use egui::{Align, Label, Pos2, Rect, TextWrapMode};
use jsoncanvas::{FileNode, GroupNode, JsonCanvas, LinkNode, Node, TextNode, node::*};
use notedeck::{AppAction, AppContext};
pub struct Notebook {
canvas: JsonCanvas,
scene_rect: Rect,
loaded: bool,
}
impl Default for Notebook {
fn default() -> Self {
Notebook {
canvas: demo_canvas(),
scene_rect: Rect::from_min_max(Pos2::ZERO, Pos2::ZERO),
loaded: false,
}
}
}
impl notedeck::App for Notebook {
fn update(&mut self, _ctx: &mut AppContext<'_>, ui: &mut egui::Ui) -> Option<AppAction> {
//let app_action: Option<AppAction> = None;
if !self.loaded {
self.scene_rect = ui.available_rect_before_wrap();
self.loaded = true;
}
egui::Scene::new().show(ui, &mut self.scene_rect, |ui| {
for (_node_id, node) in self.canvas.get_nodes().iter() {
let _resp = node_ui(ui, node);
}
});
None
}
}
fn node_ui(ui: &mut egui::Ui, node: &Node) -> egui::Response {
match node {
Node::Text(text_node) => text_node_ui(ui, text_node),
Node::File(file_node) => file_node_ui(ui, file_node),
Node::Link(link_node) => link_node_ui(ui, link_node),
Node::Group(group_node) => group_node_ui(ui, group_node),
}
}
fn text_node_ui(ui: &mut egui::Ui, node: &TextNode) -> egui::Response {
node_box_ui(ui, node.node(), |ui| {
ui.with_layout(egui::Layout::left_to_right(Align::Min), |ui| {
ui.add(Label::new(node.text()).wrap_mode(TextWrapMode::Wrap))
});
})
}
fn file_node_ui(ui: &mut egui::Ui, node: &FileNode) -> egui::Response {
node_box_ui(ui, node.node(), |ui| {
ui.label("file node");
})
}
fn link_node_ui(ui: &mut egui::Ui, node: &LinkNode) -> egui::Response {
node_box_ui(ui, node.node(), |ui| {
ui.label("link node");
})
}
fn group_node_ui(ui: &mut egui::Ui, node: &GroupNode) -> egui::Response {
node_box_ui(ui, node.node(), |ui| {
ui.label("group node");
})
}
fn node_box_ui(
ui: &mut egui::Ui,
node: &GenericNode,
contents: impl FnOnce(&mut egui::Ui),
) -> egui::Response {
let x = node.x as f32;
let y = node.y as f32;
let width = node.width as f32;
let height = node.height as f32;
let min = Pos2::new(x, y);
let max = Pos2::new(x + width, y + height);
ui.put(Rect::from_min_max(min, max), |ui: &mut egui::Ui| {
egui::Frame::default()
.fill(ui.visuals().noninteractive().weak_bg_fill)
.inner_margin(egui::Margin::same(4))
.corner_radius(egui::CornerRadius::same(10))
.stroke(egui::Stroke::new(
1.0,
ui.visuals().noninteractive().bg_stroke.color,
))
.show(ui, contents)
.response
})
}
fn demo_canvas() -> JsonCanvas {
let demo_json: String = include_str!("../demo.canvas").to_string();
let canvas: JsonCanvas = demo_json.parse().unwrap_or_else(|_| JsonCanvas::default());
canvas
}