Add handshake key pairs to DB, remove inactive contacts.

This commit is contained in:
akwizgran
2019-04-18 13:15:25 +01:00
parent dcebd5a81c
commit 0587fdc54c
44 changed files with 407 additions and 532 deletions

View File

@@ -17,8 +17,8 @@ import android.view.ViewGroup;
import org.briarproject.bramble.api.contact.Contact;
import org.briarproject.bramble.api.contact.ContactId;
import org.briarproject.bramble.api.contact.ContactManager;
import org.briarproject.bramble.api.contact.event.ContactAddedEvent;
import org.briarproject.bramble.api.contact.event.ContactRemovedEvent;
import org.briarproject.bramble.api.contact.event.ContactStatusChangedEvent;
import org.briarproject.bramble.api.db.DbException;
import org.briarproject.bramble.api.db.NoSuchContactException;
import org.briarproject.bramble.api.event.Event;
@@ -194,7 +194,7 @@ public class ContactListFragment extends BaseFragment implements EventListener {
try {
long start = now();
List<ContactListItem> contacts = new ArrayList<>();
for (Contact c : contactManager.getActiveContacts()) {
for (Contact c : contactManager.getContacts()) {
try {
ContactId id = c.getId();
GroupCount count =
@@ -229,15 +229,9 @@ public class ContactListFragment extends BaseFragment implements EventListener {
@Override
public void eventOccurred(Event e) {
if (e instanceof ContactStatusChangedEvent) {
ContactStatusChangedEvent c = (ContactStatusChangedEvent) e;
if (c.isActive()) {
LOG.info("Contact activated, reloading");
loadContacts();
} else {
LOG.info("Contact deactivated, removing item");
removeItem(c.getContactId());
}
if (e instanceof ContactAddedEvent) {
LOG.info("Contact added, reloading");
loadContacts();
} else if (e instanceof ContactConnectedEvent) {
setConnected(((ContactConnectedEvent) e).getContactId(), true);
} else if (e instanceof ContactDisconnectedEvent) {

View File

@@ -44,7 +44,7 @@ public abstract class ContactSelectorControllerImpl
runOnDbThread(() -> {
try {
Collection<SelectableContactItem> contacts = new ArrayList<>();
for (Contact c : contactManager.getActiveContacts()) {
for (Contact c : contactManager.getContacts()) {
// was this contact already selected?
boolean selected = selection.contains(c.getId());
// can this contact be selected?

View File

@@ -204,7 +204,7 @@ public class ConversationViewModel extends AndroidViewModel {
imageSupport.postValue(imagesSupported);
// check if introductions are supported
Collection<Contact> contacts = contactManager.getActiveContacts();
Collection<Contact> contacts = contactManager.getContacts();
boolean introductionSupported = contacts.size() > 1;
showIntroductionAction.postValue(introductionSupported);

View File

@@ -119,7 +119,7 @@ public class ContactChooserFragment extends BaseFragment {
listener.runOnDbThread(() -> {
try {
List<ContactListItem> contacts = new ArrayList<>();
for (Contact c : contactManager.getActiveContacts()) {
for (Contact c : contactManager.getContacts()) {
if (c.getId().equals(contactId)) {
c1 = c;
} else {

View File

@@ -78,7 +78,7 @@ class RevealContactsControllerImpl extends DbControllerImpl
Collection<GroupMember> members =
groupManager.getMembers(g);
Collection<Contact> contacts =
contactManager.getActiveContacts();
contactManager.getContacts();
Collection<RevealableContactItem> items =
new ArrayList<>(members.size());
for (GroupMember m : members) {