getFriendListOfUser static method

FriendList getFriendListOfUser(
  1. LocalityUser receivingUser
)

Return the friendlist by topic for the user id and ensures no multiple FriendLists are used for the same topic

Implementation

static FriendList getFriendListOfUser(LocalityUser receivingUser) {
  String topic = getTopicOfFriendListOfUser(receivingUser.id);

  if (!friendListByTopic.containsKey(topic)) {
    FriendList friendListOfReceivingUser = FriendList(receivingUser);
    friendListByTopic[topic] = friendListOfReceivingUser;
    LocalitySocialCloud.supervise(friendListOfReceivingUser);
    return friendListOfReceivingUser;
  } else {
    return friendListByTopic[topic]!;
  }
}