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

Apply requested changes

This commit is contained in:
davigonz 2019-05-09 12:53:55 +02:00
parent daf49d289b
commit 1087f0fd46
3 changed files with 4 additions and 12 deletions

View File

@ -55,8 +55,7 @@ class RemoteShare : Parcelable, Serializable {
var isFolder: Boolean = false var isFolder: Boolean = false
var userId: Long = 0 var userId: Long = 0
val isPasswordProtected: Boolean val isValid: Boolean = id > -1
get() = ShareType.PUBLIC_LINK == shareType && shareWith.isNotEmpty()
constructor() : super() { constructor() : super() {
resetData() resetData()

View File

@ -117,7 +117,6 @@ class ShareXMLParser {
} else { } else {
skip(parser) skip(parser)
} }
} }
return shares return shares
} }
@ -150,7 +149,6 @@ class ShareXMLParser {
} else { } else {
skip(parser) skip(parser)
} }
} }
} }
@ -194,7 +192,6 @@ class ShareXMLParser {
} else { } else {
skip(parser) skip(parser)
} }
} }
@ -269,7 +266,7 @@ class ShareXMLParser {
} else if (name.equals(NODE_EXPIRATION, ignoreCase = true)) { } else if (name.equals(NODE_EXPIRATION, ignoreCase = true)) {
val value = readNode(parser, NODE_EXPIRATION) val value = readNode(parser, NODE_EXPIRATION)
if (value.length != 0) { if (value.isNotEmpty()) {
remoteShare.expirationDate = WebdavUtils.parseResponseDate(value)!!.time remoteShare.expirationDate = WebdavUtils.parseResponseDate(value)!!.time
} }
@ -296,15 +293,11 @@ class ShareXMLParser {
} }
} }
if (isValidShare(remoteShare)) { if (remoteShare.isValid) {
shares.add(remoteShare) shares.add(remoteShare)
} }
} }
private fun isValidShare(share: RemoteShare): Boolean {
return share.id > -1
}
private fun fixPathForFolder(share: RemoteShare) { private fun fixPathForFolder(share: RemoteShare) {
if (share.isFolder && share.path.isNotEmpty() && if (share.isFolder && share.path.isNotEmpty() &&
!share.path.endsWith(FileUtils.PATH_SEPARATOR) !share.path.endsWith(FileUtils.PATH_SEPARATOR)

View File

@ -172,7 +172,7 @@ class UpdateRemoteShareOperation
if (result.isSuccess && retrieveShareDetails) { if (result.isSuccess && retrieveShareDetails) {
// retrieve more info - PUT only returns the index of the new share // retrieve more info - PUT only returns the index of the new share
val emptyShare = result.data.shares[0] val emptyShare = result.data.shares.first()
val getInfo = GetRemoteShareOperation( val getInfo = GetRemoteShareOperation(
emptyShare.id emptyShare.id
) )