Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,14 @@ fun FileDataStorageManager.isPendingOfflineCreation(file: OCFile): Boolean {
return offlineOperationDao.getByPath(path)?.isCreate() == true
}

private fun FileDataStorageManager.upsertFolderContent(folder: OCFile, files: List<OCFile>) {
files.forEach { file ->
private fun FileDataStorageManager.upsertFolderContent(folder: OCFile, remoteFiles: List<OCFile>) {
remoteFiles.forEach { file ->
val existingFile = findExistingFile(file)
val entity = file.toFileEntity(user.accountName).copy(
val remoteEntity = file.toFileEntity(user.accountName)
val entity = remoteEntity.copy(
id = existingFile?.id,
parent = folder.fileId,
mountType = existingFile?.mountType
mountType = remoteEntity.mountType ?: existingFile?.mountType
)

val insertedRowId = fileDao.upsert(entity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fun OCFile.toFileEntity(accountName: String): FileEntity = FileEntity(
isEncrypted = isEncrypted.toInt(),
etagInConflict = etagInConflict,
sharedWithSharee = isSharedWithSharee.toInt(),
mountType = null,
mountType = mountType?.ordinal,
hasPreview = isPreviewAvailable.toInt(),
unreadCommentsCount = unreadCommentsCount,
ownerId = ownerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,9 @@ private ContentValues createContentValuesBase(OCFile fileOrFolder) {
cv.put(ProviderTableMeta.FILE_ETAG_ON_SERVER, fileOrFolder.getEtagOnServer());
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, fileOrFolder.isSharedViaLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, fileOrFolder.isSharedWithSharee() ? 1 : 0);
if (fileOrFolder.getMountType() != null) {
cv.put(ProviderTableMeta.FILE_MOUNT_TYPE, fileOrFolder.getMountType().ordinal());
}
cv.put(ProviderTableMeta.FILE_PERMISSIONS, fileOrFolder.getPermissions());
cv.put(ProviderTableMeta.FILE_REMOTE_ID, fileOrFolder.getRemoteId());
cv.put(ProviderTableMeta.FILE_LOCAL_ID, fileOrFolder.getLocalId());
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/owncloud/android/datamodel/OCFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ public void setFileName(String name) {
/**
* Used internally. Reset all file properties
*/
@SuppressFBWarnings("ENMI_NULL_ENUM_VALUE")
private void resetData() {
fileId = -1;
remotePath = null;
Expand Down Expand Up @@ -521,7 +522,7 @@ private void resetData() {
hidden = false;
encrypted = false;
readOnly = false;
mountType = WebdavEntry.MountType.INTERNAL;
mountType = null;
Comment thread
daniele-verducci marked this conversation as resolved.
Resolved
richWorkspace = "";
firstShareTimestamp = 0;
locked = false;
Expand Down Expand Up @@ -705,7 +706,7 @@ private boolean hasPermission(String permission) {
}

public Integer getFileOverlayIconId(boolean isAutoUploadFolder) {
if (WebdavEntry.MountType.GROUP == mountType || mounted()) {
if (WebdavEntry.MountType.GROUP == mountType) {
return R.drawable.ic_folder_overlay_account_group;
} else if (sharedViaLink && !encrypted) {
return R.drawable.ic_folder_overlay_link;
Expand Down Expand Up @@ -859,6 +860,7 @@ public boolean isReadOnly() {
return this.readOnly;
}

@Nullable
public WebdavEntry.MountType getMountType() {
return this.mountType;
}
Expand Down
Loading