mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
- fix wrong mapping from room to group
- take type into account when checking if already shared Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
b425bba679
commit
5431eeab6c
2 changed files with 18 additions and 18 deletions
|
@ -82,6 +82,7 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
|
|||
|
||||
public static String DATA_USER;
|
||||
public static String DATA_GROUP;
|
||||
public static String DATA_ROOM;
|
||||
public static String DATA_REMOTE;
|
||||
|
||||
private UriMatcher mUriMatcher;
|
||||
|
@ -110,11 +111,12 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
|
|||
ACTION_SHARE_WITH = getContext().getResources().getString(R.string.users_and_groups_share_with);
|
||||
DATA_USER = AUTHORITY + ".data.user";
|
||||
DATA_GROUP = AUTHORITY + ".data.group";
|
||||
DATA_ROOM = AUTHORITY + ".data.room";
|
||||
DATA_REMOTE = AUTHORITY + ".data.remote";
|
||||
|
||||
sShareTypes.put(DATA_USER, ShareType.USER);
|
||||
sShareTypes.put(DATA_GROUP, ShareType.GROUP);
|
||||
sShareTypes.put(DATA_GROUP, ShareType.ROOM);
|
||||
sShareTypes.put(DATA_ROOM, ShareType.ROOM);
|
||||
sShareTypes.put(DATA_REMOTE, ShareType.FEDERATED);
|
||||
sShareTypes.put(DATA_REMOTE, ShareType.EMAIL);
|
||||
|
||||
|
@ -189,6 +191,7 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
|
|||
|
||||
Uri userBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_USER).build();
|
||||
Uri groupBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_GROUP).build();
|
||||
Uri roomBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_ROOM).build();
|
||||
Uri remoteBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_REMOTE).build();
|
||||
|
||||
FileDataStorageManager manager = new FileDataStorageManager(account, getContext().getContentResolver());
|
||||
|
@ -242,7 +245,7 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
|
|||
case ROOM:
|
||||
icon = R.drawable.ic_chat_bubble;
|
||||
displayName = getContext().getString(R.string.share_room_clarification, userName);
|
||||
dataUri = Uri.withAppendedPath(groupBaseUri, shareWith);
|
||||
dataUri = Uri.withAppendedPath(roomBaseUri, shareWith);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -553,13 +553,17 @@ public class FileDisplayActivity extends HookActivity
|
|||
String dataString = intent.getDataString();
|
||||
String shareWith = dataString.substring(dataString.lastIndexOf('/') + 1);
|
||||
|
||||
ArrayList<String> shareeNames = new ArrayList<>();
|
||||
for (OCShare share : getStorageManager().getSharesWithForAFile(getFile().getRemotePath(), getAccount().name)) {
|
||||
shareeNames.add(share.getShareWith());
|
||||
ArrayList<String> existingSharees = new ArrayList<>();
|
||||
for (OCShare share : getStorageManager().getSharesWithForAFile(getFile().getRemotePath(),
|
||||
getAccount().name)) {
|
||||
existingSharees.add(share.getShareType() + "_" + share.getShareWith());
|
||||
}
|
||||
|
||||
if (!shareeNames.contains(shareWith)) {
|
||||
doShareWith(shareWith, data.getAuthority());
|
||||
String dataAuthority = data.getAuthority();
|
||||
ShareType shareType = UsersAndGroupsSearchProvider.getShareType(dataAuthority);
|
||||
|
||||
if (!existingSharees.contains(shareType + "_" + shareWith)) {
|
||||
doShareWith(shareWith, shareType);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -567,19 +571,12 @@ public class FileDisplayActivity extends HookActivity
|
|||
}
|
||||
}
|
||||
|
||||
private void doShareWith(String shareeName, String dataAuthority) {
|
||||
|
||||
ShareType shareType = UsersAndGroupsSearchProvider.getShareType(dataAuthority);
|
||||
|
||||
getFileOperationsHelper().shareFileWithSharee(
|
||||
getFile(),
|
||||
shareeName,
|
||||
shareType,
|
||||
getAppropiatePermissions(shareType)
|
||||
);
|
||||
private void doShareWith(String shareeName, ShareType shareType) {
|
||||
getFileOperationsHelper().shareFileWithSharee(getFile(), shareeName, shareType,
|
||||
getAppropriatePermissions(shareType));
|
||||
}
|
||||
|
||||
private int getAppropiatePermissions(ShareType shareType) {
|
||||
private int getAppropriatePermissions(ShareType shareType) {
|
||||
|
||||
// check if the Share is FEDERATED
|
||||
boolean isFederated = ShareType.FEDERATED.equals(shareType);
|
||||
|
|
Loading…
Reference in a new issue