Problem for claim reward and swap ETH

Hello everyone, I want to create a token based on rewards. I am helped by the following contract which uses _rOwned and _tOwned (I put below the functions which are different from this contract and which are the source of my problems). My goal is that the rewards are not added to the wallet but can be claimed (in ETH in particular). balanceOf will return the _tOwned balance and the claim rewards will be calculated by the _rOwned - _tOwned balance. A user can find out how many rewards they have with "rewardToClaim".

For fees, there is a 10% fee on each transaction, which is sent to address(this). To claim its rewards, it will then be necessary for address(this) to send the amount to the user who calls the function.

Here are my problems:

With each transaction, the fees are sent to address(this), I would like to send them in ETH but it doesn't seem to work… (see code in the _transfer function).
I managed (with another contract that does not use rewards only fees) to swap the tokens of address(this) to ETH, but I failed to claim this amount (transfer from address( this) to msg.sender)

The main error I encounter is “TRANSFER_FROM_FAILED”
In view of the tests I performed I think that the _transfer() function may be the source of the problem, however I do not understand why.

Thank you very much for your help !

function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) private {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");
        require(amount > 0, "Transfer amount must be greater than zero");

        bool takeFee = true;

        if (_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]) {
            takeFee = false;
        _tokenTransfer(sender, recipient, amount, takeFee);

    function _tokenTransfer(
        address sender,
        address recipient,
        uint256 amount,
        bool takeFee
    ) private {
        if (!takeFee) removeAllFee();
            uint256 rAmount,
            uint256 rTransferAmount,
            uint256 rFee,
            uint256 tTransferAmount,
            uint256 tFee
        ) = _getValues(amount);

        _tOwned[sender] = _tOwned[sender] - (amount);
        _rOwned[sender] = _rOwned[sender] - (rAmount);
        _tOwned[recipient] = _tOwned[recipient] + (tTransferAmount);
        _rOwned[recipient] = _rOwned[recipient] + (rTransferAmount);
        if (takeFee) {
            _tOwned[address(this)] += tFee;
            emit Transfer(sender, address(this), tFee);
        _reflectFee(rFee, tFee);
        emit Transfer(sender, recipient, tTransferAmount);
        if (!takeFee) restoreAllFee();

    function swapTokensForEth(uint256 tokenAmount) private {
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = uniswapV2Router.WETH();
        _approve(address(this), address(uniswapV2Router), tokenAmount);

            0, // accept any amount of ETH

    function claim() external payable {
        uint amountToClaim = rewards[msg.sender].rewardToClaimInETH;
        require(msg.value <= amountToClaim, "Amount too high");
        (bool success, ) ={
            value: IERC20(uniswapV2Router.WETH()).balanceOf(address(this))
        require(success, "Transfer failed.");
        rewards[msg.sender].rewardClaimed += amountToClaim; 

Please provide all the relevant details (and only the relevant details).

I @barakman thank you for your answers, what details do you need ?