From 2e460d9cf7d74ae62678f3eb5e482fe9c472283d Mon Sep 17 00:00:00 2001 From: davigonz Date: Tue, 1 Oct 2019 10:49:58 +0200 Subject: [PATCH] Include mapper for remote capabilities --- .../lib/resources/shares/RemoteShareMapper.kt | 2 +- .../status/RemoteCapabilityMapper.kt | 62 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/RemoteCapabilityMapper.kt diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/RemoteShareMapper.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/RemoteShareMapper.kt index 81229fa9..b2a56a06 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/RemoteShareMapper.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares/RemoteShareMapper.kt @@ -19,7 +19,7 @@ package com.owncloud.android.lib.resources.shares -import com.owncloud.android.domain.mapper.RemoteMapper +import com.owncloud.android.domain.mappers.RemoteMapper import com.owncloud.android.domain.sharing.shares.model.OCShare class RemoteShareMapper : RemoteMapper { diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/RemoteCapabilityMapper.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/RemoteCapabilityMapper.kt new file mode 100644 index 00000000..431816c0 --- /dev/null +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/RemoteCapabilityMapper.kt @@ -0,0 +1,62 @@ +/** + * ownCloud Android client application + * + * @author David González Verdugo + * Copyright (C) 2019 ownCloud GmbH. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.owncloud.android.lib.resources.status + +import com.owncloud.android.domain.capabilities.model.OCCapability +import com.owncloud.android.domain.mappers.RemoteMapper + +class RemoteCapabilityMapper : RemoteMapper { + override fun toModel(remote: RemoteCapability?): OCCapability? = + remote?.let { + OCCapability( + accountName = remote.accountName, + versionMayor = remote.versionMayor, + versionMinor = remote.versionMinor, + versionMicro = remote.versionMicro, + versionString = remote.versionString, + versionEdition = remote.versionEdition, + corePollInterval = remote.corePollinterval, + filesSharingApiEnabled = remote.filesSharingApiEnabled, + filesSharingPublicEnabled = remote.filesSharingPublicEnabled, + filesSharingPublicPasswordEnforced = remote.filesSharingPublicPasswordEnforced, + filesSharingPublicPasswordEnforcedReadOnly = remote.filesSharingPublicPasswordEnforcedReadOnly, + filesSharingPublicPasswordEnforcedReadWrite = remote.filesSharingPublicPasswordEnforcedReadWrite, + filesSharingPublicPasswordEnforcedUploadOnly = remote.filesSharingPublicPasswordEnforcedUploadOnly, + filesSharingPublicExpireDateEnabled = remote.filesSharingPublicExpireDateEnabled, + filesSharingPublicExpireDateDays = remote.filesSharingPublicExpireDateDays, + filesSharingPublicExpireDateEnforced = remote.filesSharingPublicExpireDateEnforced, + filesSharingPublicSendMail = remote.filesSharingPublicSendMail, + filesSharingPublicUpload = remote.filesSharingPublicUpload, + filesSharingPublicMultiple = remote.filesSharingPublicMultiple, + filesSharingPublicSupportsUploadOnly = remote.filesSharingPublicSupportsUploadOnly, + filesSharingUserSendMail = remote.filesSharingUserSendMail, + filesSharingResharing = remote.filesSharingResharing, + filesSharingFederationOutgoing = remote.filesSharingFederationOutgoing, + filesSharingFederationIncoming = remote.filesSharingFederationIncoming, + filesBigFileChunking = remote.filesBigFileChunking, + filesUndelete = remote.filesUndelete, + filesVersioning = remote.filesVersioning + ) + } + + override fun toRemote(model: OCCapability?): RemoteCapability? { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +}