wordpress-mobile/WordPress-iOS — pull request #1000 by astralbodies (2014-01-03 15:11:48+00:00)
Title: Fix a number of push notification issues

Fixes #961

Still can't reproduce the problem with credentials being lost on the device after a background push was received. Discovered a number of problems with push, however, and have resolved them in this PR.

1. Background pushes should not be updating the UI (if possible) since we also refresh data when the UI is presented for notifications.
1. Background pushes have the ability to launch the app in iOS 7 - with the side effect of that push being sent through the options dictionary. The UI is now not updated in that case.
1. When we unregister a device with our backend push server we should really also be unregistering with Apple's push network.
1. All of our launch work was being done in willFinishLaunchingWithOptions - UI work should really be done in didFinishLaunchingWithOptions. Moved the key window call and notification handling to the delegate method called after the app is running.
1. WordPress.com API was not calling unregister for push when logging out the main WP.com account. Probably shouldn't be handled in the API since we're going to make it a Pod but it can't be eliminated from this release. Marked as a FIXME.