diff --git a/library/src/main/java/com/owncloud/android/lib/resources/shares/CreateShareRemoteOperation.java b/library/src/main/java/com/owncloud/android/lib/resources/shares/CreateShareRemoteOperation.java index 622d21e43..69c03a7d7 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/shares/CreateShareRemoteOperation.java +++ b/library/src/main/java/com/owncloud/android/lib/resources/shares/CreateShareRemoteOperation.java @@ -38,6 +38,7 @@ public class CreateShareRemoteOperation extends RemoteOperation> { private static final String PARAM_PERMISSIONS = "permissions"; private static final String PARAM_NOTE = "note"; private static final String PARAM_ATTRIBUTES = "attributes"; + private static final String PARAM_SEND_PASSWORD_BY_TALK = "sendPasswordByTalk"; private final String remoteFilePath; private final ShareType shareType; @@ -48,6 +49,7 @@ public class CreateShareRemoteOperation extends RemoteOperation> { private boolean getShareDetails; private String note; private String attributes; + private Boolean sendPasswordByTalk; /** * Constructor @@ -134,6 +136,10 @@ public void setGetShareDetails(boolean set) { getShareDetails = set; } + public void setSendPasswordByTalk(Boolean sendPasswordByTalk) { + this.sendPasswordByTalk = sendPasswordByTalk; + } + @Override protected RemoteOperationResult> run(OwnCloudClient client) { RemoteOperationResult> result; @@ -168,6 +174,10 @@ protected RemoteOperationResult> run(OwnCloudClient client) { post.addParameter(PARAM_ATTRIBUTES, attributes); } + if (sendPasswordByTalk != null) { + post.addParameter(PARAM_SEND_PASSWORD_BY_TALK, Boolean.toString(sendPasswordByTalk)); + } + post.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE); status = client.executeMethod(post); diff --git a/library/src/main/java/com/owncloud/android/lib/resources/shares/OCShare.kt b/library/src/main/java/com/owncloud/android/lib/resources/shares/OCShare.kt index 1a4a0e4ec..1023a25b1 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/shares/OCShare.kt +++ b/library/src/main/java/com/owncloud/android/lib/resources/shares/OCShare.kt @@ -67,6 +67,7 @@ class OCShare : } var note: String? = null var isHideFileDownload = false + var isSendPasswordByTalk = false var label: String? = null var isHasPreview = false var mimetype: String? = null @@ -110,6 +111,7 @@ class OCShare : isPasswordProtected = false note = "" isHideFileDownload = false + isSendPasswordByTalk = false label = "" isHasPreview = false mimetype = "" @@ -152,6 +154,7 @@ class OCShare : isPasswordProtected = source.readInt() == 1 note = source.readString() isHideFileDownload = source.readInt() == 1 + isSendPasswordByTalk = source.readInt() == 1 label = source.readString() isHasPreview = source.readInt() == 1 mimetype = source.readString() @@ -184,6 +187,7 @@ class OCShare : dest.writeInt(if (isPasswordProtected) 1 else 0) dest.writeString(note) dest.writeInt(if (isHideFileDownload) 1 else 0) + dest.writeInt(if (isSendPasswordByTalk) 1 else 0) dest.writeString(label) dest.writeInt(if (isHasPreview) 1 else 0) dest.writeString(mimetype) diff --git a/library/src/main/java/com/owncloud/android/lib/resources/shares/ShareXMLParser.java b/library/src/main/java/com/owncloud/android/lib/resources/shares/ShareXMLParser.java index 70c8de62f..5d16adbab 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/shares/ShareXMLParser.java +++ b/library/src/main/java/com/owncloud/android/lib/resources/shares/ShareXMLParser.java @@ -64,6 +64,7 @@ public class ShareXMLParser { private static final String NODE_SHARE_WITH_DISPLAY_NAME = "share_with_displayname"; private static final String NODE_NOTE = "note"; private static final String NODE_HIDE_DOWNLOAD = "hide_download"; + private static final String NODE_SEND_PASSWORD_BY_TALK = "send_password_by_talk"; private static final String NODE_UID_OWNER = "uid_owner"; private static final String NODE_LABEL = "label"; private static final String NODE_HAS_PREVIEW = "has_preview"; @@ -389,6 +390,11 @@ private void readElement(XmlPullParser parser, ArrayList shares) share.setHideFileDownload(b); break; + case NODE_SEND_PASSWORD_BY_TALK: + share.setSendPasswordByTalk( + TRUE.equalsIgnoreCase(readNode(parser, NODE_SEND_PASSWORD_BY_TALK))); + break; + case NODE_UID_OWNER: share.setUserId(readNode(parser, NODE_UID_OWNER)); break; diff --git a/library/src/main/java/com/owncloud/android/lib/resources/shares/UpdateShareRemoteOperation.java b/library/src/main/java/com/owncloud/android/lib/resources/shares/UpdateShareRemoteOperation.java index a466e9f36..a7220ed5c 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/shares/UpdateShareRemoteOperation.java +++ b/library/src/main/java/com/owncloud/android/lib/resources/shares/UpdateShareRemoteOperation.java @@ -44,6 +44,7 @@ public class UpdateShareRemoteOperation extends RemoteOperation { private static final String PARAM_PERMISSIONS = "permissions"; private static final String PARAM_NOTE = "note"; private static final String PARAM_HIDE_DOWNLOAD = "hideDownload"; + private static final String PARAM_SEND_PASSWORD_BY_TALK = "sendPasswordByTalk"; private static final String PARAM_LABEL = "label"; private static final String FORMAT_EXPIRATION_DATE = "yyyy-MM-dd"; private static final String ENTITY_CONTENT_TYPE = "application/json"; @@ -75,6 +76,11 @@ public class UpdateShareRemoteOperation extends RemoteOperation { */ private Boolean hideFileDownload; + /** + * Enable or disable video verification via Nextcloud Talk before granting access to the share + */ + private Boolean sendPasswordByTalk; + private String note; private String label; private String attributes; @@ -133,6 +139,10 @@ public void setHideFileDownload(Boolean hideFileDownload) { this.hideFileDownload = hideFileDownload; } + public void setSendPasswordByTalk(Boolean sendPasswordByTalk) { + this.sendPasswordByTalk = sendPasswordByTalk; + } + public void setLabel(String label) { this.label = label; } @@ -171,6 +181,10 @@ private String getRequestBody() { params.addProperty(PARAM_HIDE_DOWNLOAD, Boolean.toString(hideFileDownload)); } + if (sendPasswordByTalk != null) { + params.addProperty(PARAM_SEND_PASSWORD_BY_TALK, Boolean.toString(sendPasswordByTalk)); + } + if (note != null) { params.addProperty(PARAM_NOTE, note); }