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, + ) }