use of cx.ring.model.Account in project ring-client-android by savoirfairelinux.
the class BlackListPresenter method updateList.
public void updateList() {
if (getView() == null) {
return;
}
Account account = mAccountService.getAccount(mAccountID);
if (account == null) {
return;
}
List<CallContact> list = account.getBannedContacts();
if (list.isEmpty()) {
getView().hideListView();
getView().displayEmptyListMessage(true);
} else {
getView().updateView(list);
getView().displayEmptyListMessage(false);
}
}
use of cx.ring.model.Account in project ring-client-android by savoirfairelinux.
the class GeneralAccountPresenter method init.
// Init with current account
public void init() {
Account currentAccount = mAccountService.getCurrentAccount();
if (currentAccount == null) {
Log.e(TAG, "init: No currentAccount available");
return;
}
init(currentAccount.getAccountID());
}
use of cx.ring.model.Account in project ring-client-android by savoirfairelinux.
the class AccountService method setAccountsActive.
/**
* Sets the activation state of all the accounts in the Daemon
*/
public void setAccountsActive(final boolean active, final boolean allowProxy) {
FutureUtils.executeDaemonThreadCallable(mExecutor, mDeviceRuntimeService.provideDaemonThreadId(), false, () -> {
Log.i(TAG, "setAccountsActive() thread running... " + active);
StringVect list = Ringservice.getAccountList();
for (int i = 0, n = list.size(); i < n; i++) {
String accountId = list.get(i);
Account a = getAccount(accountId);
if (!allowProxy || active || a == null || !a.isDhtProxyEnabled()) {
Ringservice.setAccountActive(accountId, active);
}
}
return true;
});
}
use of cx.ring.model.Account in project ring-client-android by savoirfairelinux.
the class AccountService method registrationStateChanged.
public void registrationStateChanged(String accountId, String newState, int code, String detailString) {
Log.d(TAG, "stun status registrationStateChanged: " + accountId + ", " + newState + ", " + code + ", " + detailString);
Account account = getAccount(accountId);
if (account == null) {
return;
}
String oldState = account.getRegistrationState();
if (oldState.contentEquals(AccountConfig.STATE_INITIALIZING) && !newState.contentEquals(AccountConfig.STATE_INITIALIZING)) {
account.setDetails(getAccountDetails(account.getAccountID()));
account.setCredentials(getCredentials(account.getAccountID()));
account.setDevices(getKnownRingDevices(account.getAccountID()));
account.setVolatileDetails(getVolatileAccountDetails(account.getAccountID()));
} else {
account.setRegistrationState(newState, code);
}
if (!oldState.equals(newState)) {
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.REGISTRATION_STATE_CHANGED);
event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
event.addEventInput(ServiceEvent.EventInput.STATE, newState);
event.addEventInput(ServiceEvent.EventInput.DETAIL_CODE, code);
event.addEventInput(ServiceEvent.EventInput.DETAIL_STRING, detailString);
notifyObservers(event);
}
}
use of cx.ring.model.Account in project ring-client-android by savoirfairelinux.
the class AccountService method registeredNameFound.
public void registeredNameFound(String accountId, int state, String address, String name) {
Log.d(TAG, "registeredNameFound: " + accountId + ", " + state + ", " + name + ", " + address);
Account account = getAccount(accountId);
if (account != null) {
if (state == 0) {
CallContact contact = account.getContact(address);
if (contact != null) {
contact.setUsername(name);
}
}
TrustRequest request = account.getRequest(address);
if (request != null) {
Log.d(TAG, "registeredNameFound: updating TrustRequest " + name);
boolean resolved = request.isNameResolved();
request.setUsername(name);
if (!resolved) {
Log.d(TAG, "registeredNameFound: TrustRequest resolved " + name);
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.INCOMING_TRUST_REQUEST);
event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
event.addEventInput(ServiceEvent.EventInput.FROM, request.getContactId());
notifyObservers(event);
}
}
}
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.REGISTERED_NAME_FOUND);
event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
event.addEventInput(ServiceEvent.EventInput.STATE, state);
event.addEventInput(ServiceEvent.EventInput.ADDRESS, address);
event.addEventInput(ServiceEvent.EventInput.NAME, name);
notifyObservers(event);
}
Aggregations