Skip to content

Commit

Permalink
fix: Use monitoredApplicationWithProcessIdentifier API to fetch appli…
Browse files Browse the repository at this point in the history
…cation objects from PID
  • Loading branch information
mykola-mokhnach committed Sep 22, 2023
1 parent 2470883 commit 5e7cb6a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
8 changes: 4 additions & 4 deletions WebDriverAgentLib/FBApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ + (instancetype)fb_activeApplication
NSMutableArray<FBApplication *> *result = [NSMutableArray array];
if (activeApplicationElements.count > 0) {
for (id<FBXCAccessibilityElement> applicationElement in activeApplicationElements) {
FBApplication *app = [FBApplication fb_applicationWithPID:applicationElement.processIdentifier];
FBApplication *app = [FBApplication applicationWithPID:applicationElement.processIdentifier];
if (nil != app) {
[result addObject:app];
}
Expand Down Expand Up @@ -107,7 +107,7 @@ + (instancetype)fb_activeApplicationWithDefaultBundleId:(nullable NSString *)bun
}

if (nil != activeApplicationElement) {
FBApplication *application = [FBApplication fb_applicationWithPID:activeApplicationElement.processIdentifier];
FBApplication *application = [FBApplication applicationWithPID:activeApplicationElement.processIdentifier];
if (nil != application) {
return application;
}
Expand All @@ -117,7 +117,7 @@ + (instancetype)fb_activeApplicationWithDefaultBundleId:(nullable NSString *)bun
if (activeApplicationElements.count > 0) {
[FBLogger logFmt:@"Getting the most recent active application (out of %@ total items)", @(activeApplicationElements.count)];
for (id<FBXCAccessibilityElement> appElement in activeApplicationElements) {
FBApplication *application = [FBApplication fb_applicationWithPID:appElement.processIdentifier];
FBApplication *application = [FBApplication applicationWithPID:appElement.processIdentifier];
if (nil != application) {
return application;
}
Expand All @@ -130,7 +130,7 @@ + (instancetype)fb_activeApplicationWithDefaultBundleId:(nullable NSString *)bun

+ (instancetype)fb_systemApplication
{
return [self fb_applicationWithPID:
return [self applicationWithPID:
[[FBXCAXClientProxy.sharedClient systemApplication] processIdentifier]];
}

Expand Down
2 changes: 0 additions & 2 deletions WebDriverAgentLib/Utilities/FBXCodeCompatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ extern NSString *const FBApplicationMethodNotSupportedException;

@interface XCUIApplication (FBCompatibility)

+ (nullable instancetype)fb_applicationWithPID:(pid_t)processID;

/**
Get the state of the application. This method only returns reliable results on Xcode SDK 9+
Expand Down
9 changes: 0 additions & 9 deletions WebDriverAgentLib/Utilities/FBXCodeCompatibility.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@

@implementation XCUIApplication (FBCompatibility)

+ (instancetype)fb_applicationWithPID:(pid_t)processID
{
if (0 == processID) {
return nil;
}

return [self applicationWithPID:processID];
}

- (void)fb_activate
{
[self activate];
Expand Down

0 comments on commit 5e7cb6a

Please sign in to comment.