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,30 +426,36 @@ class SettingsAdvancedController : SettingsLegacyController() {
} }
} }
preference { preferenceCategory {
title = "Crash the app!" title = "Danger zone!"
summary = "To test crashes"
onClick {
activity!!.materialAlertDialog()
.setTitle(MR.strings.warning)
.setMessage("I told you this would crash the app, why would you want that?")
.setPositiveButton("Crash it anyway") { _, _ -> throw RuntimeException("Fell into the void") }
.setNegativeButton("Nevermind", null)
.show()
}
}
preference { preference {
title = "Prune finished workers" title = "Crash the app!"
summary = "In case worker stuck in FAILED state and you're too impatient to wait" summary = "To test crashes"
onClick { onClick {
activity!!.materialAlertDialog() activity!!.materialAlertDialog()
.setTitle("Are you sure?") .setTitle(MR.strings.warning)
.setMessage("Failed workers should clear out by itself eventually, " + .setMessage("I told you this would crash the app, why would you want that?")
"this option should only be used if you're being impatient and you know what you're doing.") .setPositiveButton("Crash it anyway") { _, _ -> throw RuntimeException("Fell into the void") }
.setPositiveButton("Prune") { _, _ -> context.workManager.pruneWork() } .setNegativeButton("Nevermind", null)
.setNegativeButton("Cancel", null) .show()
.show() }
}
preference {
title = "Prune finished workers"
summary = "In case worker stuck in FAILED state and you're too impatient to wait"
onClick {
activity!!.materialAlertDialog()
.setTitle("Are you sure?")
.setMessage(
"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() }
.setNegativeButton("Cancel", null)
.show()
}
} }
} }
} }