By consolidating all calls to weatherCommand execute in the AppDelegate it becomes much easier to reason about when the command is executing. This made it easier to figure out at which times in the launch cycle we to execute it and how to prevent the command being executed multiple times.
The weather is currently updated when:
in application:didFinishLaunchingWithOptions: if the options dictionary does not contain UIApplicationLaunchOptionsRemoteNotificationKey
in applicationWillEnterForeground
in application:didReceiveRemoteNotification:fetchCompletionHandler:
The first two replace the weather updates in WeatherViewController in response to viewDidLoad and UIApplicationWillEnterForegroundNotification. By moving this into the app delegate we can more easily detect when the application is launched by a remote notification and prevent any weather updates normally done to update the UI.
By consolidating all calls to
weatherCommand execute
in theAppDelegate
it becomes much easier to reason about when the command is executing. This made it easier to figure out at which times in the launch cycle we to execute it and how to prevent the command being executed multiple times.The weather is currently updated when:
application:didFinishLaunchingWithOptions:
if the options dictionary does not containUIApplicationLaunchOptionsRemoteNotificationKey
applicationWillEnterForeground
application:didReceiveRemoteNotification:fetchCompletionHandler:
The first two replace the weather updates in
WeatherViewController
in response toviewDidLoad
andUIApplicationWillEnterForegroundNotification
. By moving this into the app delegate we can more easily detect when the application is launched by a remote notification and prevent any weather updates normally done to update the UI.This PR resolves #184.