Fix iOS keyboard physical keyboard doesn't work in add to app (flutter/engine#32098)

This commit is contained in:
xiaoxiaowesley
2022-03-18 22:10:09 +08:00
committed by GitHub
parent d8673830fd
commit 24fd333ce6
2 changed files with 14 additions and 3 deletions

View File

@@ -656,14 +656,14 @@ static void SendFakeTouchEvent(FlutterEngine* engine,
TRACE_EVENT0("flutter", "viewDidLoad");
if (_engine && _engineNeedsLaunch) {
// Register internal plugins before starting the engine.
[self addInternalPlugins];
[_engine.get() launchEngine:nil libraryURI:nil entrypointArgs:nil];
[_engine.get() setViewController:self];
_engineNeedsLaunch = NO;
}
// Register internal plugins.
[self addInternalPlugins];
if ([_engine.get() viewController] == self) {
[_engine.get() attachView];
}

View File

@@ -420,6 +420,17 @@ typedef enum UIAccessibilityContrast : NSInteger {
}
}
// Regression test for https://github.com/flutter/engine/pull/32098.
- (void)testInternalPluginsInvokeInViewDidLoad {
FlutterEngine* mockEngine = OCMPartialMock([[FlutterEngine alloc] init]);
[mockEngine createShell:@"" libraryURI:@"" initialRoute:nil];
FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:mockEngine
nibName:nil
bundle:nil];
[viewController viewDidLoad];
OCMVerify([viewController addInternalPlugins]);
}
- (void)testBinaryMessenger {
FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:self.mockEngine
nibName:nil