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