Make FlutterAppDelegate automatically forward to the FlutterPluginAppLifeCycleDelegate#6259
Make FlutterAppDelegate automatically forward to the FlutterPluginAppLifeCycleDelegate#6259jamesderlin wants to merge 1 commit intoflutter:masterfrom jamesderlin:jamesderlin/appdelegate-forward
FlutterAppDelegate automatically forward to the FlutterPluginAppLifeCycleDelegate#6259Conversation
…AppLifeCycleDelegate` Make `FlutterAppDelegate` try to forward all unhandled messages to its `FlutterPluginAppLifeCycleDelegate` so that it doesn't need to explicitly forward for each application life cycle event (e.g. `applicationDidEnterBackground:`, `applicationWillEnterForeground:`, etc.). This also greatly reduces the amount of code that should be copied and pasted from `FlutterAppDelegate` if client applications cannot directly inherit from it. Alternatively, it provides an example for how client applications can use `FlutterAppDelegate` via composition rather than inheritance (issue #20709).
chinmaygarde
left a comment
There was a problem hiding this comment.
This seems very heavy handed and assumes that FlutterPluginAppLifeCycleDelegate can handle all unhandled (by FlutterAppDelegate) messages that are sent to it (and not just the ones it implements on its own). In general, I am always in favor of being explicit about what each class instead of adding dynamism (unless absolutely necessary). I understand that this might lead to more code in some cases.
|
How about if I replaced I know it doesn't seem like it buys us anything, but the recommendation from https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps is essentially to copy-and-paste the |
|
@chinmaygarde --- do you have feedback on James's last comment above? Thanks! |
|
Closing this since there's some pushback. |
Make
FlutterAppDelegatetry to forward all unhandled messages toits
FlutterPluginAppLifeCycleDelegateso that it doesn't need toexplicitly forward for each application life cycle event (e.g.
applicationDidEnterBackground:,applicationWillEnterForeground:,etc.).
This also greatly reduces the amount of code that should be copied
and pasted from
FlutterAppDelegateif client applications cannotdirectly inherit from it. Alternatively, it provides an example for
how client applications can use
FlutterAppDelegatevia compositionrather than inheritance (issue #20709).
(This is a scaled down version of #6086.)