Commit e6624b76 authored by yangwu.jia's avatar yangwu.jia

Merge branch 'flutter_1.5_upgrade_opt' into v1.5.4-hotfixes

parents 58e7b94b b4079775
......@@ -130,7 +130,7 @@ Initialize FlutterBoost with FLBPlatform at the beginning of your App.
```objc
[FlutterBoostPlugin.sharedInstance startFlutterWithPlatform:router
onStart:^(FlutterViewController *fvc) {
onStart:^(id engine) {
}];
```
......
......@@ -123,7 +123,7 @@ class _MyAppState extends State<MyApp> {
```的ObjectiveC
[FlutterBoostPlugin.sharedInstance startFlutterWithPlatform:router
onStart:^(FlutterViewController * fvc){
onStart:^(id engine){
}];
```
......
......@@ -76,13 +76,24 @@
_manager = [FLB2FlutterContainerManager new];
_pageResultCallbacks = NSMutableDictionary.new;
_callbackCache = NSMutableDictionary.new;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationWillEnterForeground:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidEnterBackground:)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
}
return self;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
}
- (UIView *)flutterView
......@@ -90,6 +101,13 @@
return [self flutterViewController].view;
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
[self.viewProvider didEnterBackground];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
[self.viewProvider willEnterForeground];
}
- (BOOL)contains:(id<FLBFlutterContainer>)vc
{
......
......@@ -25,6 +25,7 @@
#import "FLB2FlutterEngine.h"
#import <Flutter/Flutter.h>
#import "FLB2FlutterViewContainer.h"
#import "BoostMessageChannel.h"
@interface FLB2FlutterEngine()
......@@ -87,6 +88,17 @@
}
- (void)didEnterBackground
{
[BoostMessageChannel sendEvent:@"background"
arguments:nil];
}
- (void)willEnterForeground
{
[BoostMessageChannel sendEvent:@"foreground"
arguments:nil];
}
- (FlutterEngine *)engine
{
......
......@@ -37,5 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)pause;
- (void)resume;
- (void)inactive;
- (void)didEnterBackground;
- (void)willEnterForeground;
@end
NS_ASSUME_NONNULL_END
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment