Search in sources :

Example 21 with Uri

use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.

the class SmartListPresenter method subscribePresence.

private void subscribePresence() {
    if (mAccountService.getCurrentAccount() == null || mSmartListViewModels == null || mSmartListViewModels.isEmpty()) {
        return;
    }
    String accountId = mAccountService.getCurrentAccount().getAccountID();
    for (SmartListViewModel smartListViewModel : mSmartListViewModels) {
        String ringId = smartListViewModel.getUuid();
        Uri uri = new Uri(ringId);
        if (uri.isRingId()) {
            mPresenceService.subscribeBuddy(accountId, ringId, true);
        } else {
            Log.i(TAG, "Trying to subscribe to an invalid uri " + ringId);
        }
    }
}
Also used : Uri(cx.ring.model.Uri)

Example 22 with Uri

use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.

the class ContactRequestsPresenter method contactRequestClicked.

public void contactRequestClicked(String contactId) {
    String rawUriString = new Uri(contactId).getRawUriString();
    getView().goToConversation(mAccountService.getCurrentAccount().getAccountID(), rawUriString);
}
Also used : Uri(cx.ring.model.Uri)

Example 23 with Uri

use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.

the class ConversationFacade method parseHistoryCalls.

private void parseHistoryCalls(List<HistoryCall> historyCalls, boolean acceptAllMessages) {
    for (HistoryCall call : historyCalls) {
        CallContact contact = mContactService.findContact(call.getContactID(), call.getContactKey(), new Uri(call.getNumber()));
        String key = contact.getIds().get(0);
        String phone = contact.getPhones().get(0).getNumber().getRawUriString();
        if (mConversationMap.containsKey(key) || mConversationMap.containsKey(phone)) {
            mConversationMap.get(key).addHistoryCall(call);
        } else if (acceptAllMessages) {
            Conversation conversation = new Conversation(contact);
            conversation.addHistoryCall(call);
            mConversationMap.put(key, conversation);
        }
    }
}
Also used : Conversation(cx.ring.model.Conversation) Uri(cx.ring.model.Uri) CallContact(cx.ring.model.CallContact) HistoryCall(cx.ring.model.HistoryCall)

Example 24 with Uri

use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.

the class ConversationFacade method startConversation.

/**
 * @return the started new conversation
 */
public Conversation startConversation(CallContact contact) {
    Conversation conversation = getConversationByContact(contact);
    if (conversation == null) {
        conversation = new Conversation(contact);
        mConversationMap.put(contact.getIds().get(0), conversation);
        Account account = mAccountService.getCurrentAccount();
        if (account != null && account.isRing()) {
            Uri number = contact.getPhones().get(0).getNumber();
            if (number.isRingId()) {
                mAccountService.lookupAddress(account.getAccountID(), "", number.getRawRingId());
            }
        }
        setChanged();
        ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.CONVERSATIONS_CHANGED);
        notifyObservers(event);
        updateTextNotifications();
    }
    return conversation;
}
Also used : Account(cx.ring.model.Account) ServiceEvent(cx.ring.model.ServiceEvent) Conversation(cx.ring.model.Conversation) Uri(cx.ring.model.Uri)

Aggregations

Uri (cx.ring.model.Uri)24 CallContact (cx.ring.model.CallContact)7 Account (cx.ring.model.Account)6 Conversation (cx.ring.model.Conversation)5 Intent (android.content.Intent)3 ServiceEvent (cx.ring.model.ServiceEvent)3 TextMessage (cx.ring.model.TextMessage)3 ContentResolver (android.content.ContentResolver)2 Cursor (android.database.Cursor)2 HistoryCall (cx.ring.model.HistoryCall)2 HistoryText (cx.ring.model.HistoryText)2 SipCall (cx.ring.model.SipCall)2 NameLookupInputHandler (cx.ring.utils.NameLookupInputHandler)2 ArrayList (java.util.ArrayList)2 PendingIntent (android.app.PendingIntent)1 ContentValues (android.content.ContentValues)1 SharedPreferences (android.content.SharedPreferences)1 Bitmap (android.graphics.Bitmap)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 NotificationCompat (android.support.v4.app.NotificationCompat)1