Skip to content

Commit

Permalink
fix: fix setting name
Browse files Browse the repository at this point in the history
  • Loading branch information
ppken committed Nov 6, 2024
1 parent 35afc8f commit e89b0f7
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion WebDriverAgentLib/Categories/XCUIElement+FBTyping.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ - (BOOL)fb_clearTextWithSnapshot:(FBXCElementSnapshotWrapper *)snapshot
[self fb_prepareForTextInputWithSnapshot:snapshot];
}

if (retry == 0 && FBConfiguration.useHIDClear) {
if (retry == 0 && FBConfiguration.useClearTextShortcut) {
// 1st attempt is via the IOHIDEvent as the fastest operation
// https://github.com/appium/appium/issues/19389
[[XCUIDevice sharedDevice] fb_performIOHIDEventWithPage:0x07 // kHIDPage_KeyboardOrKeypad
Expand Down
10 changes: 7 additions & 3 deletions WebDriverAgentLib/Commands/FBSessionCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ + (NSArray *)routes
[FBConfiguration forceSimulatorSoftwareKeyboardPresence];
}

if (capabilities[FB_SETTING_USE_CLEAR_TEXT_SHORTCUT]) {
[FBConfiguration setUseClearTextShortcut:[capabilities[FB_SETTING_USE_CLEAR_TEXT_SHORTCUT] boolValue]];
}

NSString *bundleID = capabilities[FB_CAP_BUNDLE_ID];
NSString *initialUrl = capabilities[FB_CAP_INITIAL_URL];
XCUIApplication *app = nil;
Expand Down Expand Up @@ -351,7 +355,7 @@ + (NSArray *)routes
FB_SETTING_DEFAULT_ALERT_ACTION: request.session.defaultAlertAction ?: @"",
FB_SETTING_MAX_TYPING_FREQUENCY: @([FBConfiguration maxTypingFrequency]),
FB_SETTING_RESPECT_SYSTEM_ALERTS: @([FBConfiguration shouldRespectSystemAlerts]),
FB_SETTING_USE_HID_CLEAR: @([FBConfiguration useHIDClear]),
FB_SETTING_USE_CLEAR_TEXT_SHORTCUT: @([FBConfiguration useClearTextShortcut]),
#if !TARGET_OS_TV
FB_SETTING_SCREENSHOT_ORIENTATION: [FBConfiguration humanReadableScreenshotOrientation],
#endif
Expand Down Expand Up @@ -450,8 +454,8 @@ + (NSArray *)routes
if (nil != [settings objectForKey:FB_SETTING_MAX_TYPING_FREQUENCY]) {
[FBConfiguration setMaxTypingFrequency:[[settings objectForKey:FB_SETTING_MAX_TYPING_FREQUENCY] unsignedIntegerValue]];
}
if (nil != [settings objectForKey:FB_SETTING_USE_HID_CLEAR]) {
[FBConfiguration setUseHIDClear:[[settings objectForKey:FB_SETTING_USE_HID_CLEAR] boolValue]];
if (nil != [settings objectForKey:FB_SETTING_USE_CLEAR_TEXT_SHORTCUT]) {
[FBConfiguration setUseClearTextShortcut:[[settings objectForKey:FB_SETTING_USE_CLEAR_TEXT_SHORTCUT] boolValue]];
}

#if !TARGET_OS_TV
Expand Down
4 changes: 2 additions & 2 deletions WebDriverAgentLib/Utilities/FBConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ typedef NS_ENUM(NSInteger, FBConfigurationKeyboardPreference) {
*
* @param enabled Either YES or NO
*/
+ (void)setUseHIDClear:(BOOL)enabled;
+ (BOOL)useHIDClear;
+ (void)setUseClearTextShortcut:(BOOL)enabled;
+ (BOOL)useClearTextShortcut;

#if !TARGET_OS_TV
/**
Expand Down
12 changes: 6 additions & 6 deletions WebDriverAgentLib/Utilities/FBConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
static NSTimeInterval FBAnimationCoolOffTimeout;
static BOOL FBShouldUseCompactResponses;
static NSString *FBElementResponseAttributes;
static BOOL FBUseHIDClear;
static BOOL FBUseClearTextShortcut;
#if !TARGET_OS_TV
static UIInterfaceOrientation FBScreenshotOrientation;
#endif
Expand Down Expand Up @@ -439,14 +439,14 @@ + (NSString *)dismissAlertButtonSelector
return FBDismissAlertButtonSelector;
}

+ (void)setUseHIDClear:(BOOL)enabled
+ (void)setUseClearTextShortcut:(BOOL)enabled
{
FBUseHIDClear = enabled;
FBUseClearTextShortcut = enabled;
}

+ (BOOL)useHIDClear
+ (BOOL)useClearTextShortcut
{
return FBUseHIDClear;
return FBUseClearTextShortcut;
}

#if !TARGET_OS_TV
Expand Down Expand Up @@ -514,7 +514,7 @@ + (void)resetSessionSettings
FBAnimationCoolOffTimeout = 2.;
// 50 should be enough for the majority of the cases. The performance is acceptable for values up to 100.
FBSetCustomParameterForElementSnapshot(FBSnapshotMaxDepthKey, @50);
FBUseHIDClear = YES;
FBUseClearTextShortcut = YES;
#if !TARGET_OS_TV
FBScreenshotOrientation = UIInterfaceOrientationUnknown;
#endif
Expand Down
2 changes: 1 addition & 1 deletion WebDriverAgentLib/Utilities/FBSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extern NSString* const FB_SETTING_WAIT_FOR_IDLE_TIMEOUT;
extern NSString* const FB_SETTING_ANIMATION_COOL_OFF_TIMEOUT;
extern NSString* const FB_SETTING_MAX_TYPING_FREQUENCY;
extern NSString* const FB_SETTING_RESPECT_SYSTEM_ALERTS;
extern NSString* const FB_SETTING_USE_HID_CLEAR;
extern NSString* const FB_SETTING_USE_CLEAR_TEXT_SHORTCUT;


NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion WebDriverAgentLib/Utilities/FBSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
NSString* const FB_SETTING_ANIMATION_COOL_OFF_TIMEOUT = @"animationCoolOffTimeout";
NSString* const FB_SETTING_MAX_TYPING_FREQUENCY = @"maxTypingFrequency";
NSString* const FB_SETTING_RESPECT_SYSTEM_ALERTS = @"respectSystemAlerts";
NSString* const FB_SETTING_USE_HID_CLEAR = @"useHIDClear";
NSString* const FB_SETTING_USE_CLEAR_TEXT_SHORTCUT = @"useClearTextShortcut";
2 changes: 1 addition & 1 deletion lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface WDASettings {
waitForIdleTimeout?: number;
animationCoolOffTimeout?: number;
maxTypingFrequency?: number;
useHIDClear?: boolean;
useClearTextShortcut?: boolean;
}

// WebDriverAgentLib/Utilities/FBCapabilities.h
Expand Down

0 comments on commit e89b0f7

Please sign in to comment.