codify "platform" into resolution logic, server-fn/fullstack overhaul (#4596)
overhaul dioxus fullstack using a new implementation of server_fn This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
This commit is contained in:
1 parent
8421c3aef0
commit
f2b1c6d97f
424 files changed
+17284
-6624
No files matched your search
@@ -4,14 +4,9 @@ use crate::menubar::DioxusMenu;
|
||||
use crate::PendingDesktopContext;
|
||||
use crate::WindowCloseBehaviour;
|
||||
use crate::{
|
||||
app::SharedContext,
|
||||
assets::AssetHandlerRegistry,
|
||||
edits::WryQueue,
|
||||
file_upload::{NativeFileEngine, NativeFileHover},
|
||||
ipc::UserWindowEvent,
|
||||
protocol,
|
||||
waker::tao_waker,
|
||||
Config, DesktopContext, DesktopService,
|
||||
app::SharedContext, assets::AssetHandlerRegistry, edits::WryQueue,
|
||||
file_upload::NativeFileHover, ipc::UserWindowEvent, protocol, waker::tao_waker, Config,
|
||||
DesktopContext, DesktopService,
|
||||
};
|
||||
use crate::{document::DesktopDocument, WeakDesktopContext};
|
||||
use base64::prelude::BASE64_STANDARD;
|
||||
@@ -19,10 +14,9 @@ use dioxus_core::{Runtime, ScopeId, VirtualDom};
|
||||
use dioxus_document::Document;
|
||||
use dioxus_history::{History, MemoryHistory};
|
||||
use dioxus_hooks::to_owned;
|
||||
use dioxus_html::{HasFileData, HtmlEvent, PlatformEventData};
|
||||
use dioxus_html::{HtmlEvent, PlatformEventData};
|
||||
use futures_util::{pin_mut, FutureExt};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
use std::{cell::OnceCell, time::Duration};
|
||||
use std::{rc::Rc, task::Waker};
|
||||
use wry::{DragDropEvent, RequestAsyncResponder, WebContext, WebViewBuilder, WebViewId};
|
||||
@@ -90,7 +84,7 @@ impl WebviewEdits {
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::error!(
|
||||
"Error parsing user_event: {:?}.Contents: {:?}, raw: {:#?}",
|
||||
"Error parsing user_event: {:?}. \n Contents: {:?}, \nraw: {:#?}",
|
||||
err,
|
||||
String::from_utf8(request.body().to_vec()),
|
||||
request
|
||||
@@ -131,20 +125,17 @@ impl WebviewEdits {
|
||||
}
|
||||
dioxus_html::EventData::Drag(ref drag) => {
|
||||
// we want to override this with a native file engine, provided by the most recent drag event
|
||||
if drag.files().is_some() {
|
||||
let file_event = recent_file.current().unwrap();
|
||||
let paths = match file_event {
|
||||
wry::DragDropEvent::Enter { paths, .. } => paths,
|
||||
wry::DragDropEvent::Drop { paths, .. } => paths,
|
||||
_ => vec![],
|
||||
};
|
||||
Rc::new(PlatformEventData::new(Box::new(DesktopFileDragEvent {
|
||||
mouse: drag.mouse.clone(),
|
||||
files: Arc::new(NativeFileEngine::new(paths)),
|
||||
})))
|
||||
} else {
|
||||
data.into_any()
|
||||
}
|
||||
let file_event = recent_file.current().unwrap();
|
||||
let paths = match file_event {
|
||||
wry::DragDropEvent::Enter { paths, .. } => paths,
|
||||
wry::DragDropEvent::Drop { paths, .. } => paths,
|
||||
_ => vec![],
|
||||
};
|
||||
|
||||
Rc::new(PlatformEventData::new(Box::new(DesktopFileDragEvent {
|
||||
mouse: drag.mouse.clone(),
|
||||
files: paths,
|
||||
})))
|
||||
}
|
||||
_ => data.into_any(),
|
||||
};
|
||||
@@ -561,12 +552,12 @@ impl SynchronousEventResponse {
|
||||
pub(crate) struct PendingWebview {
|
||||
dom: VirtualDom,
|
||||
cfg: Config,
|
||||
sender: tokio::sync::oneshot::Sender<DesktopContext>,
|
||||
sender: futures_channel::oneshot::Sender<DesktopContext>,
|
||||
}
|
||||
|
||||
impl PendingWebview {
|
||||
pub(crate) fn new(dom: VirtualDom, cfg: Config) -> (Self, PendingDesktopContext) {
|
||||
let (sender, receiver) = tokio::sync::oneshot::channel();
|
||||
let (sender, receiver) = futures_channel::oneshot::channel();
|
||||
let webview = Self { dom, cfg, sender };
|
||||
let pending = PendingDesktopContext { receiver };
|
||||
(webview, pending)
|
||||
|
||||
Reference in new issue
Block a user