Skip to content

Commit 799d455

Browse files
AlbertWang0116Szymon Sobecki
authored and
Szymon Sobecki
committed
Apply the second half of google#1977
PiperOrigin-RevId: 570169149
1 parent a9b5152 commit 799d455

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

AppFramework/AutomationSetup/GREYAutomationSetup.m

+21-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
//
1616

1717
#import "GREYAutomationSetup.h"
18+
#import <Foundation/Foundation.h>
1819

1920
#import "GREYAppleInternals.h"
2021

@@ -24,7 +25,26 @@ @implementation GREYAutomationSetup
2425

2526
+ (void)load {
2627
// Force software keyboard.
27-
[[UIKeyboardImpl sharedInstance] setAutomaticMinimizationEnabled:NO];
28+
static NSArray<NSString *> *legacyTargets;
29+
static dispatch_once_t onceToken;
30+
dispatch_once(&onceToken, ^{
31+
legacyTargets = @[
32+
];
33+
});
34+
BOOL deferKeyboardChange = YES;
35+
NSString *packagePath = NSProcessInfo.processInfo.environment[@"TEST_UNDECLARED_OUTPUTS_DIR"];
36+
for (NSString *legacyTarget in legacyTargets) {
37+
if ([packagePath containsString:legacyTarget]) {
38+
deferKeyboardChange = NO;
39+
}
40+
}
41+
if (deferKeyboardChange) {
42+
dispatch_async(dispatch_get_main_queue(), ^{
43+
[[UIKeyboardImpl sharedInstance] setAutomaticMinimizationEnabled:NO];
44+
});
45+
} else {
46+
[[UIKeyboardImpl sharedInstance] setAutomaticMinimizationEnabled:NO];
47+
}
2848
}
2949

3050
@end

0 commit comments

Comments
 (0)