Change invite cancel to invite revoke.
parent
b0650b926b
commit
d53fd6a109
|
@ -200,13 +200,13 @@ public final class GroupManager {
|
|||
}
|
||||
|
||||
@WorkerThread
|
||||
public static void cancelInvites(@NonNull Context context,
|
||||
public static void revokeInvites(@NonNull Context context,
|
||||
@NonNull GroupId.V2 groupId,
|
||||
@NonNull Collection<UuidCiphertext> uuidCipherTexts)
|
||||
throws GroupChangeFailedException, GroupInsufficientRightsException, IOException, GroupNotAMemberException, GroupChangeBusyException
|
||||
{
|
||||
try (GroupManagerV2.GroupEditor editor = new GroupManagerV2(context).edit(groupId.requireV2())) {
|
||||
editor.cancelInvites(uuidCipherTexts);
|
||||
editor.revokeInvites(uuidCipherTexts);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ final class GroupManagerV2 {
|
|||
}
|
||||
|
||||
@WorkerThread
|
||||
@NonNull GroupManager.GroupActionResult cancelInvites(@NonNull Collection<UuidCiphertext> uuidCipherTexts)
|
||||
@NonNull GroupManager.GroupActionResult revokeInvites(@NonNull Collection<UuidCiphertext> uuidCipherTexts)
|
||||
throws GroupChangeFailedException, GroupInsufficientRightsException, IOException, GroupNotAMemberException
|
||||
{
|
||||
return commitChangeWithConflictResolution(groupOperations.createRemoveInvitationChange(new HashSet<>(uuidCipherTexts)));
|
||||
|
@ -284,7 +284,7 @@ final class GroupManagerV2 {
|
|||
|
||||
if (selfPendingMember.isPresent()) {
|
||||
try {
|
||||
return cancelInvites(Collections.singleton(new UuidCiphertext(selfPendingMember.get().getUuidCipherText().toByteArray())));
|
||||
return revokeInvites(Collections.singleton(new UuidCiphertext(selfPendingMember.get().getUuidCipherText().toByteArray())));
|
||||
} catch (InvalidInputException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import androidx.annotation.NonNull;
|
|||
|
||||
public interface AdminActionsListener {
|
||||
|
||||
void onCancelInvite(@NonNull GroupMemberEntry.PendingMember pendingMember);
|
||||
void onRevokeInvite(@NonNull GroupMemberEntry.PendingMember pendingMember);
|
||||
|
||||
void onCancelAllInvites(@NonNull GroupMemberEntry.UnknownPendingMemberCount pendingMembers);
|
||||
void onRevokeAllInvites(@NonNull GroupMemberEntry.UnknownPendingMemberCount pendingMembers);
|
||||
}
|
||||
|
|
|
@ -324,8 +324,8 @@ final class GroupMemberListAdapter extends LifecycleRecyclerAdapter<GroupMemberL
|
|||
if (pendingMember.isCancellable() && adminActionsListener != null) {
|
||||
popupMenu.setMenu(R.menu.own_invite_pending_menu,
|
||||
item -> {
|
||||
if (item == R.id.cancel_invite) {
|
||||
adminActionsListener.onCancelInvite(pendingMember);
|
||||
if (item == R.id.revoke_invite) {
|
||||
adminActionsListener.onRevokeInvite(pendingMember);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -360,16 +360,16 @@ final class GroupMemberListAdapter extends LifecycleRecyclerAdapter<GroupMemberL
|
|||
if (pendingMembers.isCancellable() && adminActionsListener != null) {
|
||||
popupMenu.setMenu(R.menu.others_invite_pending_menu,
|
||||
item -> {
|
||||
if (item.getItemId() == R.id.cancel_invites) {
|
||||
item.setTitle(context.getResources().getQuantityString(R.plurals.PendingMembersActivity_cancel_d_invites, pendingMembers.getInviteCount(),
|
||||
if (item.getItemId() == R.id.revoke_invites) {
|
||||
item.setTitle(context.getResources().getQuantityString(R.plurals.PendingMembersActivity_revoke_d_invites, pendingMembers.getInviteCount(),
|
||||
pendingMembers.getInviteCount()));
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
item -> {
|
||||
if (item == R.id.cancel_invites) {
|
||||
adminActionsListener.onCancelAllInvites(pendingMembers);
|
||||
if (item == R.id.revoke_invites) {
|
||||
adminActionsListener.onRevokeAllInvites(pendingMembers);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -8,40 +8,40 @@ import androidx.appcompat.app.AlertDialog;
|
|||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
|
||||
final class InviteCancelConfirmationDialog {
|
||||
final class InviteRevokeConfirmationDialog {
|
||||
|
||||
private InviteCancelConfirmationDialog() {
|
||||
private InviteRevokeConfirmationDialog() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms that you want to cancel an invite that you sent.
|
||||
* Confirms that you want to revoke an invite that you sent.
|
||||
*/
|
||||
static AlertDialog showOwnInviteCancelConfirmationDialog(@NonNull Context context,
|
||||
static AlertDialog showOwnInviteRevokeConfirmationDialog(@NonNull Context context,
|
||||
@NonNull Recipient invitee,
|
||||
@NonNull Runnable onCancel)
|
||||
@NonNull Runnable onRevoke)
|
||||
{
|
||||
return new AlertDialog.Builder(context)
|
||||
.setMessage(context.getString(R.string.GroupManagement_cancel_own_single_invite,
|
||||
.setMessage(context.getString(R.string.InviteRevokeConfirmationDialog_revoke_own_single_invite,
|
||||
invitee.getDisplayName(context)))
|
||||
.setPositiveButton(R.string.yes, (dialog, which) -> onCancel.run())
|
||||
.setPositiveButton(R.string.yes, (dialog, which) -> onRevoke.run())
|
||||
.setNegativeButton(R.string.no, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms that you want to cancel a number of invites that another member sent.
|
||||
* Confirms that you want to revoke a number of invites that another member sent.
|
||||
*/
|
||||
static AlertDialog showOthersInviteCancelConfirmationDialog(@NonNull Context context,
|
||||
static AlertDialog showOthersInviteRevokeConfirmationDialog(@NonNull Context context,
|
||||
@NonNull Recipient inviter,
|
||||
int numberOfInvitations,
|
||||
@NonNull Runnable onCancel)
|
||||
@NonNull Runnable onRevoke)
|
||||
{
|
||||
return new AlertDialog.Builder(context)
|
||||
.setMessage(context.getResources().getQuantityString(R.plurals.GroupManagement_cancel_others_invites,
|
||||
.setMessage(context.getResources().getQuantityString(R.plurals.InviteRevokeConfirmationDialog_revoke_others_invites,
|
||||
numberOfInvitations,
|
||||
inviter.getDisplayName(context),
|
||||
numberOfInvitations))
|
||||
.setPositiveButton(R.string.yes, (dialog, which) -> onCancel.run())
|
||||
.setPositiveButton(R.string.yes, (dialog, which) -> onRevoke.run())
|
||||
.setNegativeButton(R.string.no, null)
|
||||
.show();
|
||||
}
|
|
@ -50,12 +50,12 @@ public class PendingMemberInvitesFragment extends Fragment {
|
|||
youInvited.setAdminActionsListener(new AdminActionsListener() {
|
||||
|
||||
@Override
|
||||
public void onCancelInvite(@NonNull GroupMemberEntry.PendingMember pendingMember) {
|
||||
viewModel.cancelInviteFor(pendingMember);
|
||||
public void onRevokeInvite(@NonNull GroupMemberEntry.PendingMember pendingMember) {
|
||||
viewModel.revokeInviteFor(pendingMember);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelAllInvites(@NonNull GroupMemberEntry.UnknownPendingMemberCount pendingMembers) {
|
||||
public void onRevokeAllInvites(@NonNull GroupMemberEntry.UnknownPendingMemberCount pendingMembers) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
});
|
||||
|
@ -63,13 +63,13 @@ public class PendingMemberInvitesFragment extends Fragment {
|
|||
othersInvited.setAdminActionsListener(new AdminActionsListener() {
|
||||
|
||||
@Override
|
||||
public void onCancelInvite(@NonNull GroupMemberEntry.PendingMember pendingMember) {
|
||||
public void onRevokeInvite(@NonNull GroupMemberEntry.PendingMember pendingMember) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelAllInvites(@NonNull GroupMemberEntry.UnknownPendingMemberCount pendingMembers) {
|
||||
viewModel.cancelInvitesFor(pendingMembers);
|
||||
public void onRevokeAllInvites(@NonNull GroupMemberEntry.UnknownPendingMemberCount pendingMembers) {
|
||||
viewModel.revokeInvitesFor(pendingMembers);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -56,27 +56,27 @@ public class PendingMemberInvitesViewModel extends ViewModel {
|
|||
for (PendingMemberRepository.SinglePendingMemberInvitedByYou pendingMember : inviteeResult.getByMe()) {
|
||||
byMe.add(new GroupMemberEntry.PendingMember(pendingMember.getInvitee(),
|
||||
pendingMember.getInviteeCipherText(),
|
||||
inviteeResult.isCanCancelInvites()));
|
||||
inviteeResult.isCanRevokeInvites()));
|
||||
}
|
||||
|
||||
for (PendingMemberRepository.MultiplePendingMembersInvitedByAnother pendingMembers : inviteeResult.getByOthers()) {
|
||||
byOthers.add(new GroupMemberEntry.UnknownPendingMemberCount(pendingMembers.getInviter(),
|
||||
pendingMembers.getUuidCipherTexts(),
|
||||
inviteeResult.isCanCancelInvites()));
|
||||
inviteeResult.isCanRevokeInvites()));
|
||||
}
|
||||
|
||||
setInvitees(byMe, byOthers);
|
||||
}
|
||||
|
||||
void cancelInviteFor(@NonNull GroupMemberEntry.PendingMember pendingMember) {
|
||||
void revokeInviteFor(@NonNull GroupMemberEntry.PendingMember pendingMember) {
|
||||
UuidCiphertext inviteeCipherText = pendingMember.getInviteeCipherText();
|
||||
|
||||
InviteCancelConfirmationDialog.showOwnInviteCancelConfirmationDialog(context, pendingMember.getInvitee(), () ->
|
||||
InviteRevokeConfirmationDialog.showOwnInviteRevokeConfirmationDialog(context, pendingMember.getInvitee(), () ->
|
||||
SimpleTask.run(
|
||||
() -> {
|
||||
pendingMember.setBusy(true);
|
||||
try {
|
||||
return pendingMemberRepository.cancelInvites(Collections.singleton(inviteeCipherText));
|
||||
return pendingMemberRepository.revokeInvites(Collections.singleton(inviteeCipherText));
|
||||
} finally {
|
||||
pendingMember.setBusy(false);
|
||||
}
|
||||
|
@ -100,13 +100,13 @@ public class PendingMemberInvitesViewModel extends ViewModel {
|
|||
));
|
||||
}
|
||||
|
||||
void cancelInvitesFor(@NonNull GroupMemberEntry.UnknownPendingMemberCount pendingMembers) {
|
||||
InviteCancelConfirmationDialog.showOthersInviteCancelConfirmationDialog(context, pendingMembers.getInviter(), pendingMembers.getInviteCount(),
|
||||
void revokeInvitesFor(@NonNull GroupMemberEntry.UnknownPendingMemberCount pendingMembers) {
|
||||
InviteRevokeConfirmationDialog.showOthersInviteRevokeConfirmationDialog(context, pendingMembers.getInviter(), pendingMembers.getInviteCount(),
|
||||
() -> SimpleTask.run(
|
||||
() -> {
|
||||
pendingMembers.setBusy(true);
|
||||
try {
|
||||
return pendingMemberRepository.cancelInvites(pendingMembers.getCiphertexts());
|
||||
return pendingMemberRepository.revokeInvites(pendingMembers.getCiphertexts());
|
||||
} finally {
|
||||
pendingMembers.setBusy(false);
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public class PendingMemberInvitesViewModel extends ViewModel {
|
|||
}
|
||||
|
||||
private void toastErrorCanceling(int quantity) {
|
||||
Toast.makeText(context, context.getResources().getQuantityText(R.plurals.PendingMembersActivity_error_canceling_invite, quantity), Toast.LENGTH_SHORT)
|
||||
Toast.makeText(context, context.getResources().getQuantityText(R.plurals.PendingMembersActivity_error_revoking_invite, quantity), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
|
||||
|
|
|
@ -98,9 +98,9 @@ final class PendingMemberRepository {
|
|||
}
|
||||
|
||||
@WorkerThread
|
||||
boolean cancelInvites(@NonNull Collection<UuidCiphertext> uuidCipherTexts) {
|
||||
boolean revokeInvites(@NonNull Collection<UuidCiphertext> uuidCipherTexts) {
|
||||
try {
|
||||
GroupManager.cancelInvites(context, groupId, uuidCipherTexts);
|
||||
GroupManager.revokeInvites(context, groupId, uuidCipherTexts);
|
||||
return true;
|
||||
} catch (GroupChangeException | IOException e) {
|
||||
Log.w(TAG, e);
|
||||
|
@ -111,15 +111,15 @@ final class PendingMemberRepository {
|
|||
public static final class InviteeResult {
|
||||
private final List<SinglePendingMemberInvitedByYou> byMe;
|
||||
private final List<MultiplePendingMembersInvitedByAnother> byOthers;
|
||||
private final boolean canCancelInvites;
|
||||
private final boolean canRevokeInvites;
|
||||
|
||||
private InviteeResult(List<SinglePendingMemberInvitedByYou> byMe,
|
||||
List<MultiplePendingMembersInvitedByAnother> byOthers,
|
||||
boolean canCancelInvites)
|
||||
boolean canRevokeInvites)
|
||||
{
|
||||
this.byMe = byMe;
|
||||
this.byOthers = byOthers;
|
||||
this.canCancelInvites = canCancelInvites;
|
||||
this.canRevokeInvites = canRevokeInvites;
|
||||
}
|
||||
|
||||
public List<SinglePendingMemberInvitedByYou> getByMe() {
|
||||
|
@ -130,8 +130,8 @@ final class PendingMemberRepository {
|
|||
return byOthers;
|
||||
}
|
||||
|
||||
public boolean isCanCancelInvites() {
|
||||
return canCancelInvites;
|
||||
public boolean isCanRevokeInvites() {
|
||||
return canRevokeInvites;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/cancel_invites"
|
||||
android:title="@string/PendingMembersActivity_cancel_invites" />
|
||||
android:id="@+id/revoke_invites"
|
||||
android:title="@string/PendingMembersActivity_revoke_invites" />
|
||||
|
||||
</menu>
|
|
@ -2,7 +2,7 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/cancel_invite"
|
||||
android:title="@string/PendingMembersActivity_cancel_invite" />
|
||||
android:id="@+id/revoke_invite"
|
||||
android:title="@string/PendingMembersActivity_revoke_invite" />
|
||||
|
||||
</menu>
|
|
@ -492,15 +492,15 @@
|
|||
<string name="PendingMembersActivity_no_pending_invites_by_other_group_members">No pending invites by other group members.</string>
|
||||
<string name="PendingMembersActivity_missing_detail_explanation">Details of people invited by other group members are not shown. If invitees choose to join, their information will be shared with the group at that time. They will not see any messages in the group until they join.</string>
|
||||
|
||||
<string name="PendingMembersActivity_cancel_invite">Cancel invite</string>
|
||||
<string name="PendingMembersActivity_cancel_invites">Cancel invites</string>
|
||||
<plurals name="PendingMembersActivity_cancel_d_invites">
|
||||
<item quantity="one">Cancel invite</item>
|
||||
<item quantity="other">Cancel %1$d invites</item>
|
||||
<string name="PendingMembersActivity_revoke_invite">Revoke invite</string>
|
||||
<string name="PendingMembersActivity_revoke_invites">Revoke invites</string>
|
||||
<plurals name="PendingMembersActivity_revoke_d_invites">
|
||||
<item quantity="one">Revoke invite</item>
|
||||
<item quantity="other">Revoke %1$d invites</item>
|
||||
</plurals>
|
||||
<plurals name="PendingMembersActivity_error_canceling_invite">
|
||||
<item quantity="one">Error canceling invite</item>
|
||||
<item quantity="other">Error canceling invites</item>
|
||||
<plurals name="PendingMembersActivity_error_revoking_invite">
|
||||
<item quantity="one">Error revoking invite</item>
|
||||
<item quantity="other">Error revoking invites</item>
|
||||
</plurals>
|
||||
|
||||
<!-- AddMembersActivity -->
|
||||
|
@ -621,11 +621,11 @@
|
|||
<string name="CustomNotificationsDialogFragment__disabled">Disabled</string>
|
||||
<string name="CustomNotificationsDialogFragment__default">Default</string>
|
||||
|
||||
<!-- GV2 Invite cancellation confirmation -->
|
||||
<string name="GroupManagement_cancel_own_single_invite">Do you want to cancel the invite you sent to %1$s?</string>
|
||||
<plurals name="GroupManagement_cancel_others_invites">
|
||||
<item quantity="one">Do you want to cancel the invite sent by %1$s?</item>
|
||||
<item quantity="other">Do you want to cancel %2$d invites sent by %1$s?</item>
|
||||
<!-- GV2 Invite Revoke confirmation dialog -->
|
||||
<string name="InviteRevokeConfirmationDialog_revoke_own_single_invite">Do you want to revoke the invite you sent to %1$s?</string>
|
||||
<plurals name="InviteRevokeConfirmationDialog_revoke_others_invites">
|
||||
<item quantity="one">Do you want to revoke the invite sent by %1$s?</item>
|
||||
<item quantity="other">Do you want to revoke %2$d invites sent by %1$s?</item>
|
||||
</plurals>
|
||||
|
||||
<!-- CropImageActivity -->
|
||||
|
|
Loading…
Reference in New Issue