Use event instead of CommitAction to handle removed PendingContacts

This commit is contained in:
Torsten Grote
2019-05-09 11:43:22 -03:00
parent 19bc73ac61
commit fbe375cc4e
7 changed files with 45 additions and 16 deletions

View File

@@ -80,10 +80,8 @@ public interface ContactManager {
/**
* Removes a {@link PendingContact} that is in state
* {@link PendingContactState FAILED}.
* @param commitAction an action to run on the main thread after removing.
*/
void removePendingContact(PendingContactId pendingContact,
Runnable commitAction) throws DbException;
void removePendingContact(PendingContactId pendingContact) throws DbException;
/**
* Returns the contact with the given ID.

View File

@@ -0,0 +1,26 @@
package org.briarproject.bramble.api.contact.event;
import org.briarproject.bramble.api.contact.PendingContactId;
import org.briarproject.bramble.api.event.Event;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import javax.annotation.concurrent.Immutable;
/**
* An event that is broadcast when a pending contact is removed.
*/
@Immutable
@NotNullByDefault
public class PendingContactRemovedEvent extends Event {
private final PendingContactId id;
public PendingContactRemovedEvent(PendingContactId id) {
this.id = id;
}
public PendingContactId getId() {
return id;
}
}