Skip to content

Commit

Permalink
feat: (ApiV3) - Handle recent changes last page
Browse files Browse the repository at this point in the history
  • Loading branch information
sirambd committed Oct 27, 2023
1 parent eb99dd8 commit 51347bb
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import com.infomaniak.drive.data.api.ApiRepository
import com.infomaniak.drive.data.cache.FileController
import com.infomaniak.drive.ui.fileList.FileListFragment
import com.infomaniak.drive.utils.AccountUtils
import com.infomaniak.drive.utils.isLastPage
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -57,10 +56,13 @@ class RecentChangesViewModel : ViewModel() {
val apiResponse = ApiRepository.getLastModifiedFiles(AccountUtils.currentDriveId, cursor)
return if (apiResponse.isSuccess()) {
apiResponse.data?.let { data ->
val isComplete = apiResponse.isLastPage()
currentCursor = apiResponse.cursor
FileController.storeRecentChanges(data, isFirstPage)
FileListFragment.FolderFilesResult(files = data, isComplete = isComplete, isFirstPage = isFirstPage)
FileListFragment.FolderFilesResult(
files = data,
isComplete = currentCursor == null,
isFirstPage = isFirstPage
)
}
} else {
FileListFragment.FolderFilesResult(
Expand Down

0 comments on commit 51347bb

Please sign in to comment.