Note that this abusive behavior on the part of CBP was happening all through "the most transparent administration in history", so it's not about Trump. I don't see it getting any better under the current administration, however.
This article suggests
never bringing your phone on an international flight again. Since I regularly back my phone up (as should everyone) my current plan for maximum convenience is simply to restore it to factory settings on my way back into the country, then restore it later. I also, as a backup, have the phone set to wipe itself after 10 failed tries. The inconvenient part is that now I need to consider shipping my laptop back to me rather than carry it on the plane. It's not that there are any data on my phone or computer that I have to worry about, but the fact that the government could use them to hijack the keys to my digital life. I suppose I could commit to resetting my passwords to everything as soon as I get home. Having 1Password at least makes this an option.
But why should I have to even think about unconstitutional search and seizure at the border in the first place?