Skip to content

Commit

Permalink
Fix Active TokenScript view
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesSmartCell committed Dec 10, 2023
1 parent 9dc6963 commit 579ca9e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ private void loadImage(String url, String backgroundColor) throws IllegalArgumen
private void setWebView(String imageUrl, ImageType hint)
{
progressBar.setVisibility(VISIBLE);
webView.setOnTouchListener(this);
webView.setVerticalScrollBarEnabled(false);
webView.setHorizontalScrollBarEnabled(false);
webView.setWebChromeClient(new WebChromeClient());
Expand Down Expand Up @@ -245,6 +244,7 @@ public void onPageFinished(WebView view, String url)
else if (useType.getImageType() == ImageType.ANIM)
{
String loaderAnim = loadFile(getContext(), R.raw.token_anim).replace("[URL]", imageUrl).replace("[MIME]", useType.getMimeType());
webView.setOnTouchListener(this);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
Expand All @@ -256,6 +256,7 @@ else if (useType.getImageType() == ImageType.ANIM)
}
else if (useType.getImageType() == ImageType.MODEL)
{
webView.setOnTouchListener(this);
String loader = loadFile(getContext(), R.raw.token_model).replace("[URL]", imageUrl);
String base64 = android.util.Base64.encodeToString(loader.getBytes(StandardCharsets.UTF_8), Base64.DEFAULT);
webView.loadData(base64, "text/html; charset=utf-8", "base64");
Expand Down Expand Up @@ -554,7 +555,11 @@ public DisplayType(String url, ImageType hint)
{
case "":
mimeStr = "";
if (hint == ImageType.IMAGE || hint == ImageType.ANIM)
if (url.contains("tokenscript.org"))
{
type = ImageType.WEB;
}
else if (hint == ImageType.IMAGE || hint == ImageType.ANIM)
{
type = hint;
}
Expand Down

0 comments on commit 579ca9e

Please sign in to comment.