Skip to content

Commit 2535156

Browse files
committed
Revert "refactor(app): reduce tech debt by eliminating wry fork (#4500)"
This reverts commit dbc64af
1 parent 8972c9a commit 2535156

File tree

4 files changed

+16
-30
lines changed

4 files changed

+16
-30
lines changed

Cargo.lock

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ wildcard_dependencies = "warn"
240240
[profile.dev.package.sqlx-macros]
241241
opt-level = 3
242242

243+
[patch.crates-io]
244+
wry = { git = "https://github.com/modrinth/wry", rev = "f2ce0b0" }
245+
243246
# Optimize for speed and reduce size on release builds
244247
[profile.release]
245248
opt-level = "s" # Optimize for binary size

apps/app/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ tauri-build = { workspace = true, features = ["codegen"] }
4949
[target.'cfg(target_os = "linux")'.dependencies]
5050
tauri-plugin-updater = { workspace = true, optional = true }
5151

52-
[target.'cfg(windows)'.dependencies]
53-
webview2-com.workspace = true
54-
windows-core.workspace = true
55-
5652
[features]
5753
# by default Tauri runs in production mode
5854
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL

apps/app/src/api/ads.rs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub async fn init_ads_window<R: Runtime>(
7979
override_shown: bool,
8080
) -> crate::api::Result<()> {
8181
use tauri::WebviewUrl;
82+
const LINK_SCRIPT: &str = include_str!("ads-init.js");
8283

8384
let state = app.state::<RwLock<AdsState>>();
8485
let mut state = state.write().await;
@@ -101,42 +102,25 @@ pub async fn init_ads_window<R: Runtime>(
101102
webview.set_position(PhysicalPosition::new(-1000, -1000));
102103
}
103104
} else if let Some(window) = app.get_window("main") {
104-
let webview = window.add_child(
105+
let _ = window.add_child(
105106
tauri::webview::WebviewBuilder::new(
106107
"ads-window",
107108
WebviewUrl::External(
108109
AD_LINK.parse().unwrap(),
109110
),
110111
)
111-
.initialization_script_for_all_frames(include_str!("ads-init.js"))
112-
.user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36")
113-
.zoom_hotkeys_enabled(false)
114-
.transparent(true)
115-
.on_new_window(|_, _| tauri::webview::NewWindowResponse::Deny),
112+
.initialization_script(LINK_SCRIPT)
113+
// .initialization_script_for_main_only(LINK_SCRIPT, false)
114+
.user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36")
115+
.zoom_hotkeys_enabled(false)
116+
.transparent(true),
116117
if state.shown {
117118
position
118119
} else {
119120
PhysicalPosition::new(-1000.0, -1000.0)
120121
},
121122
size,
122-
)?;
123-
124-
webview.with_webview(#[allow(unused_variables)] |webview2| {
125-
#[cfg(windows)]
126-
{
127-
use webview2_com::Microsoft::Web::WebView2::Win32::ICoreWebView2_8;
128-
use windows_core::Interface;
129-
130-
let webview2_controller = webview2.controller();
131-
let Ok(webview2_8) = unsafe { webview2_controller.CoreWebView2() }
132-
.and_then(|core_webview2| core_webview2.cast::<ICoreWebView2_8>())
133-
else {
134-
return;
135-
};
136-
137-
unsafe { webview2_8.SetIsMuted(true) }.ok();
138-
}
139-
})?;
123+
);
140124
}
141125
}
142126

0 commit comments

Comments
 (0)