Skip to content

Commit

Permalink
remove unnecessary call for share info
Browse files Browse the repository at this point in the history
Signed-off-by: parneet-guraya <[email protected]>
  • Loading branch information
parneet-guraya committed Jul 10, 2024
1 parent bba83de commit 43bd17b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ class CreateRemoteShareOperation(

var expirationDateInMillis: Long = INIT_EXPIRATION_DATE_IN_MILLIS // Expiration date to set for the public link

var retrieveShareDetails = false // To retrieve more info about the just created share

private fun buildRequestUri(baseUri: Uri) =
baseUri.buildUpon()
.appendEncodedPath(OCS_ROUTE)
Expand Down Expand Up @@ -125,14 +123,7 @@ class CreateRemoteShareOperation(
result.data = parseResponse(response!!)
Timber.d("*** Creating new remote share operation completed ")

val emptyShare = result.data.shares.first()

return if (retrieveShareDetails) {
// retrieve more info - PUT only returns the index of the new share
GetRemoteShareOperation(emptyShare.id).execute(client)
} else {
result
}
return result
}

private fun createFormBody(): FormBody {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ class UpdateRemoteShareOperation
*/
var permissions: Int = DEFAULT_PERMISSION

var retrieveShareDetails = false // To retrieve more info about the just updated share

private fun buildRequestUri(baseUri: Uri) =
baseUri.buildUpon()
.appendEncodedPath(OCS_ROUTE)
Expand Down Expand Up @@ -139,14 +137,8 @@ class UpdateRemoteShareOperation
Timber.d("Successful response: $response")
result.data = parseResponse(response!!)
Timber.d("*** Retrieve the index of the new share completed ")
val emptyShare = result.data.shares.first()

return if (retrieveShareDetails) {
// retrieve more info - PUT only returns the index of the new share
GetRemoteShareOperation(emptyShare.id).execute(client)
} else {
result
}
return result
}

private fun createFormBodyBuilder(): FormBody.Builder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
this.name = name
this.password = password
this.expirationDateInMillis = expirationDate
this.retrieveShareDetails = true
}.execute(client)

override fun updateShare(
Expand All @@ -82,7 +81,6 @@ class OCShareService(override val client: OwnCloudClient) : ShareService {
this.password = password
this.expirationDateInMillis = expirationDate
this.permissions = permissions
this.retrieveShareDetails = true
}.execute(client)

override fun deleteShare(remoteId: String): RemoteOperationResult<Unit> =
Expand Down

0 comments on commit 43bd17b

Please sign in to comment.