Skip to content
Snippets Groups Projects
Commit bc3aabc9 authored by Hadrien De Sousa's avatar Hadrien De Sousa
Browse files

AndroidTv : sent auto trust request for first call

With the refactor, contacts that has the NO_REQUEST status are not
displayed in the smartlist even if a message has been sent.

This commit add an automatic contact request when the user call a
contact that has the NO_REQUEST status. The contact will be
added in the daemon and displayed in the smartlist

Change-Id: Iea5da55493c25635d67a34a183b7333ecc16034b
parent b78b5b3b
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ package cx.ring.tv.search;
import javax.inject.Inject;
import cx.ring.daemon.Blob;
import cx.ring.model.Account;
import cx.ring.model.CallContact;
import cx.ring.model.RingError;
......@@ -29,9 +30,12 @@ import cx.ring.model.Uri;
import cx.ring.mvp.RootPresenter;
import cx.ring.services.AccountService;
import cx.ring.services.HardwareService;
import cx.ring.services.VCardService;
import cx.ring.utils.NameLookupInputHandler;
import cx.ring.utils.Observable;
import cx.ring.utils.Observer;
import cx.ring.utils.VCardUtils;
import ezvcard.VCard;
public class RingSearchPresenter extends RootPresenter<RingSearchView> implements Observer<ServiceEvent> {
......@@ -40,6 +44,7 @@ public class RingSearchPresenter extends RootPresenter<RingSearchView> implement
private AccountService mAccountService;
private HardwareService mHardwareService;
private VCardService mVCardService;
private NameLookupInputHandler mNameLookupInputHandler;
private String mLastBlockchainQuery = null;
......@@ -47,9 +52,11 @@ public class RingSearchPresenter extends RootPresenter<RingSearchView> implement
@Inject
public RingSearchPresenter(AccountService accountService,
HardwareService hardwareService) {
HardwareService hardwareService,
VCardService vCardService) {
this.mAccountService = accountService;
this.mHardwareService = hardwareService;
this.mVCardService = vCardService;
}
@Override
......@@ -155,6 +162,15 @@ public class RingSearchPresenter extends RootPresenter<RingSearchView> implement
return;
}
getView().startCall(mAccountService.getCurrentAccount().getAccountID(), contact.getPhones().get(0).getNumber().toString());
String accountId = mAccountService.getCurrentAccount().getAccountID();
if (contact.getStatus() == CallContact.Status.NO_REQUEST) {
VCard vCard = mVCardService.loadSmallVCard(accountId);
mAccountService.sendTrustRequest(accountId,
contact.getPhones().get(0).getNumber().getRawRingId(),
Blob.fromString(VCardUtils.vcardToString(vCard)));
}
getView().startCall(accountId, contact.getPhones().get(0).getNumber().toString());
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment