mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-18 23:56:13 -08:00
Simplify UI code for Magisk logs
We have all texts, no need to go through recyclerview
This commit is contained in:
@@ -15,8 +15,22 @@ class LogRepository(
|
||||
fun fetchLogs() = logDao.fetchAll()
|
||||
|
||||
fun fetchMagiskLogs() = Single.fromCallable {
|
||||
Shell.su("tail -n 5000 ${Const.MAGISK_LOG}").exec().out
|
||||
}.flattenAsFlowable { it }.filter { it.isNotEmpty() }
|
||||
val list = object : AbstractMutableList<String>() {
|
||||
val buf = StringBuilder()
|
||||
override val size get() = 0
|
||||
override fun get(index: Int): String = ""
|
||||
override fun removeAt(index: Int): String = ""
|
||||
override fun set(index: Int, element: String): String = ""
|
||||
override fun add(index: Int, element: String) {
|
||||
if (element.isNotEmpty()) {
|
||||
buf.append(element)
|
||||
buf.append('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
Shell.su("cat ${Const.MAGISK_LOG}").to(list).exec()
|
||||
list.buf.toString()
|
||||
}
|
||||
|
||||
fun clearLogs() = logDao.deleteAll()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user