Skip to content

Commit 32a676d

Browse files
committed
move addButtonsIfAvailable, restore headers
1 parent 8f4c7bd commit 32a676d

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ typedef NS_ENUM(NSUInteger, FBUIInterfaceAppearance) {
9595
*/
9696
- (BOOL)fb_openUrl:(NSString *)url withApplication:(NSString *)bundleId error:(NSError **)error;
9797

98+
/**
99+
Checks if the device has a specific hardware button available.
100+
101+
@param buttonName The name of the button to check (e.g., "home", "volumeUp", "volumeDown", "action", "camera")
102+
@return YES if the button is available on the device, otherwise NO
103+
*/
104+
- (BOOL)fb_hasButton:(NSString *)buttonName;
105+
98106
/**
99107
Presses the corresponding hardware button on the device with duration.
100108

WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,6 @@ - (BOOL)fb_hasButton:(NSString *)buttonName
244244
return NO;
245245
}
246246

247-
- (void)fb_addButtonsIfAvailable:(NSArray<NSString *> *)buttonNames
248-
toSupportedButtonNames:(NSMutableArray<NSString *> *)supportedButtonNames
249-
{
250-
for (NSString *buttonName in buttonNames) {
251-
if ([self fb_hasButton:buttonName]) {
252-
[supportedButtonNames addObject:buttonName];
253-
}
254-
}
255-
}
256-
257247
- (BOOL)fb_pressButton:(NSString *)buttonName
258248
forDuration:(nullable NSNumber *)duration
259249
error:(NSError **)error
@@ -440,4 +430,14 @@ - (BOOL)fb_clearSimulatedLocation:(NSError **)error
440430
}
441431
#endif
442432

433+
- (void)fb_addButtonsIfAvailable:(NSArray<NSString *> *)buttonNames
434+
toSupportedButtonNames:(NSMutableArray<NSString *> *)supportedButtonNames
435+
{
436+
for (NSString *buttonName in buttonNames) {
437+
if ([self fb_hasButton:buttonName]) {
438+
[supportedButtonNames addObject:buttonName];
439+
}
440+
}
441+
}
442+
443443
@end

0 commit comments

Comments
 (0)