Skip to content

Commit

Permalink
Add confirmation before reset ChromeXt
Browse files Browse the repository at this point in the history
  • Loading branch information
JingMatrix committed Jun 25, 2023
1 parent 4befc83 commit 47e62d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/main/java/org/matrix/chromext/proxy/Menu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ object MenuProxy {
setChecked.invoke(preferences["gesture_mod"], false)
}

var reset_confirming = 1
val listeners =
mapOf(
"bookmark" to
Expand Down Expand Up @@ -224,6 +225,13 @@ object MenuProxy {
},
"reset" to
fun(_: Any) {
if (reset_confirming < 3) {
Log.toast(
ctx,
"Clik ${3 - reset_confirming} more times if you confirm to reset ChromeXt")
reset_confirming += 1
return
}
arrayOf("ChromeXt", "CosmeticFilter", "UserAgent").forEach {
with(ctx.getSharedPreferences(it, Context.MODE_PRIVATE).edit()) {
clear()
Expand Down

0 comments on commit 47e62d1

Please sign in to comment.