Prechádzať zdrojové kódy

Don't make note mandatory for sharing

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
Álvaro Brey Vilas 3 rokov pred
rodič
commit
ded48ddba9

+ 5 - 7
src/main/java/com/owncloud/android/ui/fragment/FileDetailsSharingProcessFragment.kt

@@ -491,13 +491,10 @@ class FileDetailsSharingProcessFragment : Fragment(), ExpirationDatePickerDialog
      * method to validate step 2 (note screen) information
      */
     private fun validateShareProcessSecond() {
-        if (TextUtils.isEmpty(binding.noteText.text.toString().trim())) {
-            DisplayUtils.showSnackMessage(binding.root, R.string.share_link_empty_note_message)
-            return
-        }
+        val noteText = binding.noteText.text.toString().trim()
         // if modifying existing share then directly update the note and send email
-        if (share != null) {
-            fileOperationsHelper?.updateNoteToShare(share, binding.noteText.text.toString().trim())
+        if (share != null && share?.note != noteText) {
+            fileOperationsHelper?.updateNoteToShare(share, noteText)
         } else {
             // else create new share
             fileOperationsHelper?.shareFileWithSharee(
@@ -509,7 +506,8 @@ class FileDetailsSharingProcessFragment : Fragment(), ExpirationDatePickerDialog
                     .shareProcessHideDownloadCheckbox.isChecked,
                 binding.shareProcessEnterPassword.text.toString().trim(),
                 chosenExpDateInMills,
-                binding.noteText.text.toString().trim(), binding.shareProcessChangeNameEt.text.toString().trim()
+                noteText,
+                binding.shareProcessChangeNameEt.text.toString().trim()
             )
         }
         removeCurrentFragment()

+ 1 - 1
src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java

@@ -566,7 +566,7 @@ public class FileOperationsHelper {
             service.putExtra(OperationsService.EXTRA_SHARE_HIDE_FILE_DOWNLOAD, hideFileDownload);
             service.putExtra(OperationsService.EXTRA_SHARE_PASSWORD, (password == null) ? "" : password);
             service.putExtra(OperationsService.EXTRA_SHARE_EXPIRATION_DATE_IN_MILLIS, expirationTimeInMillis);
-            service.putExtra(OperationsService.EXTRA_SHARE_NOTE, note);
+            service.putExtra(OperationsService.EXTRA_SHARE_NOTE, (note == null) ? "" : note);
             service.putExtra(OperationsService.EXTRA_SHARE_PUBLIC_LABEL, (label == null) ? "" : label);
 
             mWaitingForOpId = fileActivity.getOperationsServiceBinder().queueNewOperation(service);

+ 0 - 1
src/main/res/values/strings.xml

@@ -972,7 +972,6 @@
     <string name="common_next">Next</string>
     <string name="send_share">Send Share</string>
     <string name="no_share_permission_selected">Please select at least one permission to share.</string>
-    <string name="share_link_empty_note_message">Please enter note.</string>
     <string name="share_copy_link">Share &amp; Copy Link</string>
     <string name="set_note">Set Note</string>
     <string name="share_open_in">Open in…</string>