use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class AccountService method setAccountsVideoEnabled.
/**
* Sets the video activation state of all the accounts in the local cache
*/
public void setAccountsVideoEnabled(boolean isEnabled) {
for (Account account : mAccountList) {
account.setDetail(ConfigKey.VIDEO_ENABLED, isEnabled);
}
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.ACCOUNTS_CHANGED);
notifyObservers(event);
}
use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class AccountService method dataTransferEvent.
public void dataTransferEvent(final long transferId, int eventCode) {
DataTransferEventCode dataEvent = getDataTransferEventCode(eventCode);
DataTransferInfo info = new DataTransferInfo();
dataTransferInfo(transferId, info);
boolean outgoing = info.getFlags() == 0;
DataTransfer transfer = mDataTransfers.get(transferId);
if (transfer == null && outgoing && mStartingTransfer != null) {
transfer = mStartingTransfer;
mStartingTransfer = null;
transfer.setDataTransferId(transferId);
mDataTransfers.put(transferId, transfer);
}
if (transfer == null) {
transfer = new DataTransfer(transferId, info.getDisplayName(), outgoing, info.getTotalSize(), info.getBytesProgress(), info.getPeer(), info.getAccountId());
mHistoryService.insertDataTransfer(transfer);
mDataTransfers.put(transferId, transfer);
} else {
DataTransferEventCode oldState = transfer.getEventCode();
if (oldState != dataEvent) {
if (dataEvent == DataTransferEventCode.ONGOING) {
if (mTransferRefreshTimer == null) {
mTransferRefreshTimer = new Timer();
}
mTransferRefreshTimer.scheduleAtFixedRate(new DataTransferRefreshTask(transfer), DATA_TRANSFER_REFRESH_PERIOD, DATA_TRANSFER_REFRESH_PERIOD);
}
}
transfer.setEventCode(dataEvent);
transfer.setBytesProgress(info.getBytesProgress());
mHistoryService.updateDataTransfer(transfer);
}
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.DATA_TRANSFER);
event.addEventInput(ServiceEvent.EventInput.TRANSFER_EVENT_CODE, dataEvent);
event.addEventInput(ServiceEvent.EventInput.TRANSFER_INFO, transfer);
notifyObservers(event);
}
use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class AccountService method discardTrustRequest.
/**
* Refuses and blocks a pending trust request
*/
public void discardTrustRequest(final String accountId, final String from) {
Account account = getAccount(accountId);
account.removeRequest(from);
FutureUtils.executeDaemonThreadCallable(mExecutor, mDeviceRuntimeService.provideDaemonThreadId(), false, (Callable<Void>) () -> {
Log.i(TAG, "discardTrustRequest() " + accountId + " " + from);
boolean ok = Ringservice.discardTrustRequest(accountId, from);
if (ok) {
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.INCOMING_TRUST_REQUEST);
event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
notifyObservers(event);
}
return null;
});
}
use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class AccountService method contactAdded.
public void contactAdded(String accountId, String uri, boolean confirmed) {
Log.d(TAG, "contactAdded: " + accountId + ", " + uri + ", " + confirmed);
Account account = getAccount(accountId);
if (account == null) {
Log.d(TAG, "contactAdded: unknown account" + accountId);
return;
}
account.addContact(uri, confirmed);
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.CONTACT_ADDED);
event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
event.addEventInput(ServiceEvent.EventInput.CONFIRMED, confirmed);
notifyObservers(event);
}
use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class ConferenceService method conferenceRemoved.
void conferenceRemoved(String confId) {
Log.d(TAG, "conference removed: " + confId);
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.CONFERENCE_REMOVED);
event.addEventInput(ServiceEvent.EventInput.CONF_ID, confId);
notifyObservers(event);
}
Aggregations