Sharee lists updates on the spot after adding or deleting sharee

This commit is contained in:
Aaron Sun 2020-12-02 15:12:50 -08:00
parent a01c6f6d9c
commit fe8d6cbae6
3 changed files with 5 additions and 9 deletions

View File

@ -59,8 +59,6 @@ public class ListShareGetter implements CallHandler{
}
}
//Insert the ListShare objects to hold the data of the remaining rows into first's ListShare list
while (getListResults.next()) {
InvokeRequest invokeRequest = new InvokeRequest();

View File

@ -58,11 +58,6 @@ public class ListSharer implements CallHandler {
throw new InputMismatchException("Could not find specified user to share with");
}
String shareWithSub = new Gson().fromJson(new String(invokeResult.getPayload().array()), User.class).cognitoID;
// checkAccess.setString(2, shareWithSub);
// checkAccessRS = checkAccess.executeQuery();
// if (checkAccessRS.next()) {
// throw new InputMismatchException("The specified user already has access");
// }
PreparedStatement uiPositionCheck = connection.prepareStatement(UI_POSITION_CHECK);
uiPositionCheck.setString(1, shareWithSub);

View File

@ -59,6 +59,9 @@ public class ListSharees extends AppCompatActivity implements Requestor.Receiver
ListShare listShare = new ListShare(listID, sharedEmail, "Read, Write, Delete, Share", null);
try {
requestor.putObject(listShare);
lShareeEntries.add(listShare);
lShareeEmails.add(sharedEmail);
myAdapter.notifyDataSetChanged();
}
catch(Exception e) {
e.printStackTrace();
@ -72,8 +75,8 @@ public class ListSharees extends AppCompatActivity implements Requestor.Receiver
ListShare sharee = (ListShare) delivered;
if(sharee != null) {
lShareeEmails.add(sharee.getShareWithEmail());
lShareeEntries.add(sharee);
lShareeEmails.add(sharee.getShareWithEmail());
if(sharee.getEntries() != null) {
for(ListShare ls : sharee.getEntries()) {
@ -119,7 +122,7 @@ public class ListSharees extends AppCompatActivity implements Requestor.Receiver
try {
lShareeEntries.get(position).setPermissionLevel(0);
ListShare toRemove = lShareeEntries.remove(position);
System.out.println(toRemove);
lShareeEmails.remove(position);
requestor.putObject(toRemove);
myAdapter.notifyDataSetChanged();
}