Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class CreateShareRemoteOperation extends RemoteOperation<List<OCShare>> {
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;
Expand All @@ -48,6 +49,7 @@ public class CreateShareRemoteOperation extends RemoteOperation<List<OCShare>> {
private boolean getShareDetails;
private String note;
private String attributes;
private Boolean sendPasswordByTalk;

/**
* Constructor
Expand Down Expand Up @@ -134,6 +136,10 @@ public void setGetShareDetails(boolean set) {
getShareDetails = set;
}

public void setSendPasswordByTalk(Boolean sendPasswordByTalk) {
this.sendPasswordByTalk = sendPasswordByTalk;
}

@Override
protected RemoteOperationResult<List<OCShare>> run(OwnCloudClient client) {
RemoteOperationResult<List<OCShare>> result;
Expand Down Expand Up @@ -168,6 +174,10 @@ protected RemoteOperationResult<List<OCShare>> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -110,6 +111,7 @@ class OCShare :
isPasswordProtected = false
note = ""
isHideFileDownload = false
isSendPasswordByTalk = false
label = ""
isHasPreview = false
mimetype = ""
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -389,6 +390,11 @@ private void readElement(XmlPullParser parser, ArrayList<OCShare> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down