Skip to content

Commit f1f9976

Browse files
fix: Address compilation warnings (#1143)
1 parent 3b78b0e commit f1f9976

23 files changed

Lines changed: 162 additions & 119 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
build/
1010
clang/
1111
DerivedData
12+
wdaBuild/
1213

1314
## Various settings
1415
*.pbxuser

WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ - (BOOL)fb_openUrl:(NSString *)url error:(NSError **)error
232232
NSString *description = [NSString stringWithFormat:@"Cannot open '%@' with the default application assigned for it. Consider upgrading to Xcode 14.3+/iOS 16.4+", url];
233233
return [[[FBErrorBuilder builder]
234234
withDescriptionFormat:@"%@", description]
235-
buildError:error];;
235+
buildError:error];
236236
}
237237

238238
- (BOOL)fb_openUrl:(NSString *)url withApplication:(NSString *)bundleId error:(NSError **)error

WebDriverAgentLib/Categories/XCUIDevice+FBRotation.m

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,38 @@ - (BOOL)fb_setDeviceRotation:(NSDictionary *)rotationObj
3030
if (keysForRotationObj.count == 0) {
3131
return NO;
3232
}
33-
NSInteger orientation = keysForRotationObj.firstObject.integerValue;
33+
UIDeviceOrientation orientation = (UIDeviceOrientation)keysForRotationObj.firstObject.integerValue;
3434
XCUIApplication *application = XCUIApplication.fb_activeApplication;
3535
[XCUIDevice sharedDevice].orientation = orientation;
3636
return [self waitUntilInterfaceIsAtOrientation:orientation application:application];
3737
}
3838

39-
- (BOOL)waitUntilInterfaceIsAtOrientation:(NSInteger)orientation application:(XCUIApplication *)application
39+
static UIInterfaceOrientation FBInterfaceOrientationFromDeviceOrientation(UIDeviceOrientation orientation)
40+
{
41+
switch (orientation) {
42+
case UIDeviceOrientationPortrait:
43+
return UIInterfaceOrientationPortrait;
44+
case UIDeviceOrientationPortraitUpsideDown:
45+
return UIInterfaceOrientationPortraitUpsideDown;
46+
case UIDeviceOrientationLandscapeLeft:
47+
return UIInterfaceOrientationLandscapeRight;
48+
case UIDeviceOrientationLandscapeRight:
49+
return UIInterfaceOrientationLandscapeLeft;
50+
case UIDeviceOrientationUnknown:
51+
case UIDeviceOrientationFaceUp:
52+
case UIDeviceOrientationFaceDown:
53+
default:
54+
return UIInterfaceOrientationUnknown;
55+
}
56+
}
57+
58+
- (BOOL)waitUntilInterfaceIsAtOrientation:(UIDeviceOrientation)orientation application:(XCUIApplication *)application
4059
{
4160
// Tapping elements immediately after rotation may fail due to way UIKit is handling touches.
4261
// We should wait till UI cools off, before continuing
4362
[application fb_waitUntilStableWithTimeout:FBConfiguration.animationCoolOffTimeout];
4463

45-
return application.interfaceOrientation == orientation;
64+
return application.interfaceOrientation == FBInterfaceOrientationFromDeviceOrientation(orientation);
4665
}
4766

4867
- (NSDictionary *)fb_rotationMapping

WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ @implementation XCUIElement (FBUtilities)
113113
XCUIElementType type = XCUIElementTypeAny;
114114
NSArray<NSNumber *> *uniqueTypes = [snapshots valueForKeyPath:[NSString stringWithFormat:@"@distinctUnionOfObjects.%@", FBStringify(XCUIElement, elementType)]];
115115
if (uniqueTypes && [uniqueTypes count] == 1) {
116-
type = [uniqueTypes.firstObject intValue];
116+
type = (XCUIElementType)[uniqueTypes.firstObject intValue];
117117
}
118118
XCUIElementQuery *query = onlyChildren
119119
? [self.fb_query childrenMatchingType:type]

