mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Convert long shareId to String
This commit is contained in:
parent
af579a3fd0
commit
3441f4048c
@ -46,9 +46,9 @@ import java.net.URL;
|
|||||||
|
|
||||||
public class GetRemoteShareOperation extends RemoteOperation<ShareParserResult> {
|
public class GetRemoteShareOperation extends RemoteOperation<ShareParserResult> {
|
||||||
|
|
||||||
private long mRemoteId;
|
private String mRemoteId;
|
||||||
|
|
||||||
public GetRemoteShareOperation(long remoteId) {
|
public GetRemoteShareOperation(String remoteId) {
|
||||||
mRemoteId = remoteId;
|
mRemoteId = remoteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public class GetRemoteShareOperation extends RemoteOperation<ShareParserResult>
|
|||||||
Uri requestUri = client.getBaseUri();
|
Uri requestUri = client.getBaseUri();
|
||||||
Uri.Builder uriBuilder = requestUri.buildUpon();
|
Uri.Builder uriBuilder = requestUri.buildUpon();
|
||||||
uriBuilder.appendEncodedPath(ShareUtils.SHARING_API_PATH);
|
uriBuilder.appendEncodedPath(ShareUtils.SHARING_API_PATH);
|
||||||
uriBuilder.appendEncodedPath(Long.toString(mRemoteId));
|
uriBuilder.appendEncodedPath(mRemoteId);
|
||||||
|
|
||||||
GetMethod getMethod = new GetMethod(new URL(uriBuilder.build().toString()));
|
GetMethod getMethod = new GetMethod(new URL(uriBuilder.build().toString()));
|
||||||
getMethod.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
|
getMethod.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
|
||||||
|
@ -34,7 +34,7 @@ import java.io.File
|
|||||||
* @author David González Verdugo
|
* @author David González Verdugo
|
||||||
*/
|
*/
|
||||||
data class RemoteShare(
|
data class RemoteShare(
|
||||||
var id: Long = 0,
|
var id: String = "0",
|
||||||
var shareWith: String = "",
|
var shareWith: String = "",
|
||||||
var path: String = "",
|
var path: String = "",
|
||||||
var token: String = "",
|
var token: String = "",
|
||||||
@ -49,8 +49,7 @@ data class RemoteShare(
|
|||||||
var sharedDate: Long = INIT_SHARED_DATE,
|
var sharedDate: Long = INIT_SHARED_DATE,
|
||||||
var expirationDate: Long = INIT_EXPIRATION_DATE_IN_MILLIS,
|
var expirationDate: Long = INIT_EXPIRATION_DATE_IN_MILLIS,
|
||||||
var isFolder: Boolean = path.endsWith(File.separator),
|
var isFolder: Boolean = path.endsWith(File.separator),
|
||||||
var userId: Long = 0,
|
var userId: Long = 0
|
||||||
val isValid: Boolean = id > -1
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -48,7 +48,7 @@ import java.net.URL
|
|||||||
*
|
*
|
||||||
* @param remoteShareId Share ID
|
* @param remoteShareId Share ID
|
||||||
*/
|
*/
|
||||||
class RemoveRemoteShareOperation(private val remoteShareId: Long) : RemoteOperation<ShareParserResult>() {
|
class RemoveRemoteShareOperation(private val remoteShareId: String) : RemoteOperation<ShareParserResult>() {
|
||||||
|
|
||||||
override fun run(client: OwnCloudClient): RemoteOperationResult<ShareParserResult> {
|
override fun run(client: OwnCloudClient): RemoteOperationResult<ShareParserResult> {
|
||||||
var result: RemoteOperationResult<ShareParserResult>
|
var result: RemoteOperationResult<ShareParserResult>
|
||||||
@ -57,7 +57,7 @@ class RemoveRemoteShareOperation(private val remoteShareId: Long) : RemoteOperat
|
|||||||
val requestUri = client.baseUri
|
val requestUri = client.baseUri
|
||||||
val uriBuilder = requestUri.buildUpon()
|
val uriBuilder = requestUri.buildUpon()
|
||||||
uriBuilder.appendEncodedPath(ShareUtils.SHARING_API_PATH)
|
uriBuilder.appendEncodedPath(ShareUtils.SHARING_API_PATH)
|
||||||
uriBuilder.appendEncodedPath(remoteShareId.toString())
|
uriBuilder.appendEncodedPath(remoteShareId)
|
||||||
|
|
||||||
val deleteMethod = DeleteMethod(
|
val deleteMethod = DeleteMethod(
|
||||||
URL(uriBuilder.build().toString())
|
URL(uriBuilder.build().toString())
|
||||||
|
@ -179,7 +179,7 @@ class ShareXMLParser {
|
|||||||
name.equals(NODE_ID, ignoreCase = true) -> {// Parse Create XML Response
|
name.equals(NODE_ID, ignoreCase = true) -> {// Parse Create XML Response
|
||||||
share = RemoteShare()
|
share = RemoteShare()
|
||||||
val value = readNode(parser, NODE_ID)
|
val value = readNode(parser, NODE_ID)
|
||||||
share.id = Integer.parseInt(value).toLong()
|
share.id = value
|
||||||
}
|
}
|
||||||
name.equals(NODE_URL, ignoreCase = true) -> {
|
name.equals(NODE_URL, ignoreCase = true) -> {
|
||||||
// NOTE: this field is received in all the public shares from OC 9.0.0
|
// NOTE: this field is received in all the public shares from OC 9.0.0
|
||||||
@ -236,7 +236,7 @@ class ShareXMLParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
name.equals(NODE_ID, ignoreCase = true) -> {
|
name.equals(NODE_ID, ignoreCase = true) -> {
|
||||||
remoteShare.id = Integer.parseInt(readNode(parser, NODE_ID)).toLong()
|
remoteShare.id = readNode(parser, NODE_ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
name.equals(NODE_ITEM_TYPE, ignoreCase = true) -> {
|
name.equals(NODE_ITEM_TYPE, ignoreCase = true) -> {
|
||||||
@ -320,10 +320,8 @@ class ShareXMLParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remoteShare.isValid) {
|
|
||||||
shares.add(remoteShare)
|
shares.add(remoteShare)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun fixPathForFolder(share: RemoteShare) {
|
private fun fixPathForFolder(share: RemoteShare) {
|
||||||
if (share.isFolder && share.path.isNotEmpty() &&
|
if (share.isFolder && share.path.isNotEmpty() &&
|
||||||
|
@ -55,7 +55,7 @@ class UpdateRemoteShareOperation
|
|||||||
/**
|
/**
|
||||||
* @param remoteId Identifier of the share to update.
|
* @param remoteId Identifier of the share to update.
|
||||||
*/
|
*/
|
||||||
private val remoteId: Long
|
private val remoteId: String
|
||||||
|
|
||||||
) : RemoteOperation<ShareParserResult>() {
|
) : RemoteOperation<ShareParserResult>() {
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ interface ShareService : Service {
|
|||||||
): RemoteOperationResult<ShareParserResult>
|
): RemoteOperationResult<ShareParserResult>
|
||||||
|
|
||||||
fun updateShare(
|
fun updateShare(
|
||||||
remoteId: Long,
|
remoteId: String,
|
||||||
name: String,
|
name: String,
|
||||||
password: String?,
|
password: String?,
|
||||||
expirationDate: Long,
|
expirationDate: Long,
|
||||||
@ -52,5 +52,5 @@ interface ShareService : Service {
|
|||||||
publicUpload: Boolean
|
publicUpload: Boolean
|
||||||
): RemoteOperationResult<ShareParserResult>
|
): RemoteOperationResult<ShareParserResult>
|
||||||
|
|
||||||
fun deleteShare(remoteId: Long): RemoteOperationResult<ShareParserResult>
|
fun deleteShare(remoteId: String): RemoteOperationResult<ShareParserResult>
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ class OCShareService(override val client: OwnCloudClient) :
|
|||||||
}.execute(client)
|
}.execute(client)
|
||||||
|
|
||||||
override fun updateShare(
|
override fun updateShare(
|
||||||
remoteId: Long,
|
remoteId: String,
|
||||||
name: String,
|
name: String,
|
||||||
password: String?,
|
password: String?,
|
||||||
expirationDate: Long,
|
expirationDate: Long,
|
||||||
@ -84,7 +84,7 @@ class OCShareService(override val client: OwnCloudClient) :
|
|||||||
this.retrieveShareDetails = true
|
this.retrieveShareDetails = true
|
||||||
}.execute(client)
|
}.execute(client)
|
||||||
|
|
||||||
override fun deleteShare(remoteId: Long): RemoteOperationResult<ShareParserResult> =
|
override fun deleteShare(remoteId: String): RemoteOperationResult<ShareParserResult> =
|
||||||
RemoveRemoteShareOperation(
|
RemoveRemoteShareOperation(
|
||||||
remoteId
|
remoteId
|
||||||
).execute(client)
|
).execute(client)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user