Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compat): Set the app delegate viewController for plugins
Some plugins expect to be able to access the applications's CDVViewController via the AppDelegate. While previously we guaranteed that the `viewController` property was set to a non-nil CDVViewController, there was never any guarantee that it was set to the CDVViewController that is actually displaying the app (particularly in cases such as apps using CordovaLib only for a few pages as part of a larger app). We've attempted to deprecate the property here, but some plugins still rely on the assumption that it will be non-nil, so we are trying to maintain compatibility in the common case here by assigning to it when a CDVViewController is loaded. This means there are still times in the app lifecycle where the `viewController` property is nil, but the deprecation warning will hopefully spur plugin developers to move away from that pattern. Note: CDVPlugin always has a non-nil viewController property of its own, which is set to the CDVViewController instance the plugin was loaded into. This is almost always the better choice for plugins to use.
- Loading branch information