From 639484f9fb30e54af16642fd0a0a859fc8f89fb8 Mon Sep 17 00:00:00 2001 From: Juan Carlos Garrote Date: Tue, 26 Nov 2024 14:35:08 +0100 Subject: [PATCH] feat: hack to mock a default quota for multi-personal accounts --- .../android/data/spaces/repository/OCSpacesRepository.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/owncloudData/src/main/java/com/owncloud/android/data/spaces/repository/OCSpacesRepository.kt b/owncloudData/src/main/java/com/owncloud/android/data/spaces/repository/OCSpacesRepository.kt index bcabd393582..d7a3a7e2ac7 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/spaces/repository/OCSpacesRepository.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/spaces/repository/OCSpacesRepository.kt @@ -39,8 +39,11 @@ class OCSpacesRepository( remoteSpacesDataSource.refreshSpacesForAccount(accountName).also { listOfSpaces -> localSpacesDataSource.saveSpacesForAccount(listOfSpaces) val personalSpace = listOfSpaces.find { it.isPersonal } + val isMultiPersonal = listOfSpaces.count { it.isPersonal } > 1 personalSpace?.let { - val userQuota = if (it.quota?.total!!.toInt() == 0) { + val userQuota = if (isMultiPersonal) { + UserQuota(accountName, 0, 0, 0, UserQuotaState.NORMAL) + } else if (it.quota?.total!!.toInt() == 0) { UserQuota(accountName, -3, it.quota?.used!!, it.quota?.total!!, UserQuotaState.fromValue(it.quota?.state!!)) } else { UserQuota(accountName, it.quota?.remaining!!, it.quota?.used!!, it.quota?.total!!, UserQuotaState.fromValue(it.quota?.state!!))