Revert "json: deserialize note ids into bytes"

This reverts commit 1ba597fc0a.
This commit is contained in:
William Casarin
2023-07-06 17:50:20 -07:00
parent 1ba597fc0a
commit 672f95749a
9 changed files with 29 additions and 84 deletions

View File

@@ -5,8 +5,8 @@ use crate::ui::padding;
use crate::Result;
use egui::containers::scroll_area::ScrollBarVisibility;
use egui::widgets::Spinner;
use egui::{Context, Frame, TextureHandle, TextureId};
use enostr::{ClientMessage, Filter, NoteId, Profile, Pubkey, RelayEvent, RelayMessage};
use egui::{Color32, Context, Frame, TextureHandle, TextureId};
use enostr::{ClientMessage, EventId, Filter, Profile, Pubkey, RelayEvent, RelayMessage};
use poll_promise::Promise;
use std::collections::{HashMap, HashSet};
use std::hash::{Hash, Hasher};
@@ -44,10 +44,11 @@ pub struct Damus {
pool: RelayPool,
all_events: HashMap<NoteId, Event>,
events: Vec<NoteId>,
all_events: HashMap<EventId, Event>,
events: Vec<EventId>,
img_cache: ImageCache,
bg_color: Color32,
}
impl Default for Damus {
@@ -57,9 +58,10 @@ impl Default for Damus {
contacts: Contacts::new(),
all_events: HashMap::new(),
pool: RelayPool::default(),
events: Vec::with_capacity(2000),
events: vec![],
img_cache: HashMap::new(),
n_panels: 1,
bg_color: Color32::from_rgb(31, 31, 31),
}
}
}
@@ -457,8 +459,8 @@ fn add_test_events(damus: &mut Damus) {
// For inspiration and more examples, go to https://emilk.github.io/egui
let test_event = Event {
id: "6938e3cd841f3111dbdbd909f87fd52c3d1f1e4a07fd121d1243196e532811cb".try_into().unwrap(),
pubkey: "f0a6ff7f70b872de6d82c8daec692a433fd23b6a49f25923c6f034df715cdeec".try_into().unwrap(),
id: "6938e3cd841f3111dbdbd909f87fd52c3d1f1e4a07fd121d1243196e532811cb".to_string().into(),
pubkey: "f0a6ff7f70b872de6d82c8daec692a433fd23b6a49f25923c6f034df715cdeec".to_string().into(),
created_at: 1667781968,
kind: 1,
tags: vec![],
@@ -467,8 +469,8 @@ fn add_test_events(damus: &mut Damus) {
};
let test_event2 = Event {
id: "6938e3cd841f3111dbdbd909f87fd52c3d1f1e4a07fd121d1243196e532811cb".try_into().unwrap(),
pubkey: "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245".try_into().unwrap(),
id: "6938e3cd841f3111dbdbd909f87fd52c3d1f1e4a07fd121d1243196e532811cb".to_string().into(),
pubkey: "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245".to_string().into(),
created_at: 1667781968,
kind: 1,
tags: vec![],

View File

@@ -1,8 +1,8 @@
use enostr::{NoteId, Profile, Pubkey};
use enostr::{EventId, Profile, Pubkey};
use std::collections::HashMap;
pub struct Contacts {
pub events: HashMap<Pubkey, NoteId>,
pub events: HashMap<Pubkey, EventId>,
pub profiles: HashMap<Pubkey, Profile>,
}