Send AppLifecycleState notifications on FlutterViewController lifecycle events. (flutter/engine#3801)
This commit is contained in:
@@ -323,7 +323,7 @@ bool Engine::HandleLifecyclePlatformMessage(blink::PlatformMessage* message) {
|
||||
activity_running_ = false;
|
||||
StopAnimator();
|
||||
} else if (state == "AppLifecycleState.resumed" ||
|
||||
state == "AppLifecycle.inactive") {
|
||||
state == "AppLifecycleState.inactive") {
|
||||
activity_running_ = true;
|
||||
StartAnimatorIfPossible();
|
||||
}
|
||||
|
||||
@@ -273,11 +273,19 @@ class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
|
||||
[view release];
|
||||
}
|
||||
|
||||
#pragma mark - UIViewController lifecycle notifications
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[self connectToEngineAndLoad];
|
||||
[super viewWillAppear:animated];
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[_lifecycleChannel.get() sendMessage:@"AppLifecycleState.paused"];
|
||||
|
||||
[super viewDidDisappear];
|
||||
}
|
||||
|
||||
#pragma mark - Application lifecycle notifications
|
||||
|
||||
- (void)applicationBecameActive:(NSNotification*)notification {
|
||||
@@ -533,6 +541,7 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc
|
||||
[self surfaceUpdated:YES];
|
||||
[self onLocaleUpdated:nil];
|
||||
[self onVoiceOverChanged:nil];
|
||||
[_lifecycleChannel.get() sendMessage:@"AppLifecycleState.resumed"];
|
||||
|
||||
[super viewDidAppear:animated];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user