WebDriverAgentLib/Categories/XCUIElement+FBVisibleFrame.m

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,19 @@ - (CGRect)fb_visibleFrame
2929
{
3030
CGRect thisVisibleFrame = [self visibleFrame];
3131
if (!CGRectIsEmpty(thisVisibleFrame)) {
32-
return thisVisibleFrame;
32+
return CGRectMake(CGRectGetMinX(thisVisibleFrame),
33+
CGRectGetMinY(thisVisibleFrame),
34+
CGRectGetWidth(thisVisibleFrame),
35+
CGRectGetHeight(thisVisibleFrame));
3336
}
3437

3538
NSDictionary *visibleFrameDict = [self fb_attributeValue:FB_XCAXAVisibleFrameAttributeName
3639
error:nil];
3740
if (nil == visibleFrameDict) {
38-
return thisVisibleFrame;
41+
return CGRectMake(CGRectGetMinX(thisVisibleFrame),
42+
CGRectGetMinY(thisVisibleFrame),
43+
CGRectGetWidth(thisVisibleFrame),
44+
CGRectGetHeight(thisVisibleFrame));
3945
}
4046

4147
id x = [visibleFrameDict objectForKey:@"X"];
@@ -46,7 +52,10 @@ - (CGRect)fb_visibleFrame
4652
return CGRectMake([x doubleValue], [y doubleValue], [width doubleValue], [height doubleValue]);
4753
}
4854

49-
return thisVisibleFrame;
55+
return CGRectMake(CGRectGetMinX(thisVisibleFrame),
56+
CGRectGetMinY(thisVisibleFrame),
57+
CGRectGetWidth(thisVisibleFrame),
58+
CGRectGetHeight(thisVisibleFrame));
5059
}
5160

5261
@end

WebDriverAgentLib/Commands/FBCustomCommands.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ + (NSDictionary *)processArguments:(XCUIApplication *)app
253253
if (nil == result) {
254254
return FBResponseWithUnknownError(error);
255255
}
256-
return FBResponseWithObject([result base64EncodedStringWithOptions:0]);
256+
return FBResponseWithObject([result base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0]);
257257
}
258258

259259
+ (id<FBResponsePayload>)handleGetBatteryInfo:(FBRouteRequest *)request
@@ -599,7 +599,7 @@ + (NSString *)timeZone
599599
modifierFlags = [(NSNumber *)modifiers unsignedIntValue];
600600
}
601601
NSString *keyValue = [FBKeyboard keyValueForName:item] ?: key;
602-
[destination typeKey:keyValue modifierFlags:modifierFlags];
602+
[destination typeKey:keyValue modifierFlags:(XCUIKeyModifierFlags)modifierFlags];
603603
} else {
604604
NSString *message = @"All items of the 'keys' array must be either dictionaries or strings";
605605
return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message

WebDriverAgentLib/Commands/FBElementCommands.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ + (NSArray *)routes
574574
traceback:nil]);
575575
}
576576
}
577-
NSString *screenshot = [screenshotData base64EncodedStringWithOptions:0];
577+
NSString *screenshot = [screenshotData base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];
578578
screenshotData = nil;
579579
return FBResponseWithObject(screenshot);
580580
}

WebDriverAgentLib/Commands/FBOrientationCommands.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ + (BOOL)setDeviceOrientation:(NSString *)orientation forApplication:(XCUIApplica
139139
if (orientationValue == nil) {
140140
return NO;
141141
}
142-
return [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientationValue.integerValue];
142+
return [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:(UIDeviceOrientation)orientationValue.integerValue];
143143
}
144144

145145
+ (NSDictionary *)_orientationsMapping

WebDriverAgentLib/Commands/FBScreenshotCommands.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ + (NSArray *)routes
3333
if (nil == screenshotData) {
3434
return FBResponseWithStatus([FBCommandStatus unableToCaptureScreenErrorWithMessage:error.description traceback:nil]);
3535
}
36-
NSString *screenshot = [screenshotData base64EncodedStringWithOptions:0];
36+
NSString *screenshot = [screenshotData base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];
3737
return FBResponseWithObject(screenshot);
3838
}
3939

WebDriverAgentLib/Routing/FBScreenRecordingRequest.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ - (nullable id)createVideoEncodingWithError:(NSError **)error
4646
[videoEncodingInitInvocation setSelector:videoEncodingConstructorSelector];
4747
long long codec = self.codec;
4848
[videoEncodingInitInvocation setArgument:&codec atIndex:2];
49-
double frameRate = self.fps;
49+
double frameRate = (double)self.fps;
5050
[videoEncodingInitInvocation setArgument:&frameRate atIndex:3];
5151
[videoEncodingInitInvocation invokeWithTarget:videoEncodingAllocated];
5252
id __unsafe_unretained result;

0 commit comments

Comments
 (0)