1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Remove dependency between the library and the domain layer

This commit is contained in:
davigonz 2019-10-02 13:20:22 +02:00
parent 2e460d9cf7
commit 9ea10e2f96
9 changed files with 81 additions and 122 deletions

View File

@ -4,8 +4,6 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-allopen' apply plugin: 'kotlin-allopen'
dependencies { dependencies {
implementation project(':owncloudDomain')
api 'com.squareup.okhttp3:okhttp:3.12.0' api 'com.squareup.okhttp3:okhttp:3.12.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
api 'com.gitlab.ownclouders:dav4android:oc_support_1.0.1' api 'com.gitlab.ownclouders:dav4android:oc_support_1.0.1'

View File

@ -27,7 +27,6 @@
package com.owncloud.android.lib.resources.shares package com.owncloud.android.lib.resources.shares
import com.owncloud.android.domain.sharing.shares.model.ShareType
import com.owncloud.android.lib.common.OwnCloudClient import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.common.http.HttpConstants import com.owncloud.android.lib.common.http.HttpConstants
import com.owncloud.android.lib.common.http.methods.nonwebdav.PostMethod import com.owncloud.android.lib.common.http.methods.nonwebdav.PostMethod

View File

@ -26,7 +26,6 @@ package com.owncloud.android.lib.resources.shares
import android.os.Parcel import android.os.Parcel
import android.os.Parcelable import android.os.Parcelable
import com.owncloud.android.domain.sharing.shares.model.ShareType
import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.lib.resources.files.FileUtils import com.owncloud.android.lib.resources.files.FileUtils
import java.io.Serializable import java.io.Serializable
@ -196,4 +195,45 @@ class RemoteShare : Parcelable, Serializable {
} }
} }
} }
}
/**
* // TODO This type is already included in the domain but we still need it here since the parsing takes place in this library for the moment
*
* Enum for Share Type, with values:
* -1 - No shared
* 0 - Shared by user
* 1 - Shared by group
* 3 - Shared by public link
* 4 - Shared by e-mail
* 5 - Shared by contact
* 6 - Federated
*
* @author masensio
*/
enum class ShareType constructor(val value: Int) {
NO_SHARED(-1),
USER(0),
GROUP(1),
PUBLIC_LINK(3),
EMAIL(4),
CONTACT(5),
FEDERATED(6);
companion object {
fun fromValue(value: Int): ShareType? {
return when (value) {
-1 -> NO_SHARED
0 -> USER
1 -> GROUP
3 -> PUBLIC_LINK
4 -> EMAIL
5 -> CONTACT
6 -> FEDERATED
else -> null
}
}
}
} }

View File

@ -1,51 +0,0 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.lib.resources.shares
import com.owncloud.android.domain.mappers.RemoteMapper
import com.owncloud.android.domain.sharing.shares.model.OCShare
class RemoteShareMapper : RemoteMapper<OCShare, RemoteShare> {
override fun toModel(remote: RemoteShare?): OCShare? =
remote?.let {
OCShare(
fileSource = remote.fileSource,
itemSource = remote.itemSource,
shareType = remote.shareType!!,
shareWith = remote.shareWith,
path = remote.path,
permissions = remote.permissions,
sharedDate = remote.sharedDate,
expirationDate = remote.expirationDate,
token = remote.token,
sharedWithDisplayName = remote.sharedWithDisplayName,
sharedWithAdditionalInfo = remote.sharedWithAdditionalInfo,
isFolder = remote.isFolder,
userId = remote.userId,
remoteId = remote.id,
name = remote.name,
shareLink = remote.shareLink
)
}
override fun toRemote(model: OCShare?): RemoteShare? {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}

View File

@ -28,7 +28,6 @@
package com.owncloud.android.lib.resources.shares package com.owncloud.android.lib.resources.shares
import android.net.Uri import android.net.Uri
import com.owncloud.android.domain.sharing.shares.model.ShareType
import com.owncloud.android.lib.common.operations.RemoteOperationResult import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.lib.resources.status.OwnCloudVersion import com.owncloud.android.lib.resources.status.OwnCloudVersion

View File

@ -25,7 +25,6 @@
package com.owncloud.android.lib.resources.shares package com.owncloud.android.lib.resources.shares
import android.util.Xml import android.util.Xml
import com.owncloud.android.domain.sharing.shares.model.ShareType
import com.owncloud.android.lib.common.network.WebdavUtils import com.owncloud.android.lib.common.network.WebdavUtils
import com.owncloud.android.lib.resources.files.FileUtils import com.owncloud.android.lib.resources.files.FileUtils

View File

@ -27,7 +27,6 @@
package com.owncloud.android.lib.resources.status package com.owncloud.android.lib.resources.status
import com.owncloud.android.domain.capabilities.model.CapabilityBooleanType
import com.owncloud.android.lib.common.OwnCloudClient import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.common.http.HttpConstants import com.owncloud.android.lib.common.http.HttpConstants
import com.owncloud.android.lib.common.http.methods.nonwebdav.GetMethod import com.owncloud.android.lib.common.http.methods.nonwebdav.GetMethod

View File

@ -26,8 +26,6 @@
*/ */
package com.owncloud.android.lib.resources.status package com.owncloud.android.lib.resources.status
import com.owncloud.android.domain.capabilities.model.CapabilityBooleanType
/** /**
* Contains data of the Capabilities for an account, from the Capabilities API * Contains data of the Capabilities for an account, from the Capabilities API
*/ */
@ -104,3 +102,43 @@ class RemoteCapability {
filesVersioning = CapabilityBooleanType.UNKNOWN filesVersioning = CapabilityBooleanType.UNKNOWN
} }
} }
/**
* Enum for Boolean Type in capabilities, with values:
* -1 - Unknown
* 0 - False
* 1 - True
*/
enum class CapabilityBooleanType constructor(val value: Int) {
UNKNOWN(-1),
FALSE(0),
TRUE(1);
val isUnknown: Boolean
get() = value == -1
val isFalse: Boolean
get() = value == 0
val isTrue: Boolean
get() = value == 1
companion object {
fun fromValue(value: Int): CapabilityBooleanType? {
return when (value) {
-1 -> UNKNOWN
0 -> FALSE
1 -> TRUE
else -> null
}
}
fun fromBooleanValue(boolValue: Boolean): CapabilityBooleanType {
return if (boolValue) {
TRUE
} else {
FALSE
}
}
}
}

View File

@ -1,62 +0,0 @@
/**
* 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 <http://www.gnu.org/licenses/>.
*/
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<OCCapability, RemoteCapability> {
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.
}
}