diff --git a/feature/feature-logging/src/main/kotlin/com/f0x1d/feature/logging/service/LoggingService.kt b/feature/feature-logging/src/main/kotlin/com/f0x1d/feature/logging/service/LoggingService.kt index 7fdf6526..37f3a461 100644 --- a/feature/feature-logging/src/main/kotlin/com/f0x1d/feature/logging/service/LoggingService.kt +++ b/feature/feature-logging/src/main/kotlin/com/f0x1d/feature/logging/service/LoggingService.kt @@ -88,7 +88,6 @@ class LoggingService : LifecycleService() { private val logs = LinkedList() private val logsMutex = Mutex() private var loggingJob: Job? = null - private var idsCounter = -1L private lateinit var filtersState: StateFlow> @@ -140,7 +139,7 @@ class LoggingService : LifecycleService() { while (true) { loggingRepository.startLogging( terminal = loggingTerminal, - startingId = idsCounter, + startingId = logs.lastOrNull()?.id ?: 0, ).catch { throwable -> if (throwable is TerminalNotSupportedException) { if (appPreferences.fallbackToDefaultTerminal) { diff --git a/feature/feature-logging/src/main/kotlin/com/f0x1d/feature/logging/viewmodel/LogsViewModel.kt b/feature/feature-logging/src/main/kotlin/com/f0x1d/feature/logging/viewmodel/LogsViewModel.kt index 1f0b6fc2..edae13d2 100644 --- a/feature/feature-logging/src/main/kotlin/com/f0x1d/feature/logging/viewmodel/LogsViewModel.kt +++ b/feature/feature-logging/src/main/kotlin/com/f0x1d/feature/logging/viewmodel/LogsViewModel.kt @@ -116,7 +116,7 @@ class LogsViewModel @Inject constructor( } fun selectAll() { - if (selectedItems.value == logs.value) selectedItems.update { + if (selectedItems.value.containsAll(logs.value)) selectedItems.update { emptySet() } else selectedItems.update { logs.value.toSet()