Commit 878b530e authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Add function to enable "failed to call close" watcher

parent a4e61044
......@@ -467,3 +467,16 @@ fun Context.askOpenFAQ(topic: FAQTopic?) {
fun Context.openFAQ(topic:FAQTopic?) {
tryViewUri("https://nebulo.app/faq#${topic?.id ?: ""}")
}
/**
* Enables stack-traces whenever `close()` wasn't called on a resource
*/
fun enableResourceCloseWatcher() {
try {
Class.forName("dalvik.system.CloseGuard")
.getMethod("setEnabled", Boolean::class.javaPrimitiveType)
.invoke(null, true)
} catch (e: ReflectiveOperationException) {
throw RuntimeException(e)
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment