updateUserMessageState method

void updateUserMessageState(
  1. String userId,
  2. bool isDisable,
  3. RxList<UserModel> destList
)

Implementation

void updateUserMessageState(
    String userId, bool isDisable, RxList<UserModel> destList) {
  var index = getUserIndex(userId, destList);
  if (index == -1) {
    return;
  }
  destList[index].ableSendingMessage.value = !isDisable;

  if (userId == currentUser.userId.value) {
    currentUser.ableSendingMessage.value = !isDisable;
    if (isDisable) {
      makeToast(
          msg: RoomContentsTranslations.translate(
              'messageTurnedOffByHostToast'));
    } else {
      makeToast(
          msg: RoomContentsTranslations.translate(
              'messageTurnedOnByHostToast'));
    }
  }
}