Skip to content

Commit

Permalink
fix css not being loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Vendicated committed Jan 4, 2023
1 parent ac4e05e commit f7b95b0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
5 changes: 5 additions & 0 deletions app/src/main/java/dev/vendicated/vencord/Constants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package dev.vendicated.vencord;

public class Constants {
public static final String JS_BUNDLE_URL = "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js";
}
4 changes: 1 addition & 3 deletions app/src/main/java/dev/vendicated/vencord/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import java.util.Locale;

public class HttpClient {
public static final String VENCORD_BUNDLE_URL = "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js";

public static final class HttpException extends IOException {
private final HttpURLConnection conn;
private String message;
Expand Down Expand Up @@ -53,7 +51,7 @@ public static void fetchVencord(Activity activity) throws IOException {
VencordMobileRuntime = readAsText(is);
}

var conn = fetch(VENCORD_BUNDLE_URL);
var conn = fetch(Constants.JS_BUNDLE_URL);
try (var is = conn.getInputStream()) {
VencordRuntime = readAsText(is);
}
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/dev/vendicated/vencord/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,11 @@ private void explodeAndroid() {

public void handleUrl(Uri url) {
if (url != null) {
if (!url.getAuthority().contains("discord")) return;
if (!url.getAuthority().equals("discord.com")) return;
if (!wvInitialized) {
wv.loadUrl(url.toString());
} else {
wv.evaluateJavascript("Vencord.Webpack.Common.NavigationRouter.transitionTo(\"" + url.getPath() + "\")", (result) -> {
});
wv.evaluateJavascript("Vencord.Webpack.Common.NavigationRouter.transitionTo(\"" + url.getPath() + "\")", null);
}
}
}
Expand All @@ -130,5 +129,4 @@ protected void onNewIntent(Intent intent) {
Uri data = intent.getData();
if (data != null) handleUrl(data);
}

}
9 changes: 9 additions & 0 deletions app/src/main/res/raw/vencord_mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,13 @@
return false;
}
};

document.addEventListener("DOMContentLoaded", () => document.documentElement.appendChild(
Object.assign(document.createElement("link"), {
rel: "stylesheet",
type: "text/css",
href: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.css"
}),
{ once: true }
));
})();

0 comments on commit f7b95b0

Please sign in to comment.