Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.add_child(webview_builder) support for mobile #11794

Open
lindongchen opened this issue Nov 26, 2024 · 0 comments
Open

window.add_child(webview_builder) support for mobile #11794

lindongchen opened this issue Nov 26, 2024 · 0 comments
Labels
platform: Android platform: iOS scope: unstable flag Issue only occures with "unstable" feature flag enabled type: feature request

Comments

@lindongchen
Copy link

Describe the bug

By viewing the source code, I'm found add_child only supports desktop, can it be compatible with mobile target?
If wry is used, multiple webviews can be implemented like the following:

#[cfg(any(target_os = "ios", target_os = "android"))]
let mut builder = wry::WebViewBuilder::new().with_url(curl);

if !proxy.is_empty() {
let parts: Vec<&str> = proxy.split(':').collect();

// Access the parts safely
let proxy_host = parts.get(0).unwrap_or(&"");
let proxy_port = parts.get(1).unwrap_or(&"");
let proxy_config = wry::ProxyConfig::Socks5(wry::ProxyEndpoint {
	host: proxy_host.to_string(),
	port: proxy_port.to_string()
});

builder = builder.with_proxy_config(proxy_config);
}

let webview = builder.build_as_child(&main_window).unwrap();

But I think has some fatal issues, like not being able to access the window__ TAURI__
And I don't know how to make them public through Wry ("withGlobalTauri"= true not effective)

Multiple webviews on mobile target are a common requirement.

Reproduction

No response

Expected behavior

  1. tauri window.add_child api compatible with mobile
  2. wry creator can access window__ TAURI__
  3. have a other rust sample for mobile create multiple webviews
    1 ~ 3 Just satisfy any point ,the issue will be solved

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.5.0 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 20.18.0
    - pnpm: 8.10.5
    - yarn: 1.22.17
    - npm: 8.19.4

[-] Packages
    - tauri 🦀: 2.0.6
    - tauri-build 🦀: 2.0.2
    - wry 🦀: 0.46.3
    - tao 🦀: 0.30.5
    - @tauri-apps/api : 2.0.3
    - @tauri-apps/cli : 2.0.5

Stack trace

No response

Additional context

No response

@lindongchen lindongchen added status: needs triage This issue needs to triage, applied to new issues type: bug labels Nov 26, 2024
@FabianLars FabianLars added type: feature request platform: iOS platform: Android scope: unstable flag Issue only occures with "unstable" feature flag enabled and removed type: bug status: needs triage This issue needs to triage, applied to new issues labels Nov 26, 2024
@FabianLars FabianLars changed the title [bug] window.add_child(webview_builder... not support for mobile target window.add_child(webview_builder) support for mobile Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Android platform: iOS scope: unstable flag Issue only occures with "unstable" feature flag enabled type: feature request
Projects
None yet
Development

No branches or pull requests

2 participants