-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(mobile): multi-window support #14484
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
base: dev
Are you sure you want to change the base?
Conversation
Package Changes Through 7f953fcThere are 8 changes which include @tauri-apps/api with patch, tauri with minor, tauri-cli with patch, tauri-bundler with patch, @tauri-apps/cli with patch, tauri-runtime-wry with minor, tauri-runtime with minor, tauri-utils with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
|
here's an example: https://github.com/lucasfernog/tauri-mobile-multi-window-example |
velocitysystems
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're very excited about this feature @lucasfernog. I've left comments on #1154 and #1633. Here are some additional general questions:
Platforms & Compatibility
- How will this affect Tauri's minimum supported versions?(i.e. Requires iOS 13+ and Android 12L)
- What is the fallback behavior for unsupported platforms?
- Which features of the Window API are available vs not available on mobile?
Performance & Resource Management
- How do we intend to handle app lifecycle events? e.g. sleep/resume
- How can we optimize multi-window support so as not to affect battery life?
|
|
||
| #[cfg(feature = "unstable")] | ||
| #[command(root = "crate")] | ||
| pub async fn create_webview<R: Runtime>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we may not wish to enforce this (since it is device-specific) there is a theoretical limit to the number of web-views which can be created based on the available memory.
If the app begins to use too much memory the OS may mark it for termination particularly if it doesn't respond to memory warnings and attempt to free memory.
|
|
||
| #[cfg(feature = "unstable")] | ||
| #[command(root = "crate")] | ||
| pub async fn create_webview<R: Runtime>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebViews are full browser engines that continue consuming significant CPU, GPU, and battery resources (15-25% per hour) even when the app is backgrounded, unless explicitly paused through lifecycle event handlers (onPause/onResume on Android or scene lifecycle hooks on iOS).
This can reduce background drain to 1-3% per hour—a critical requirement for app store approval and acceptable user experience.
| } | ||
|
|
||
| #[cfg(desktop)] | ||
| mod desktop_commands { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apps can't currently detect if multi-window is available. Should we add an API like this? e.g.
Typescript
if (await app.supportsMultiWindow()) {
// Create new window
} else {
// Ignore
}Rust
pub fn supports_multi_window() -> bool {
#[cfg(target_os = "iOS")]
{
ios_version() >= 13.0
}
#[cfg(target_os = "android")]
{
android_api_level() >= 32 // Android 12L
}
#[cfg(desktop)]
{
true
}
}
Leverages scenes on iOS and Activity embedding on Android.
All window APIs are now exposed on mobile too. Some of them are still ignored though (like setting a title).
iOS
Android
needs tauri-apps/tao#1154 and tauri-apps/wry#1633