UA uses Terminal 3, while AC uses Terminal 1. You'll need to take the AirTrain over, and reclear security. 50 minutes will be tight.
But if you miss your connection UA/AC will find a way to get you to Shanghai. Maybe the same day, may be the next. If this is a leisure trip and if AC allows this connection, then the $100 may be worth it. But if you have a job interview or important contract to sign, then no...