By this article, we continue studying weak polyelectrolyte hydrogels and their application as a desalination agent. We modeled the desalination process as a four-step reversible thermodynamic cycle transferring ions from a low salinity solution to a high salinity one. The cycle implies reversibility at any stage, therefore the method can achieve the maximum thermodynamic efficiency, comparable to the reverse osmosis. As a driving force for ions movement, we use the fact that compression of the gel leads to a decrease in the gel ionization degree, and therefore to a release of ions entrapped in the gel. We considered the gel composed of ionogenic units modified by hydrophobic pendants and showed that this modification significantly increases the number of transferred ions. This increase is caused by a first-order phase transition originated from an interplay between repulsive electrostatic and attractive steric interactions. The transition happens during hydrogel compression. At a certain pressure, the gel collapses abruptly, changing its volume almost to that of a dry state, and releases almost all ions collected inside. Employing the phase transition allows us to model the desalination cycle, which transfers a much larger number of ions and works at rather low pressures <10bar.