Skip to content

Commit

Permalink
We cannot be in the root folder anymore therefore remove multiselect …
Browse files Browse the repository at this point in the history
…check
  • Loading branch information
LunarX committed Feb 21, 2024
1 parent 98c0297 commit a8af7ca
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
14 changes: 0 additions & 14 deletions app/src/main/java/com/infomaniak/drive/data/models/drive/Drive.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
package com.infomaniak.drive.data.models.drive

import com.google.gson.annotations.SerializedName
import com.infomaniak.drive.data.models.File
import com.infomaniak.drive.data.models.Rights
import com.infomaniak.drive.utils.Utils
import io.realm.RealmList
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
Expand Down Expand Up @@ -96,17 +93,6 @@ open class Drive(

inline val isTechnicalMaintenance get() = maintenanceReason == MaintenanceReason.TECHNICAL.value

fun convertToFile(rootName: String? = null): File {
return File(
id = if (rootName == null) id else Utils.ROOT_ID,
driveId = id,
name = rootName ?: name,
type = File.Type.DRIVE.value,
lastModifiedAt = createdAt,
rights = Rights(canCreateFile = true)
).apply { driveColor = preferences.color }
}

fun isUserAdmin(): Boolean = role == "admin"

fun getUpdatedAt(): Date = Date(updatedAt * 1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,11 +760,7 @@ open class FileListFragment : MultiSelectFragment(MATOMO_CATEGORY), SwipeRefresh
realm = mainViewModel.realm
).apply { fileAdapter.updateFileList(this) }

multiSelectManager.currentFolder = if (result.parentFolder?.id == ROOT_ID) {
AccountUtils.getCurrentDrive()?.convertToFile(Utils.getRootName(requireContext()))
} else {
result.parentFolder
}
multiSelectManager.currentFolder = result.parentFolder

mainViewModel.setCurrentFolder(multiSelectManager.currentFolder)
changeNoFilesLayoutVisibility(
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/infomaniak/drive/utils/FileItemUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import com.infomaniak.drive.databinding.CardviewFolderGridBinding
import com.infomaniak.drive.databinding.ItemCategoriesLayoutBinding
import com.infomaniak.drive.databinding.ItemFileBinding
import com.infomaniak.drive.ui.fileList.FileListFragment.Companion.MAX_DISPLAYED_CATEGORIES
import com.infomaniak.drive.utils.Utils.ROOT_ID
import com.infomaniak.drive.views.CategoryIconView
import com.infomaniak.drive.views.ProgressLayoutView
import com.infomaniak.lib.core.utils.context
Expand Down Expand Up @@ -92,7 +91,6 @@ fun CardviewFileGridBinding.setFileItem(file: File, isGrid: Boolean = false) {


private fun ItemFileBinding.displayDate(file: File) = fileDate.apply {
isVisible = file.id != ROOT_ID
text = if (file.deletedAt.isPositive()) {
file.getDeletedAt().format(context.getString(R.string.allDeletedFilePattern))
} else {
Expand Down

0 comments on commit a8af7ca

Please sign in to comment.