+ * Starts a dialog that requests a password to the user to protect a share link.
+ *
+ * @param file File which public share will be protected by the requested password
+ */
+ public void requestPasswordForShareViaLink(OCFile file) {
+ SharePasswordDialogFragment dialog =
+ SharePasswordDialogFragment.newInstance(
+ file,
+ null
+ );
+ dialog.show(
+ mFileActivity.getSupportFragmentManager(),
+ SharePasswordDialogFragment.PASSWORD_FRAGMENT
+ );
+ }
+
+ /**
+ * Updates a public share on a file to set its password.
+ * Starts a request to do it in {@link OperationsService}
+ *
+ * @param file File which public share will be protected with a password.
+ * @param password Password to set for the public link; null or empty string to clear
+ * the current password
+ */
+ public void setPasswordToShareViaLink(OCFile file, String password) {
+ // Set password updating share
+ Intent updateShareIntent = new Intent(mFileActivity, OperationsService.class);
+ updateShareIntent.setAction(OperationsService.ACTION_UPDATE_SHARE);
+ updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
+ updateShareIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
+ updateShareIntent.putExtra(
+ OperationsService.EXTRA_PASSWORD_SHARE,
+ (password == null) ? "" : password
+ );
+
+ queueShareIntent(updateShareIntent);
+ }
+
+
+ /**