updateUserTalkingState method

void updateUserTalkingState(
  1. String userId,
  2. bool isTalking,
  3. RxList<UserModel> destList,
  4. int volume,
)

Implementation

void updateUserTalkingState(
    String userId, bool isTalking, RxList<UserModel> destList, int volume) {
  var index = getUserIndex(userId, destList);
  if (index == -1) {
    return;
  }
  if (!destList[index].hasAudioStream.value) {
    destList[index].isTalking.value = false;
    return;
  }
  destList[index].isTalking.value = isTalking;
  destList[index].volume.value = volume;

  if (userId == currentUser.userId.value) {
    currentUser.volume.value = volume;
  }
}