Revert "Fix iOS password autofill prompt dismissal causes layout to resize (#50364)" (flutter/engine#50760)
This reverts commit 5f93393312.
Reverts https://github.com/flutter/engine/pull/50364
fixes https://github.com/flutter/flutter/issues/143642
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*
*List which issues are fixed by this PR. You must list at least one issue.*
*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
@@ -1520,15 +1520,6 @@ static flutter::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch)
|
||||
BOOL keyboardAnimationIsCompounding =
|
||||
self.keyboardAnimationIsShowing == keyboardWillShow && _keyboardAnimationVSyncClient != nil;
|
||||
|
||||
// Avoid triggering startKeyBoardAnimation when keyboard notifications are triggered
|
||||
// by the dismissal of password autofill prompt. When this happens, there is
|
||||
// no keyboard on the screen and FlutterTextInputViewAccessibilityHider is nil.
|
||||
FlutterTextInputPlugin* textInputPlugin = self.engine.textInputPlugin;
|
||||
UIView* textInputHider = [[textInputPlugin textInputView] superview];
|
||||
if (keyboardWillShow && textInputHider == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark keyboard as showing or hiding.
|
||||
self.keyboardAnimationIsShowing = keyboardWillShow;
|
||||
|
||||
|
||||
@@ -305,18 +305,6 @@ extern NSNotificationName const FlutterViewControllerWillDealloc;
|
||||
FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine
|
||||
nibName:nil
|
||||
bundle:nil];
|
||||
FlutterMethodCall* setClientCall =
|
||||
[FlutterMethodCall methodCallWithMethodName:@"TextInput.setClient"
|
||||
arguments:@[ @(123), @{@"autocorrect" : @YES} ]];
|
||||
[engine.textInputPlugin handleMethodCall:setClientCall
|
||||
result:^(id _Nullable result){
|
||||
}];
|
||||
|
||||
// Check if FlutterTextInputViewAccessibilityHider exists.
|
||||
FlutterTextInputPlugin* textInputPlugin = engine.textInputPlugin;
|
||||
UIView* textInputHider = [[textInputPlugin textInputView] superview];
|
||||
XCTAssertNotNil(textInputHider);
|
||||
|
||||
FlutterViewController* viewControllerMock = OCMPartialMock(viewController);
|
||||
UIScreen* screen = [self setUpMockScreen];
|
||||
CGRect viewFrame = screen.bounds;
|
||||
@@ -2200,46 +2188,4 @@ extern NSNotificationName const FlutterViewControllerWillDealloc;
|
||||
XCTAssertNil(viewController.keyboardAnimationVSyncClient);
|
||||
}
|
||||
|
||||
- (void)testAvoidKeyboardAnimationWhenFlutterTextInputViewAccessibilityHiderIsNil {
|
||||
FlutterEngine* engine = [[FlutterEngine alloc] init];
|
||||
[engine runWithEntrypoint:nil];
|
||||
FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine
|
||||
nibName:nil
|
||||
bundle:nil];
|
||||
|
||||
FlutterViewController* viewControllerMock = OCMPartialMock(viewController);
|
||||
UIScreen* screen = [self setUpMockScreen];
|
||||
CGRect viewFrame = screen.bounds;
|
||||
[self setUpMockView:viewControllerMock
|
||||
screen:screen
|
||||
viewFrame:viewFrame
|
||||
convertedFrame:viewFrame];
|
||||
|
||||
CGFloat screenHeight = screen.bounds.size.height;
|
||||
CGFloat screenWidth = screen.bounds.size.height;
|
||||
|
||||
// Check if FlutterTextInputViewAccessibilityHider is nil.
|
||||
FlutterTextInputPlugin* textInputPlugin = engine.textInputPlugin;
|
||||
UIView* textInputHider = [[textInputPlugin textInputView] superview];
|
||||
XCTAssertNil(textInputHider);
|
||||
|
||||
// Start show keyboard animation.
|
||||
CGRect showKeyboardBeginFrame = CGRectMake(0, screenHeight, screenWidth, 250);
|
||||
CGRect showKeyboardEndFrame = CGRectMake(0, screenHeight - 250, screenWidth, 250);
|
||||
NSNotification* fakeNotification =
|
||||
[NSNotification notificationWithName:UIKeyboardWillChangeFrameNotification
|
||||
object:nil
|
||||
userInfo:@{
|
||||
@"UIKeyboardFrameBeginUserInfoKey" : @(showKeyboardBeginFrame),
|
||||
@"UIKeyboardFrameEndUserInfoKey" : @(showKeyboardEndFrame),
|
||||
@"UIKeyboardAnimationDurationUserInfoKey" : @(0.25),
|
||||
@"UIKeyboardIsLocalUserInfoKey" : @(YES)
|
||||
}];
|
||||
|
||||
viewControllerMock.targetViewInsetBottom = 0;
|
||||
[viewControllerMock handleKeyboardNotification:fakeNotification];
|
||||
BOOL isShowingAnimation = viewControllerMock.keyboardAnimationIsShowing;
|
||||
XCTAssertFalse(isShowingAnimation);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user