mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
feat(opener): add inAppBrowser option for iOS and Android (#2803)
This commit is contained in:
committed by
GitHub
parent
9799f0dbab
commit
2aec8ff4c4
@@ -55,7 +55,7 @@ impl<R: Runtime> Opener<R> {
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
/// - **Android / iOS**: Always opens using default program, unless `with` is provided as "inAppBrowser".
|
||||
#[cfg(desktop)]
|
||||
pub fn open_url(&self, url: impl Into<String>, with: Option<impl Into<String>>) -> Result<()> {
|
||||
crate::open::open(url.into(), with.map(Into::into))
|
||||
@@ -78,11 +78,14 @@ impl<R: Runtime> Opener<R> {
|
||||
///
|
||||
/// ## Platform-specific:
|
||||
///
|
||||
/// - **Android / iOS**: Always opens using default program.
|
||||
/// - **Android / iOS**: Always opens using default program, unless `with` is provided as "inAppBrowser".
|
||||
#[cfg(mobile)]
|
||||
pub fn open_url(&self, url: impl Into<String>, _with: Option<impl Into<String>>) -> Result<()> {
|
||||
pub fn open_url(&self, url: impl Into<String>, with: Option<impl Into<String>>) -> Result<()> {
|
||||
self.mobile_plugin_handle
|
||||
.run_mobile_plugin("open", url.into())
|
||||
.run_mobile_plugin(
|
||||
"open",
|
||||
serde_json::json!({ "url": url.into(), "with": with.map(Into::into) }),
|
||||
)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user