Skip to content

Commit

Permalink
Improved the scanning process and added a progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Jul 10, 2024
1 parent 08b419e commit 2f7d73a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/src/main/kotlin/com/d4rk/cleaner/ui/home/HomeViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) {
isAnalyzing.value = true
showCleaningComposable.value = true
viewModelScope.launch {
withContext(Dispatchers.IO) {
val filteredFiles = withContext(Dispatchers.IO) {
fileScanner.startScanning()
withContext(Dispatchers.Main) {
scannedFiles.value = fileScanner.getFilteredFiles()
isAnalyzing.value = false
hasScanned.value = true
}
fileScanner.getFilteredFiles()
}

withContext(Dispatchers.Main) {
scannedFiles.value = filteredFiles
isAnalyzing.value = false
hasScanned.value = true
}
}
}
Expand Down

0 comments on commit 2f7d73a

Please sign in to comment.