diff --git a/src/com/owncloud/android/lib/common/network/WebdavUtils.java b/src/com/owncloud/android/lib/common/network/WebdavUtils.java index 33ebf5c0..d64042bf 100644 --- a/src/com/owncloud/android/lib/common/network/WebdavUtils.java +++ b/src/com/owncloud/android/lib/common/network/WebdavUtils.java @@ -42,7 +42,8 @@ public class WebdavUtils { new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US), new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US), new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US), - new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US) }; + new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US) , + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss") }; public static String prepareXmlForPropFind() { String ret = ""; diff --git a/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java b/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java index 48f8a023..4457bcde 100644 --- a/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java +++ b/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java @@ -116,6 +116,10 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation { result = new RemoteOperationResult(ResultCode.OK); ArrayList sharesObjects = new ArrayList(); for (OCShare share: mShares) { + // Build the link + if (share.getToken().length() > 0) { + share.setShareLink(client.getBaseUri() + ShareUtils.SHARING_LINK_TOKEN + share.getToken()); + } sharesObjects.add(share); } result.setData(sharesObjects); diff --git a/src/com/owncloud/android/lib/resources/shares/ShareUtils.java b/src/com/owncloud/android/lib/resources/shares/ShareUtils.java index 9e2e6b99..c30d73b3 100644 --- a/src/com/owncloud/android/lib/resources/shares/ShareUtils.java +++ b/src/com/owncloud/android/lib/resources/shares/ShareUtils.java @@ -36,4 +36,7 @@ public class ShareUtils { // OCS Route public static final String SHARING_API_PATH ="/ocs/v1.php/apps/files_sharing/api/v1/shares"; + // String to build the link with the token of a share: server address + "/public.php?service=files&t=" + token + public static final String SHARING_LINK_TOKEN = "/public.php?service=files&t="; + } diff --git a/src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java b/src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java index 335424e7..c48cf9ba 100644 --- a/src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java +++ b/src/com/owncloud/android/lib/resources/shares/ShareXMLParser.java @@ -35,6 +35,7 @@ import org.xmlpull.v1.XmlPullParserFactory; import android.util.Log; import android.util.Xml; +import com.owncloud.android.lib.common.network.WebdavUtils; import com.owncloud.android.lib.resources.files.FileUtils; /** @@ -311,8 +312,8 @@ public class ShareXMLParser { } else if (name.equalsIgnoreCase(NODE_EXPIRATION)) { String value = readNode(parser, NODE_EXPIRATION); - if (!value.isEmpty()) { - share.setExpirationDate(Long.parseLong(readNode(parser, NODE_EXPIRATION))); // check if expiration is in long format or date format + if (!(value.length() == 0)) { + share.setExpirationDate(WebdavUtils.parseResponseDate(value).getTime()); } } else if (name.equalsIgnoreCase(NODE_TOKEN)) { @@ -402,4 +403,5 @@ public class ShareXMLParser { } } } + }