From b27a0ba5a1ddd4eba20bfefc22ea24e9eeccf0dd Mon Sep 17 00:00:00 2001 From: jabarros Date: Mon, 23 Jun 2014 08:58:20 +0200 Subject: [PATCH 1/8] Update class RemoteFile to include property oc:permissions --- .../android/lib/resources/files/RemoteFile.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/com/owncloud/android/lib/resources/files/RemoteFile.java b/src/com/owncloud/android/lib/resources/files/RemoteFile.java index 0b96584c..d56452be 100644 --- a/src/com/owncloud/android/lib/resources/files/RemoteFile.java +++ b/src/com/owncloud/android/lib/resources/files/RemoteFile.java @@ -48,7 +48,8 @@ public class RemoteFile implements Parcelable, Serializable { private long mCreationTimestamp; private long mModifiedTimestamp; private String mEtag; - + private String mPermissions; + /** * Getters and Setters */ @@ -101,6 +102,14 @@ public class RemoteFile implements Parcelable, Serializable { this.mEtag = etag; } + public String getPermissions() { + return mPermissions; + } + + public void setPermissions(String permissions) { + this.mPermissions = permissions; + } + public RemoteFile() { resetData(); } @@ -127,6 +136,7 @@ public class RemoteFile implements Parcelable, Serializable { this.setMimeType(we.contentType()); this.setModifiedTimestamp(we.modifiedTimestamp()); this.setEtag(we.etag()); + this.setPermissions(we.permissions()); } /** @@ -139,6 +149,7 @@ public class RemoteFile implements Parcelable, Serializable { mCreationTimestamp = 0; mModifiedTimestamp = 0; mEtag = null; + mPermissions = null; } /** @@ -173,6 +184,7 @@ public class RemoteFile implements Parcelable, Serializable { mCreationTimestamp = source.readLong(); mModifiedTimestamp = source.readLong(); mEtag = source.readString(); + mPermissions= source.readString(); } @Override @@ -187,7 +199,8 @@ public class RemoteFile implements Parcelable, Serializable { dest.writeLong(mLength); dest.writeLong(mCreationTimestamp); dest.writeLong(mModifiedTimestamp); - dest.writeString(mEtag); + dest.writeString(mEtag); + dest.writeString(mPermissions); } From 5c06770280d5c28c4090ee6aca053e462c1c5725 Mon Sep 17 00:00:00 2001 From: jabarros Date: Mon, 23 Jun 2014 11:27:25 +0200 Subject: [PATCH 2/8] Populate RemoteFile with permission value --- .../android/lib/resources/files/ReadRemoteFolderOperation.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java b/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java index 4a1c33a6..9d223701 100644 --- a/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java +++ b/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java @@ -163,6 +163,7 @@ public class ReadRemoteFolderOperation extends RemoteOperation { file.setMimeType(we.contentType()); file.setModifiedTimestamp(we.modifiedTimestamp()); file.setEtag(we.etag()); + file.setPermissions(we.permissions()); return file; } } From 6befcdafe50b96bd2bba780257cd6837fe6e6fe1 Mon Sep 17 00:00:00 2001 From: jabarros Date: Mon, 23 Jun 2014 14:32:33 +0200 Subject: [PATCH 3/8] Update RemoteFile and ReadRemoteFolder classes for including the remote_id property --- .../resources/files/ReadRemoteFolderOperation.java | 1 + .../android/lib/resources/files/RemoteFile.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java b/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java index 9d223701..922b7c9f 100644 --- a/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java +++ b/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java @@ -164,6 +164,7 @@ public class ReadRemoteFolderOperation extends RemoteOperation { file.setModifiedTimestamp(we.modifiedTimestamp()); file.setEtag(we.etag()); file.setPermissions(we.permissions()); + file.setRemoteId(we.remoteId()); return file; } } diff --git a/src/com/owncloud/android/lib/resources/files/RemoteFile.java b/src/com/owncloud/android/lib/resources/files/RemoteFile.java index d56452be..0db4e591 100644 --- a/src/com/owncloud/android/lib/resources/files/RemoteFile.java +++ b/src/com/owncloud/android/lib/resources/files/RemoteFile.java @@ -49,6 +49,7 @@ public class RemoteFile implements Parcelable, Serializable { private long mModifiedTimestamp; private String mEtag; private String mPermissions; + private String mRemoteId; /** * Getters and Setters @@ -110,6 +111,14 @@ public class RemoteFile implements Parcelable, Serializable { this.mPermissions = permissions; } + public String getRemoteId() { + return mRemoteId; + } + + public void setRemoteId(String remoteId) { + this.mRemoteId = remoteId; + } + public RemoteFile() { resetData(); } @@ -137,6 +146,7 @@ public class RemoteFile implements Parcelable, Serializable { this.setModifiedTimestamp(we.modifiedTimestamp()); this.setEtag(we.etag()); this.setPermissions(we.permissions()); + this.setRemoteId(we.remoteId()); } /** @@ -150,6 +160,7 @@ public class RemoteFile implements Parcelable, Serializable { mModifiedTimestamp = 0; mEtag = null; mPermissions = null; + mRemoteId = null; } /** @@ -185,6 +196,7 @@ public class RemoteFile implements Parcelable, Serializable { mModifiedTimestamp = source.readLong(); mEtag = source.readString(); mPermissions= source.readString(); + mRemoteId = source.readString(); } @Override @@ -201,6 +213,7 @@ public class RemoteFile implements Parcelable, Serializable { dest.writeLong(mModifiedTimestamp); dest.writeString(mEtag); dest.writeString(mPermissions); + dest.writeString(mRemoteId); } From 570c35c9214845dc744703669c0829d12fab431d Mon Sep 17 00:00:00 2001 From: jabarros Date: Tue, 24 Jun 2014 12:41:40 +0200 Subject: [PATCH 4/8] Update parsing of PROPFIND responses to save, if exists, the value of the properties oc:permissions and oc:id --- .../lib/common/network/WebdavEntry.java | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/com/owncloud/android/lib/common/network/WebdavEntry.java b/src/com/owncloud/android/lib/common/network/WebdavEntry.java index b7ac35b5..c71e9130 100644 --- a/src/com/owncloud/android/lib/common/network/WebdavEntry.java +++ b/src/com/owncloud/android/lib/common/network/WebdavEntry.java @@ -30,18 +30,20 @@ import org.apache.jackrabbit.webdav.MultiStatusResponse; import org.apache.jackrabbit.webdav.property.DavProperty; import org.apache.jackrabbit.webdav.property.DavPropertyName; import org.apache.jackrabbit.webdav.property.DavPropertySet; - - - +import org.apache.jackrabbit.webdav.xml.Namespace; import android.net.Uri; import android.util.Log; public class WebdavEntry { - private String mName, mPath, mUri, mContentType, mEtag; - private long mContentLength, mCreateTimestamp, mModifiedTimestamp; + private static final String NAMESPACE_OC = "http://owncloud.org/ns"; + private static final String DAVPROPERTY_NAME_PERMISSIONS = "permissions"; + private static final String DAVPROPERTY_NAME_REMOTE_ID = "id"; - public WebdavEntry(MultiStatusResponse ms, String splitElement) { + private String mName, mPath, mUri, mContentType, mEtag, mPermissions, mRemoteId; + private long mContentLength, mCreateTimestamp, mModifiedTimestamp; + + public WebdavEntry(MultiStatusResponse ms, String splitElement) { resetData(); if (ms.getStatus().length != 0) { mUri = ms.getHref(); @@ -106,6 +108,18 @@ public class WebdavEntry { mEtag = mEtag.substring(1, mEtag.length()-1); } + // OC permissions property + prop = propSet.get(DAVPROPERTY_NAME_PERMISSIONS, Namespace.getNamespace(NAMESPACE_OC)); + if (prop != null) { + mPermissions = prop.getValue().toString(); + } + + // OC remote id property + prop = propSet.get(DAVPROPERTY_NAME_REMOTE_ID, Namespace.getNamespace(NAMESPACE_OC)); + if (prop != null) { + mRemoteId = prop.getValue().toString(); + } + } else { Log.e("WebdavEntry", "General fuckup, no status for webdav response"); @@ -152,8 +166,16 @@ public class WebdavEntry { return mEtag; } + public String permissions() { + return mPermissions; + } + + public String remoteId() { + return mRemoteId; + } + private void resetData() { - mName = mUri = mContentType = null; + mName = mUri = mContentType = mPermissions = null; mRemoteId = null; mContentLength = mCreateTimestamp = mModifiedTimestamp = 0; } } From b877e8f9ba99808e6addfae1e04146c5a2f8bf68 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Fri, 27 Jun 2014 15:18:58 +0200 Subject: [PATCH 5/8] Updated platorm tools, installer and accepted licenses for Travis environment --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9f906ec0..c2ea3396 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,10 @@ language: java jdk: oraclejdk7 before_install: - sudo apt-get update -qq -- sudo apt-get install -qq libstdc++6:i386 lib32z1 -- curl -3L https://raw.github.com/embarkmobile/android-sdk-installer/version-1/android-sdk-installer - | bash /dev/stdin --install=$COMPONENTS +- sudo apt-get install -qq libstdc++6:i386 lib32z1 expect +- export LICENSES="android-sdk-license-5be876d5|android-sdk-license-598b93a6" +- curl -3L https://raw.github.com/embarkmobile/android-sdk-installer/version-2/android-sdk-installer + | bash /dev/stdin --install=$COMPONENTS --accept=$LICENSES - source ~/.android-sdk-installer/env - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 20M - emulator -avd test -no-skin -no-audio -no-window & @@ -24,4 +25,4 @@ env: - secure: aF4U20Xlu/rfrbxCmoJAiGh1doYTAZ10UEDmajuinT+ZGSJLivuqD7DDY/00sI6IXWg+J1vL+7jJm4JSYusHPg38UHZ4q92k6RmZycW2ATUzZnGT54O5FRnY67MfVwgVpIMK9UOL/6NEciBHEjlIOL0wbKQiJB++1YtBZOQLGL4= - secure: N+ECSwNg8v2GsAFJ2y/tCiffauHDpN76zuFI2pDqf0fjmCtJZHu4BH5ArXBHjyHKmgn20a/8eZXcwJaH1HsJ80bo7vDJ2miShjGIQ90hPcdmUiB2XVJcew4f04CtvMDH5o7DRt4ykWArlbPL2rhVag0jotlSidolHBwRFnbDhDY= matrix: - - COMPONENTS=build-tools-19.0.3,android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a + - COMPONENTS=build-tools-20.0.0,android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a From 31d4df1b0a23a59d66384a2e81970277fa743e59 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Fri, 27 Jun 2014 15:33:09 +0200 Subject: [PATCH 6/8] Updated name of system image component to download --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c2ea3396..2920d050 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,4 +25,4 @@ env: - secure: aF4U20Xlu/rfrbxCmoJAiGh1doYTAZ10UEDmajuinT+ZGSJLivuqD7DDY/00sI6IXWg+J1vL+7jJm4JSYusHPg38UHZ4q92k6RmZycW2ATUzZnGT54O5FRnY67MfVwgVpIMK9UOL/6NEciBHEjlIOL0wbKQiJB++1YtBZOQLGL4= - secure: N+ECSwNg8v2GsAFJ2y/tCiffauHDpN76zuFI2pDqf0fjmCtJZHu4BH5ArXBHjyHKmgn20a/8eZXcwJaH1HsJ80bo7vDJ2miShjGIQ90hPcdmUiB2XVJcew4f04CtvMDH5o7DRt4ykWArlbPL2rhVag0jotlSidolHBwRFnbDhDY= matrix: - - COMPONENTS=build-tools-20.0.0,android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a + - COMPONENTS=build-tools-20.0.0,android-19,sys-img-armeabi-v7a-android-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a From b478a48ff38f88a6139e2c4daeb519e3a07408c9 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Tue, 1 Jul 2014 09:15:48 +0200 Subject: [PATCH 7/8] Updated name of constants for extended WebDAV properties --- .../android/lib/common/network/WebdavEntry.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/com/owncloud/android/lib/common/network/WebdavEntry.java b/src/com/owncloud/android/lib/common/network/WebdavEntry.java index c71e9130..d6fe7a54 100644 --- a/src/com/owncloud/android/lib/common/network/WebdavEntry.java +++ b/src/com/owncloud/android/lib/common/network/WebdavEntry.java @@ -37,8 +37,8 @@ import android.util.Log; public class WebdavEntry { private static final String NAMESPACE_OC = "http://owncloud.org/ns"; - private static final String DAVPROPERTY_NAME_PERMISSIONS = "permissions"; - private static final String DAVPROPERTY_NAME_REMOTE_ID = "id"; + private static final String EXTENDED_PROPERTY_NAME_PERMISSIONS = "permissions"; + private static final String EXTENDED_PROPERTY_NAME_REMOTE_ID = "id"; private String mName, mPath, mUri, mContentType, mEtag, mPermissions, mRemoteId; private long mContentLength, mCreateTimestamp, mModifiedTimestamp; @@ -109,13 +109,17 @@ public class WebdavEntry { } // OC permissions property - prop = propSet.get(DAVPROPERTY_NAME_PERMISSIONS, Namespace.getNamespace(NAMESPACE_OC)); + prop = propSet.get( + EXTENDED_PROPERTY_NAME_PERMISSIONS, Namespace.getNamespace(NAMESPACE_OC) + ); if (prop != null) { mPermissions = prop.getValue().toString(); } // OC remote id property - prop = propSet.get(DAVPROPERTY_NAME_REMOTE_ID, Namespace.getNamespace(NAMESPACE_OC)); + prop = propSet.get( + EXTENDED_PROPERTY_NAME_REMOTE_ID, Namespace.getNamespace(NAMESPACE_OC) + ); if (prop != null) { mRemoteId = prop.getValue().toString(); } From f323dda0445b455af638c7e8e4653c22959adb91 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Tue, 1 Jul 2014 10:57:31 +0200 Subject: [PATCH 8/8] Fixed parsing of dateformats in WebDAV responses --- src/com/owncloud/android/lib/common/network/WebdavUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/owncloud/android/lib/common/network/WebdavUtils.java b/src/com/owncloud/android/lib/common/network/WebdavUtils.java index 16e70bdf..b5b3607c 100644 --- a/src/com/owncloud/android/lib/common/network/WebdavUtils.java +++ b/src/com/owncloud/android/lib/common/network/WebdavUtils.java @@ -58,7 +58,7 @@ public class WebdavUtils { Date returnDate = null; for (int i = 0; i < DATETIME_FORMATS.length; ++i) { try { - returnDate = new SimpleDateFormat (DATETIME_FORMATS[i]).parse(date); + returnDate = new SimpleDateFormat (DATETIME_FORMATS[i], Locale.US).parse(date); return returnDate; } catch (ParseException e) { }