mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +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> {
|
||||
val day = TimeUnit.DAYS.toMillis(1)
|
||||
var currentDay = firstOrNull()?.date?.time ?: return listOf()
|
||||
var tempList = this
|
||||
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
|
||||
return groupBy { it.date.time / day }
|
||||
.map { WrappedMagiskLog(it.key * day, it.value) }
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user