feat: Enter to send msg
This commit is contained in:
parent
b65acf01c8
commit
e4cceef0cf
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1379,7 +1379,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui-video"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/v0l/egui-video.git?rev=f3753a50bbd2ac1f5e324b3d3768a0b173dfbd2e#f3753a50bbd2ac1f5e324b3d3768a0b173dfbd2e"
|
||||
source = "git+https://github.com/v0l/egui-video.git?rev=d2ea3b4db21eb870a207db19e4cd21c7d1d24836#d2ea3b4db21eb870a207db19e4cd21c7d1d24836"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"atomic",
|
||||
|
@ -28,7 +28,7 @@ resvg = { version = "0.44.0", default-features = false }
|
||||
serde = { version = "1.0.214", features = ["derive"] }
|
||||
serde_with = { version = "3.11.0", features = ["hex"] }
|
||||
|
||||
egui-video = { git = "https://github.com/v0l/egui-video.git", rev = "f3753a50bbd2ac1f5e324b3d3768a0b173dfbd2e" }
|
||||
egui-video = { git = "https://github.com/v0l/egui-video.git", rev = "d2ea3b4db21eb870a207db19e4cd21c7d1d24836" }
|
||||
#egui-video = { path = "../egui-video" }
|
||||
|
||||
[target.'cfg(not(target_os = "android"))'.dependencies]
|
||||
|
@ -9,6 +9,9 @@ pub struct StreamPlayer {
|
||||
impl StreamPlayer {
|
||||
pub fn new(ctx: &Context, url: &String) -> Self {
|
||||
let mut p = Player::new(ctx, url);
|
||||
#[cfg(debug_assertions)]
|
||||
p.set_debug(true);
|
||||
|
||||
p.start();
|
||||
Self { player: Some(p) }
|
||||
}
|
||||
|
@ -32,8 +32,9 @@ impl<'a> NativeTextInput<'a> {
|
||||
|
||||
impl<'a> NostrWidget for NativeTextInput<'a> {
|
||||
fn render(&mut self, ui: &mut Ui, services: &mut RouteServices<'_>) -> Response {
|
||||
let mut editor = TextEdit::singleline(self.text)
|
||||
let mut editor = TextEdit::multiline(self.text)
|
||||
.frame(false)
|
||||
.desired_rows(1)
|
||||
.desired_width(f32::INFINITY);
|
||||
if let Some(hint_text) = self.hint_text {
|
||||
editor = editor.hint_text(egui::RichText::new(hint_text).color(NEUTRAL_500));
|
||||
|
@ -35,9 +35,9 @@ impl NostrWidget for WriteChat {
|
||||
.load_bytes("send-03.svg", logo_bytes)
|
||||
.sense(Sense::click())
|
||||
.ui(ui)
|
||||
.clicked()
|
||||
.clicked() || self.msg.ends_with('\n')
|
||||
{
|
||||
if let Ok(ev) = services.login.write_live_chat_msg(&self.link, &self.msg) {
|
||||
if let Ok(ev) = services.login.write_live_chat_msg(&self.link, &self.msg.trim()) {
|
||||
info!("Sending: {:?}", ev);
|
||||
services.broadcast_event(ev);
|
||||
}
|
||||
@ -46,7 +46,7 @@ impl NostrWidget for WriteChat {
|
||||
|
||||
let mut editor =
|
||||
NativeTextInput::new(&mut self.msg).with_hint_text("Message..");
|
||||
editor.render(ui, services);
|
||||
editor.render(ui, services)
|
||||
});
|
||||
})
|
||||
.response
|
||||
|
Loading…
x
Reference in New Issue
Block a user