From 8e1665ba27ce8f727481a54256ba5cd2d5ac22b0 Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 21 Dec 2023 10:50:05 +0000 Subject: [PATCH] Properly define webview user data directory --- app/src/main/java/io/xpipe/app/comp/base/MarkdownComp.java | 2 ++ app/src/main/java/io/xpipe/app/fxcomps/impl/SvgView.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/src/main/java/io/xpipe/app/comp/base/MarkdownComp.java b/app/src/main/java/io/xpipe/app/comp/base/MarkdownComp.java index 26104347..8dff2af2 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/MarkdownComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/MarkdownComp.java @@ -1,5 +1,6 @@ package io.xpipe.app.comp.base; +import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppResources; import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.CompStructure; @@ -47,6 +48,7 @@ public class MarkdownComp extends Comp> { @SneakyThrows private WebView createWebView() { var wv = new WebView(); + wv.getEngine().setUserDataDirectory(AppProperties.get().getDataDir().resolve("webview").toFile()); wv.setPageFill(Color.TRANSPARENT); var theme = AppPrefs.get() != null && AppPrefs.get().theme.getValue().isDark() ? "web/github-markdown-dark.css" : "web/github-markdown-light.css"; var url = AppResources.getResourceURL(AppResources.XPIPE_MODULE, theme) diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/SvgView.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/SvgView.java index 59edaef2..bb284cd4 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/SvgView.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/SvgView.java @@ -1,5 +1,6 @@ package io.xpipe.app.fxcomps.impl; +import io.xpipe.app.core.AppProperties; import io.xpipe.app.fxcomps.CompStructure; import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.fxcomps.util.SimpleChangeListener; @@ -54,6 +55,7 @@ public class SvgView { private WebView createWebView() { var wv = new WebView(); + wv.getEngine().setUserDataDirectory(AppProperties.get().getDataDir().resolve("webview").toFile()); // Sometimes a web view might not render when the background is set to transparent, at least according to stack // overflow wv.setPageFill(Color.valueOf("#00000001"));