mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 10:35:26 +00:00
Fixed logs being bugged down by unreliable code
This commit is contained in:
parent
e79e744e08
commit
a6e7680212
@ -33,22 +33,8 @@ class LogRepository(
|
|||||||
|
|
||||||
private fun List<MagiskLog>.wrap(): List<WrappedMagiskLog> {
|
private fun List<MagiskLog>.wrap(): List<WrappedMagiskLog> {
|
||||||
val day = TimeUnit.DAYS.toMillis(1)
|
val day = TimeUnit.DAYS.toMillis(1)
|
||||||
var currentDay = firstOrNull()?.date?.time ?: return listOf()
|
return groupBy { it.date.time / day }
|
||||||
var tempList = this
|
.map { WrappedMagiskLog(it.key * day, it.value) }
|
||||||
val outList = mutableListOf<WrappedMagiskLog>()
|
|
||||||
|
|
||||||
while (tempList.isNotEmpty()) {
|
|
||||||
val logsGivenDay = takeWhile { it.date.time / day == currentDay / day }
|
|
||||||
currentDay = tempList.firstOrNull()?.date?.time ?: currentDay + day
|
|
||||||
|
|
||||||
if (logsGivenDay.isEmpty())
|
|
||||||
continue
|
|
||||||
|
|
||||||
outList.add(WrappedMagiskLog(currentDay / day * day, logsGivenDay))
|
|
||||||
tempList = tempList.subList(logsGivenDay.size, tempList.size)
|
|
||||||
}
|
|
||||||
|
|
||||||
return outList
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user