Skip to content

Commit

Permalink
prepare for arrival of new settings
Browse files Browse the repository at this point in the history
  • Loading branch information
nin0-dev committed Feb 25, 2025
1 parent dd243b7 commit e1fca43
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/nin0dev/vendroid/Constants.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.nin0dev.vendroid

object Constants {
const val JS_BUNDLE_URL = "https://github.com/VendroidEnhanced/plugin/releases/download/devbuild/browser.js"
const val EQUICORD_BUNDLE_URL = "https://github.com/VendroidEnhanced/plugin/releases/download/devbuild-equi/browser.js"
const val JS_BUNDLE_URL = "https://github.com/VendroidEnhanced/plugin/releases/download/vencord/browser.js"
const val EQUICORD_BUNDLE_URL = "https://github.com/VendroidEnhanced/plugin/releases/download/equicord/browser.js"
}
3 changes: 2 additions & 1 deletion app/src/main/java/com/nin0dev/vendroid/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.android.volley.toolbox.StringRequest
import com.android.volley.toolbox.Volley
import com.google.android.material.color.DynamicColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.firebase.Firebase
import com.google.gson.Gson
import com.nin0dev.vendroid.HttpClient.fetchVencord
import com.nin0dev.vendroid.Logger.e
Expand All @@ -41,7 +42,7 @@ class MainActivity : Activity() {
val sPrefs = getSharedPreferences("settings", Context.MODE_PRIVATE)
if(sPrefs.getBoolean("checkVendroidUpdates", false) || ignoreSetting) {
val queue = Volley.newRequestQueue(this)
val url = "https://vendroid.nin0.dev/api/updates"
val url = "https://vendroid-staging.nin0.dev/api/updates"
val stringRequest = StringRequest(
Request.Method.GET, url,
{ response ->
Expand Down
37 changes: 37 additions & 0 deletions app/src/main/java/com/nin0dev/vendroid/VencordNative.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.nin0dev.vendroid
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.util.Log
import android.webkit.JavascriptInterface
import android.webkit.WebView
import android.widget.Toast
Expand Down Expand Up @@ -39,4 +40,40 @@ class VencordNative(private val activity: MainActivity, private val wv: WebView)
fun checkVendroidUpdates() {
activity.checkUpdates(ignoreSetting = true)
}

@JavascriptInterface
fun getString(id: String, defaultValue: String): String {
val sPrefs = activity.getSharedPreferences("settings", Context.MODE_PRIVATE)
return try {
sPrefs.getString(id, defaultValue)!!;
} catch (e: Exception) {
"None";
}
}

@JavascriptInterface
fun getBool(id: String, defaultValue: Boolean): Boolean {
val sPrefs = activity.getSharedPreferences("settings", Context.MODE_PRIVATE)
return try {
sPrefs.getBoolean(id, defaultValue);
} catch (e: Exception) {
false;
}
}

@JavascriptInterface
fun setString(id: String, value: String) {
val sPrefs = activity.getSharedPreferences("settings", Context.MODE_PRIVATE)
val e = sPrefs.edit()
e.putString(id, value)
e.apply()
}

@JavascriptInterface
fun setBool(id: String, value: Boolean) {
val sPrefs = activity.getSharedPreferences("settings", Context.MODE_PRIVATE)
val e = sPrefs.edit()
e.putBoolean(id, value)
e.apply()
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/raw/vencord_mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
Object.assign(document.createElement("link"), {
rel: "stylesheet",
type: "text/css",
href: "https://github.com/VendroidEnhanced/plugin/releases/download/css/fixes.css"
href: "https://raw.githubusercontent.com/VendroidEnhanced/random-files/refs/heads/main/moreFixes.css"
}));
}, { once: true });

Expand Down

0 comments on commit e1fca43

Please sign in to comment.