mirror of
https://github.com/modrinth/code.git
synced 2026-09-03 13:36:48 +00:00
fix: ads showing when sidebar is disabled on startup (#6806)
This commit is contained in:
@@ -699,15 +699,16 @@ pub async fn hide_ads_window<R: Runtime>(
|
|||||||
reset: Option<bool>,
|
reset: Option<bool>,
|
||||||
) -> crate::api::Result<()> {
|
) -> crate::api::Result<()> {
|
||||||
let reset = reset.unwrap_or(false);
|
let reset = reset.unwrap_or(false);
|
||||||
|
let state = app.state::<RwLock<AdsState>>();
|
||||||
|
let mut state = state.write().await;
|
||||||
|
|
||||||
|
if reset {
|
||||||
|
state.shown = false;
|
||||||
|
state.consent_overlay_shown = false;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(webview) = app.webviews().get("ads-window") {
|
if let Some(webview) = app.webviews().get("ads-window") {
|
||||||
let state = app.state::<RwLock<AdsState>>();
|
if !reset {
|
||||||
let mut state = state.write().await;
|
|
||||||
|
|
||||||
if reset {
|
|
||||||
state.shown = false;
|
|
||||||
state.consent_overlay_shown = false;
|
|
||||||
} else {
|
|
||||||
state.modal_shown = true;
|
state.modal_shown = true;
|
||||||
|
|
||||||
if state.consent_overlay_shown {
|
if state.consent_overlay_shown {
|
||||||
|
|||||||
Reference in New Issue
Block a user