Skip to content

Commit 2a14413

Browse files
paigelynin0-dev
andauthored
Option to clear custom Vencord bundle in recovery (#130)
Co-authored-by: nin0 <personal@nin0.dev>
1 parent 928fbf2 commit 2a14413

File tree

5 files changed

+50
-1
lines changed

5 files changed

+50
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
An actively maintained fork of Vendroid, a Discord client that loads the mobile website and injects Vencord.
44

5-
[website](https://vendroid.nin0.dev) · [download](https://vendroid.nin0.dev/download) · [faq](https://vendroid.nin0.dev/faq) · [support](https://discord.gg/qtmpcF56Yf)
5+
[website](https://vendroid.nin0.dev) · [download](https://vendroid.nin0.dev/download) · [faq](https://vendroid.nin0.dev/faq) · [support](https://discord.gg/6ckFahqUcd)

app/src/main/java/com/nin0dev/vendroid/MainActivity.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import com.nin0dev.vendroid.webview.VChromeClient
3232
import com.nin0dev.vendroid.webview.VWebviewClient
3333
import com.nin0dev.vendroid.webview.VencordNative
3434
import pl.droidsonroids.gif.GifImageView
35+
import java.io.File
3536
import java.io.IOException
3637

3738

@@ -193,6 +194,15 @@ class MainActivity : Activity() {
193194
s.domStorageEnabled = true
194195
s.allowFileAccess = true
195196

197+
if (sPrefs.getBoolean("clearBundle", false)) {
198+
File(filesDir, "vencord.js").delete()
199+
editor.putString("vencordLocation", null)
200+
editor.putBoolean("clearBundle", false)
201+
editor.apply()
202+
Toast.makeText(this, "Custom Vencord bundle cleared", Toast.LENGTH_SHORT)
203+
.show()
204+
}
205+
196206
if (!sPrefs.getBoolean("safeMode", false)) {
197207
wv?.addJavascriptInterface(VencordNative(this, wv!!), "VencordMobileNative")
198208
try {

app/src/main/java/com/nin0dev/vendroid/RecoveryActivity.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ class RecoveryActivity : AppCompatActivity() {
4040
startActivity(Intent(this, MainActivity::class.java))
4141
}
4242

43+
findViewById<MaterialCardView>(R.id.clear_bundle).setOnClickListener {
44+
val sPrefs = getSharedPreferences("settings", Context.MODE_PRIVATE)
45+
val e = sPrefs.edit()
46+
e.putBoolean("clearBundle", true)
47+
e.apply()
48+
finish()
49+
startActivity(Intent(this, MainActivity::class.java))
50+
}
4351
}
4452
override fun onNewIntent(intent: Intent) {
4553
super.onNewIntent(intent)

app/src/main/res/layout/activity_recovery.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,35 @@
106106
</LinearLayout>
107107
</com.google.android.material.card.MaterialCardView>
108108

109+
<com.google.android.material.card.MaterialCardView
110+
android:id="@+id/clear_bundle"
111+
android:layout_width="match_parent"
112+
android:layout_height="wrap_content"
113+
android:layout_marginTop="10dp"
114+
android:clickable="true">
115+
116+
<LinearLayout
117+
android:layout_width="match_parent"
118+
android:layout_height="match_parent"
119+
android:orientation="vertical"
120+
android:padding="16dp">
121+
122+
<TextView
123+
android:layout_width="wrap_content"
124+
android:layout_height="wrap_content"
125+
android:text="@string/clear_bundle"
126+
android:textAppearance="?attr/textAppearanceTitleMedium" />
127+
128+
<TextView
129+
android:layout_width="wrap_content"
130+
android:layout_height="wrap_content"
131+
android:layout_marginTop="8dp"
132+
android:text="@string/clear_bundle_desc"
133+
android:textAppearance="?attr/textAppearanceBodyMedium"
134+
android:textColor="?android:attr/textColorSecondary" />
135+
</LinearLayout>
136+
</com.google.android.material.card.MaterialCardView>
137+
109138

110139
</LinearLayout>
111140

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@
4040
<string name="save_exit"><![CDATA[Save & exit]]></string>
4141
<string name="force_update">Force update Vencord</string>
4242
<string name="force_update_desc">Start VendroidEnhanced, but force a Vencord update. Useful if you are crashing or similar and cannot access the Updater tab.</string>
43+
<string name="clear_bundle">Clear custom bundle</string>
44+
<string name="clear_bundle_desc">Clears the custom bundle you have set (if any) and goes back to stock Vencord.</string>
4345
</resources>

0 commit comments

Comments
 (0)