mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 13:15:35 +03:00
fix check if share already exists and give feedback
Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
parent
b7423184f4
commit
e1580af541
2 changed files with 15 additions and 1 deletions
|
@ -880,7 +880,7 @@ public abstract class FileActivity extends DrawerActivity
|
|||
String shareWith = dataString.substring(dataString.lastIndexOf('/') + 1);
|
||||
|
||||
ArrayList<String> existingSharees = new ArrayList<>();
|
||||
for (OCShare share : getStorageManager().getSharesWithForAFile(getFile().getRemotePath(),
|
||||
for (OCShare share : getStorageManager().getSharesWithForAFile(getFileFromDetailFragment().getRemotePath(),
|
||||
getAccount().name)) {
|
||||
existingSharees.add(share.getShareType() + "_" + share.getShareWith());
|
||||
}
|
||||
|
@ -890,10 +890,23 @@ public abstract class FileActivity extends DrawerActivity
|
|||
|
||||
if (!existingSharees.contains(shareType + "_" + shareWith)) {
|
||||
doShareWith(shareWith, shareType);
|
||||
} else {
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.sharee_already_added_to_file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the file that is selected for sharing, getFile() only returns the containing folder
|
||||
*/
|
||||
private OCFile getFileFromDetailFragment() {
|
||||
FileDetailFragment fragment = getFileDetailFragment();
|
||||
if (fragment != null) {
|
||||
return fragment.getFile();
|
||||
}
|
||||
return getFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* open the new sharing process fragment to create the share
|
||||
*
|
||||
|
|
|
@ -786,6 +786,7 @@
|
|||
<string name="uploads_view_upload_status_virus_detected">Virus detected. Upload cannot be completed!</string>
|
||||
<string name="tags">Tags</string>
|
||||
<string name="sharee_add_failed">Adding sharee failed</string>
|
||||
<string name="sharee_already_added_to_file">Adding share failed. This file or folder has already been shared with this person or group.</string>
|
||||
<string name="unsharing_failed">Unsharing failed</string>
|
||||
<string name="updating_share_failed">Updating share failed</string>
|
||||
<string name="prefs_e2e_mnemonic">E2E mnemonic</string>
|
||||
|
|
Loading…
Reference in a new issue