From e89b0f77a76ac2ee56826c79bc7ac09cad99781c Mon Sep 17 00:00:00 2001 From: ppken <27220367+ppken@users.noreply.github.com> Date: Thu, 7 Nov 2024 07:40:00 +0900 Subject: [PATCH] fix: fix setting name --- WebDriverAgentLib/Categories/XCUIElement+FBTyping.m | 2 +- WebDriverAgentLib/Commands/FBSessionCommands.m | 10 +++++++--- WebDriverAgentLib/Utilities/FBConfiguration.h | 4 ++-- WebDriverAgentLib/Utilities/FBConfiguration.m | 12 ++++++------ WebDriverAgentLib/Utilities/FBSettings.h | 2 +- WebDriverAgentLib/Utilities/FBSettings.m | 2 +- lib/types.ts | 2 +- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m b/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m index 8a3f1f16b..8b59ad031 100644 --- a/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m +++ b/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m @@ -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 diff --git a/WebDriverAgentLib/Commands/FBSessionCommands.m b/WebDriverAgentLib/Commands/FBSessionCommands.m index 320bb5352..e5d4894f5 100644 --- a/WebDriverAgentLib/Commands/FBSessionCommands.m +++ b/WebDriverAgentLib/Commands/FBSessionCommands.m @@ -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; @@ -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 @@ -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 diff --git a/WebDriverAgentLib/Utilities/FBConfiguration.h b/WebDriverAgentLib/Utilities/FBConfiguration.h index 9925bd9df..7c337826c 100644 --- a/WebDriverAgentLib/Utilities/FBConfiguration.h +++ b/WebDriverAgentLib/Utilities/FBConfiguration.h @@ -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 /** diff --git a/WebDriverAgentLib/Utilities/FBConfiguration.m b/WebDriverAgentLib/Utilities/FBConfiguration.m index 3930ddd57..dab8cb4db 100644 --- a/WebDriverAgentLib/Utilities/FBConfiguration.m +++ b/WebDriverAgentLib/Utilities/FBConfiguration.m @@ -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 @@ -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 @@ -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 diff --git a/WebDriverAgentLib/Utilities/FBSettings.h b/WebDriverAgentLib/Utilities/FBSettings.h index 2736e9f57..b1f2f1fca 100644 --- a/WebDriverAgentLib/Utilities/FBSettings.h +++ b/WebDriverAgentLib/Utilities/FBSettings.h @@ -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 diff --git a/WebDriverAgentLib/Utilities/FBSettings.m b/WebDriverAgentLib/Utilities/FBSettings.m index d9fe494a2..ada529eed 100644 --- a/WebDriverAgentLib/Utilities/FBSettings.m +++ b/WebDriverAgentLib/Utilities/FBSettings.m @@ -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"; diff --git a/lib/types.ts b/lib/types.ts index a07f1d88c..82c51cb15 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -25,7 +25,7 @@ export interface WDASettings { waitForIdleTimeout?: number; animationCoolOffTimeout?: number; maxTypingFrequency?: number; - useHIDClear?: boolean; + useClearTextShortcut?: boolean; } // WebDriverAgentLib/Utilities/FBCapabilities.h