// region Method called after friend request returns success
 private void completeFriends(List<BaasUser> f) {
   // Convert all received user profiles to local objects and store them
   for (BaasUser u : f) {
     Acquaintance a = new Acquaintance(u);
     model.getFriends().add(a);
     Log.d(LOG_TAG, "Added friends to list.");
   }
   if (friendRT == null && eventRT == null && groupRT == null && cloudRT == null) {
     launchMainActivity();
   }
 }
示例#2
0
 @Subscribe
 public void onP2PConnectionEvent(P2PConnectionEvent e) {
   if (e.isConnected()) {
     // resend invites
     Friends friends = model.getFriends();
     ArrayList<String> pendingInvites = new ArrayList<String>(model.getPendingInvites());
     for (String email : pendingInvites) {
       log.info("Resending pending invite to {}", email);
       Friend friend = friends.get(email);
       xmppHandler.sendInvite(friend, true);
     }
   }
 }
示例#3
0
 public void invite(Friend friend) {
   String email = friend.getEmail();
   try {
     if (xmppHandler.sendInvite(friend, false)) {
       // we need to mark this email as pending, in case
       // our invite gets lost.
       model.addPendingInvite(email);
     }
   } catch (Exception e) {
     log.debug("failed to send invite: ", e);
     model.addPendingInvite(email);
   }
   Events.sync(SyncPath.FRIENDS, model.getFriends().getFriends());
 }