From fe6aaf27f98e8ebd88641d8a110770d999c77ac4 Mon Sep 17 00:00:00 2001 From: Aitorbp Date: Mon, 30 Oct 2023 13:27:07 +0000 Subject: [PATCH] Some fixes from CR --- .../presentation/files/filelist/MainFileListFragment.kt | 1 - .../owncloud/android/ui/activity/FileDisplayActivity.kt | 1 + .../data/file/datasources/OCLocalFileDataSourceTest.kt | 2 +- .../domain/files/usecases/SetLastUsageFileUseCase.kt | 7 ++++++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt index 4cb811fff0e..aa996518464 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt @@ -1133,7 +1133,6 @@ class MainFileListFragment : Fragment(), if (ocFile.isFolder) { mainFileListViewModel.updateFolderToDisplay(ocFile) } else { // Click on a file - fileOperationsViewModel.setLastUsageFile(ocFile) fileActions?.onFileClicked(ocFile) } } diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt index a403d3b15a6..09281d59b5b 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt @@ -1731,6 +1731,7 @@ class FileDisplayActivity : FileActivity(), startSyncThenOpen(file) } } + fileOperationsViewModel.setLastUsageFile(file) } override fun onShareFileClicked(file: OCFile) { diff --git a/owncloudData/src/test/java/com/owncloud/android/data/file/datasources/OCLocalFileDataSourceTest.kt b/owncloudData/src/test/java/com/owncloud/android/data/file/datasources/OCLocalFileDataSourceTest.kt index 43e1e8a95a6..5b90d8e4be0 100644 --- a/owncloudData/src/test/java/com/owncloud/android/data/file/datasources/OCLocalFileDataSourceTest.kt +++ b/owncloudData/src/test/java/com/owncloud/android/data/file/datasources/OCLocalFileDataSourceTest.kt @@ -698,7 +698,7 @@ class OCLocalFileDataSourceTest { @Test fun `updateFileWithLastUsage should change last usage parameter with null for a file`() { - every { dao.updateFileWithLastUsage(any(), null) } returns Unit + every { dao.updateFileWithLastUsage(OC_FILE.id!!, null) } returns Unit localDataSource.updateFileWithLastUsage(OC_FILE.id!!, null) diff --git a/owncloudDomain/src/main/java/com/owncloud/android/domain/files/usecases/SetLastUsageFileUseCase.kt b/owncloudDomain/src/main/java/com/owncloud/android/domain/files/usecases/SetLastUsageFileUseCase.kt index eaac63336bd..4b165b9c15d 100644 --- a/owncloudDomain/src/main/java/com/owncloud/android/domain/files/usecases/SetLastUsageFileUseCase.kt +++ b/owncloudDomain/src/main/java/com/owncloud/android/domain/files/usecases/SetLastUsageFileUseCase.kt @@ -33,5 +33,10 @@ class SetLastUsageFileUseCase( } } - data class Params(val fileId: Long, val lastUsage: Long?, val isAvailableLocally: Boolean, val isFolder: Boolean) + data class Params( + val fileId: Long, + val lastUsage: Long?, + val isAvailableLocally: Boolean, + val isFolder: Boolean, + ) }