Loading library/src/androidTest/java/com/owncloud/android/lib/resources/files/ReadFileRemoteOperationIT.kt +28 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,34 @@ class ReadFileRemoteOperationIT : AbstractIT() { assertEquals(remotePath, (result.data[0] as RemoteFile).remotePath) } @Test fun testLivePhoto() { val movieFile = createFile("sample") val movieFilePath = "/sampleMovie" assertTrue( UploadFileRemoteOperation(movieFile, movieFilePath, "video/mov", RANDOM_MTIME) .execute(client).isSuccess ) val livePhoto = createFile("sample") val livePhotoPath = "/samplePic" assertTrue( UploadFileRemoteOperation(livePhoto, livePhotoPath, "image/jpeg", RANDOM_MTIME) .execute(client).isSuccess ) val movieFileResult = ReadFileRemoteOperation(movieFilePath).execute(client) assertTrue(movieFileResult.isSuccess) val movieRemoteFile = movieFileResult.data[0] as RemoteFile val livePhotoResult = ReadFileRemoteOperation(livePhotoPath).execute(client) assertTrue(livePhotoResult.isSuccess) val livePhotoRemoteFile = livePhotoResult.data[0] as RemoteFile assertTrue(movieRemoteFile.hidden) assertTrue(livePhotoRemoteFile.livePhoto == movieRemoteFile.livePhoto) } @Test fun readRemoteFile() { // create file Loading library/src/main/java/com/owncloud/android/lib/common/network/WebdavEntry.kt +21 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,10 @@ class WebdavEntry constructor(ms: MultiStatusResponse, splitElement: String) { var tags = arrayOfNulls<String>(0) var imageDimension: ImageDimension? = null var geoLocation: GeoLocation? = null var hidden = false private set var livePhoto: String? = null private set private val gson = Gson() Loading Loading @@ -461,6 +465,20 @@ class WebdavEntry constructor(ms: MultiStatusResponse, splitElement: String) { GeoLocation(latitude, longitude) } // NC metadata live photo property: <nc:metadata-files-live-photo/> prop = propSet[EXTENDED_PROPERTY_METADATA_LIVE_PHOTO, ncNamespace] if (prop != null && prop.value != null) { livePhoto = prop.value.toString() } // NC has hidden property <nc:hidden> prop = propSet[EXTENDED_PROPERTY_HIDDEN, ncNamespace] hidden = if (prop != null) { java.lang.Boolean.valueOf(prop.value.toString()) } else { false } parseLockProperties(ncNamespace, propSet) } else { Log_OC.e("WebdavEntry", "General error, no status for webdav response") Loading Loading @@ -619,6 +637,9 @@ class WebdavEntry constructor(ms: MultiStatusResponse, splitElement: String) { const val EXTENDED_PROPERTY_METADATA_SIZE = "file-metadata-size" const val EXTENDED_PROPERTY_METADATA_GPS = "file-metadata-gps" const val EXTENDED_PROPERTY_HIDDEN = "hidden" const val EXTENDED_PROPERTY_METADATA_LIVE_PHOTO = "metadata-files-live-photo" const val EXTENDED_PROPERTY_METADATA_PHOTOS_SIZE = "metadata-photos-size" const val EXTENDED_PROPERTY_METADATA_PHOTOS_GPS = "metadata-photos-gps" const val TRASHBIN_FILENAME = "trashbin-filename" Loading library/src/main/java/com/owncloud/android/lib/common/network/WebdavUtils.java +4 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,8 @@ public class WebdavUtils { propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_GPS, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_PHOTOS_SIZE, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_PHOTOS_GPS, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_LIVE_PHOTO, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_HIDDEN, ncNamespace); return propSet; } Loading Loading @@ -173,6 +175,8 @@ public class WebdavUtils { propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_GPS, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_PHOTOS_SIZE, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_PHOTOS_GPS, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_LIVE_PHOTO, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_HIDDEN, ncNamespace); return propSet; } Loading library/src/main/java/com/owncloud/android/lib/resources/files/model/RemoteFile.kt +11 −1 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ class RemoteFile : Parcelable, Serializable { var tags: Array<String?>? = null var imageDimension: ImageDimension? = null var geoLocation: GeoLocation? = null var hidden = false var livePhoto: String? = null constructor() { resetData() Loading @@ -85,7 +87,7 @@ class RemoteFile : Parcelable, Serializable { */ constructor(path: String?) { resetData() require(!(path == null || path.isEmpty() || !path.startsWith(FileUtils.PATH_SEPARATOR))) { require(!(path.isNullOrEmpty() || !path.startsWith(FileUtils.PATH_SEPARATOR))) { "Trying to create a OCFile with a non valid remote path: $path" } remotePath = path Loading Loading @@ -123,6 +125,8 @@ class RemoteFile : Parcelable, Serializable { tags = we.tags imageDimension = we.imageDimension geoLocation = we.geoLocation livePhoto = we.livePhoto hidden = we.hidden } /** Loading Loading @@ -153,6 +157,8 @@ class RemoteFile : Parcelable, Serializable { lockTimeout = 0 lockToken = null tags = null hidden = false livePhoto = null } /** Loading Loading @@ -191,6 +197,8 @@ class RemoteFile : Parcelable, Serializable { lockTimestamp = source.readLong() lockTimeout = source.readLong() lockToken = source.readString() livePhoto = source.readString() hidden = source.readInt() == 1 } override fun describeContents(): Int { Loading Loading @@ -227,6 +235,8 @@ class RemoteFile : Parcelable, Serializable { dest.writeLong(lockTimestamp) dest.writeLong(lockTimeout) dest.writeString(lockToken) dest.writeString(livePhoto) dest.writeInt(if (hidden) 1 else 0) } companion object { Loading Loading
library/src/androidTest/java/com/owncloud/android/lib/resources/files/ReadFileRemoteOperationIT.kt +28 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,34 @@ class ReadFileRemoteOperationIT : AbstractIT() { assertEquals(remotePath, (result.data[0] as RemoteFile).remotePath) } @Test fun testLivePhoto() { val movieFile = createFile("sample") val movieFilePath = "/sampleMovie" assertTrue( UploadFileRemoteOperation(movieFile, movieFilePath, "video/mov", RANDOM_MTIME) .execute(client).isSuccess ) val livePhoto = createFile("sample") val livePhotoPath = "/samplePic" assertTrue( UploadFileRemoteOperation(livePhoto, livePhotoPath, "image/jpeg", RANDOM_MTIME) .execute(client).isSuccess ) val movieFileResult = ReadFileRemoteOperation(movieFilePath).execute(client) assertTrue(movieFileResult.isSuccess) val movieRemoteFile = movieFileResult.data[0] as RemoteFile val livePhotoResult = ReadFileRemoteOperation(livePhotoPath).execute(client) assertTrue(livePhotoResult.isSuccess) val livePhotoRemoteFile = livePhotoResult.data[0] as RemoteFile assertTrue(movieRemoteFile.hidden) assertTrue(livePhotoRemoteFile.livePhoto == movieRemoteFile.livePhoto) } @Test fun readRemoteFile() { // create file Loading
library/src/main/java/com/owncloud/android/lib/common/network/WebdavEntry.kt +21 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,10 @@ class WebdavEntry constructor(ms: MultiStatusResponse, splitElement: String) { var tags = arrayOfNulls<String>(0) var imageDimension: ImageDimension? = null var geoLocation: GeoLocation? = null var hidden = false private set var livePhoto: String? = null private set private val gson = Gson() Loading Loading @@ -461,6 +465,20 @@ class WebdavEntry constructor(ms: MultiStatusResponse, splitElement: String) { GeoLocation(latitude, longitude) } // NC metadata live photo property: <nc:metadata-files-live-photo/> prop = propSet[EXTENDED_PROPERTY_METADATA_LIVE_PHOTO, ncNamespace] if (prop != null && prop.value != null) { livePhoto = prop.value.toString() } // NC has hidden property <nc:hidden> prop = propSet[EXTENDED_PROPERTY_HIDDEN, ncNamespace] hidden = if (prop != null) { java.lang.Boolean.valueOf(prop.value.toString()) } else { false } parseLockProperties(ncNamespace, propSet) } else { Log_OC.e("WebdavEntry", "General error, no status for webdav response") Loading Loading @@ -619,6 +637,9 @@ class WebdavEntry constructor(ms: MultiStatusResponse, splitElement: String) { const val EXTENDED_PROPERTY_METADATA_SIZE = "file-metadata-size" const val EXTENDED_PROPERTY_METADATA_GPS = "file-metadata-gps" const val EXTENDED_PROPERTY_HIDDEN = "hidden" const val EXTENDED_PROPERTY_METADATA_LIVE_PHOTO = "metadata-files-live-photo" const val EXTENDED_PROPERTY_METADATA_PHOTOS_SIZE = "metadata-photos-size" const val EXTENDED_PROPERTY_METADATA_PHOTOS_GPS = "metadata-photos-gps" const val TRASHBIN_FILENAME = "trashbin-filename" Loading
library/src/main/java/com/owncloud/android/lib/common/network/WebdavUtils.java +4 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,8 @@ public class WebdavUtils { propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_GPS, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_PHOTOS_SIZE, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_PHOTOS_GPS, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_LIVE_PHOTO, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_HIDDEN, ncNamespace); return propSet; } Loading Loading @@ -173,6 +175,8 @@ public class WebdavUtils { propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_GPS, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_PHOTOS_SIZE, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_PHOTOS_GPS, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_METADATA_LIVE_PHOTO, ncNamespace); propSet.add(WebdavEntry.EXTENDED_PROPERTY_HIDDEN, ncNamespace); return propSet; } Loading
library/src/main/java/com/owncloud/android/lib/resources/files/model/RemoteFile.kt +11 −1 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ class RemoteFile : Parcelable, Serializable { var tags: Array<String?>? = null var imageDimension: ImageDimension? = null var geoLocation: GeoLocation? = null var hidden = false var livePhoto: String? = null constructor() { resetData() Loading @@ -85,7 +87,7 @@ class RemoteFile : Parcelable, Serializable { */ constructor(path: String?) { resetData() require(!(path == null || path.isEmpty() || !path.startsWith(FileUtils.PATH_SEPARATOR))) { require(!(path.isNullOrEmpty() || !path.startsWith(FileUtils.PATH_SEPARATOR))) { "Trying to create a OCFile with a non valid remote path: $path" } remotePath = path Loading Loading @@ -123,6 +125,8 @@ class RemoteFile : Parcelable, Serializable { tags = we.tags imageDimension = we.imageDimension geoLocation = we.geoLocation livePhoto = we.livePhoto hidden = we.hidden } /** Loading Loading @@ -153,6 +157,8 @@ class RemoteFile : Parcelable, Serializable { lockTimeout = 0 lockToken = null tags = null hidden = false livePhoto = null } /** Loading Loading @@ -191,6 +197,8 @@ class RemoteFile : Parcelable, Serializable { lockTimestamp = source.readLong() lockTimeout = source.readLong() lockToken = source.readString() livePhoto = source.readString() hidden = source.readInt() == 1 } override fun describeContents(): Int { Loading Loading @@ -227,6 +235,8 @@ class RemoteFile : Parcelable, Serializable { dest.writeLong(lockTimestamp) dest.writeLong(lockTimeout) dest.writeString(lockToken) dest.writeString(livePhoto) dest.writeInt(if (hidden) 1 else 0) } companion object { Loading