chore(settings): Add "danger zone" category

This commit is contained in:
Ahmad Ansori Palembani 2024-11-21 10:28:29 +07:00
parent d163dc500c
commit b1f2c30892
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -426,6 +426,9 @@ class SettingsAdvancedController : SettingsLegacyController() {
} }
} }
preferenceCategory {
title = "Danger zone!"
preference { preference {
title = "Crash the app!" title = "Crash the app!"
summary = "To test crashes" summary = "To test crashes"
@ -445,14 +448,17 @@ class SettingsAdvancedController : SettingsLegacyController() {
onClick { onClick {
activity!!.materialAlertDialog() activity!!.materialAlertDialog()
.setTitle("Are you sure?") .setTitle("Are you sure?")
.setMessage("Failed workers should clear out by itself eventually, " + .setMessage(
"this option should only be used if you're being impatient and you know what you're doing.") "Failed workers should clear out by itself eventually, " +
"this option should only be used if you're being impatient and you know what you're doing."
)
.setPositiveButton("Prune") { _, _ -> context.workManager.pruneWork() } .setPositiveButton("Prune") { _, _ -> context.workManager.pruneWork() }
.setNegativeButton("Cancel", null) .setNegativeButton("Cancel", null)
.show() .show()
} }
} }
} }
}
@OptIn(DelicateCoroutinesApi::class) @OptIn(DelicateCoroutinesApi::class)
private fun cleanupDownloads(removeRead: Boolean, removeNonFavorite: Boolean) { private fun cleanupDownloads(removeRead: Boolean, removeNonFavorite: Boolean) {