Fix storage usage calculation

pull/478/head
Koitharu 3 years ago
parent eeba161235
commit 399ac07fb3
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -16,8 +16,8 @@ android {
applicationId 'org.koitharu.kotatsu' applicationId 'org.koitharu.kotatsu'
minSdk = 21 minSdk = 21
targetSdk = 34 targetSdk = 34
versionCode = 573 versionCode = 574
versionName = '6.0' versionName = '6.0.1'
generatedDensities = [] generatedDensities = []
testInstrumentationRunner "org.koitharu.kotatsu.HiltTestRunner" testInstrumentationRunner "org.koitharu.kotatsu.HiltTestRunner"
ksp { ksp {

@ -53,11 +53,11 @@ class LocalStorageManager @Inject constructor(
} }
suspend fun computeStorageSize() = withContext(Dispatchers.IO) { suspend fun computeStorageSize() = withContext(Dispatchers.IO) {
getAvailableStorageDirs().sumOf { it.computeSize() } getConfiguredStorageDirs().sumOf { it.computeSize() }
} }
suspend fun computeAvailableSize() = runInterruptible(Dispatchers.IO) { suspend fun computeAvailableSize() = runInterruptible(Dispatchers.IO) {
getAvailableStorageDirs().mapToSet { it.freeSpace }.sum() getConfiguredStorageDirs().mapToSet { it.freeSpace }.sum()
} }
suspend fun clearCache(cache: CacheDir) = runInterruptible(Dispatchers.IO) { suspend fun clearCache(cache: CacheDir) = runInterruptible(Dispatchers.IO) {

Loading…
Cancel
Save