Skip to content

Commit

Permalink
chore: update integerationapp for newer OS env (#891)
Browse files Browse the repository at this point in the history
* fix deprecated self.interfaceOrientation

* fix notification

* fix typo

* tweak indentations
  • Loading branch information
KazuCocoa authored Apr 19, 2024
1 parent 32be3b4 commit 2c78348
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
3 changes: 2 additions & 1 deletion WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
*/

#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>
@interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate>
@property (strong, nonatomic) UIWindow *window;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>

@interface FBAlertViewController : UIViewController

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ - (IBAction)createAppSheet:(UIButton *)sender

- (IBAction)createNotificationAlert:(UIButton *)sender
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert categories:nil]];
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound|UNAuthorizationOptionAlert|UNAuthorizationOptionBadge)
completionHandler:^(BOOL granted, NSError * _Nullable error)
{
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] registerForRemoteNotifications];
});
}];
}

- (IBAction)createCameraRollAccessAlert:(UIButton *)sender
Expand Down
8 changes: 7 additions & 1 deletion WebDriverAgentTests/IntegrationApp/Classes/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ - (void)viewDidLayoutSubviews
- (void)updateOrentationLabel
{
NSString *orientation = nil;
switch (self.interfaceOrientation) {
switch (UIDevice.currentDevice.orientation) {
case UIInterfaceOrientationPortrait:
orientation = @"Portrait";
break;
Expand All @@ -50,6 +50,12 @@ - (void)updateOrentationLabel
case UIInterfaceOrientationLandscapeRight:
orientation = @"LandscapeRight";
break;
case UIDeviceOrientationFaceUp:
orientation = @"FaceUp";
break;
case UIDeviceOrientationFaceDown:
orientation = @"FaceDown";
break;
case UIInterfaceOrientationUnknown:
orientation = @"Unknown";
break;
Expand Down
6 changes: 3 additions & 3 deletions WebDriverAgentTests/IntegrationApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.facebook.wda.integrationApp</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand All @@ -22,12 +22,12 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Yo Yo</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Yo Yo</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Yo Yo</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Yo Yo</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Yo Yo</string>
<key>UILaunchStoryboardName</key>
Expand Down

0 comments on commit 2c78348

Please sign in to comment.