Drops detached message until we can handle it properly (#45430)

This commit is contained in:
chunhtai
2019-11-22 16:10:46 -08:00
committed by GitHub
parent 54aa53ab2e
commit f15f69a8b8
2 changed files with 13 additions and 0 deletions

View File

@@ -338,6 +338,11 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
}
Future<String> _handleLifecycleMessage(String message) async {
// TODO(chunhtai): remove the workaround once the issue is fixed
// https://github.com/flutter/flutter/issues/39832
if (message == 'AppLifecycleState.detached')
return null;
handleAppLifecycleStateChanged(_parseAppLifecycleMessage(message));
return null;
}

View File

@@ -67,6 +67,14 @@ void main() {
message = const StringCodec().encodeMessage('AppLifecycleState.inactive');
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
expect(observer.lifecycleState, AppLifecycleState.inactive);
message = const StringCodec().encodeMessage('AppLifecycleState.detached');
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
// TODO(chunhtai): this should be detached once the issue is fixed
// https://github.com/flutter/flutter/issues/39832
// The binding drops detached message for now.
expect(observer.lifecycleState, AppLifecycleState.inactive);
});
testWidgets('didPushRoute callback', (WidgetTester tester) async {