From 8978c344be675d4dbbce4accd77dd74fbdb38711 Mon Sep 17 00:00:00 2001 From: ahmetrnn Date: Sun, 23 Nov 2025 04:02:04 +0100 Subject: [PATCH] feat: add SceneDelegate support and update Info.plist for scene management - Introduced SceneDelegate for better scene lifecycle management in the IntegrationApp. - Updated Info.plist files to include scene configuration and support for multiple scenes. - Cleaned up AppDelegate by removing the window property and adding scene lifecycle methods. - Adjusted project settings and bundle identifiers for consistency. --- WebDriverAgent.xcodeproj/project.pbxproj | 20 ++++++-- WebDriverAgentLib/Info.plist | 46 ++++++++--------- .../IntegrationApp/Classes/AppDelegate.h | 1 - .../IntegrationApp/Classes/AppDelegate.m | 15 ++++++ .../IntegrationApp/Classes/SceneDelegate.h | 15 ++++++ .../IntegrationApp/Classes/SceneDelegate.m | 50 +++++++++++++++++++ WebDriverAgentTests/IntegrationApp/Info.plist | 19 +++++++ 7 files changed, 138 insertions(+), 28 deletions(-) create mode 100644 WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.h create mode 100644 WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.m diff --git a/WebDriverAgent.xcodeproj/project.pbxproj b/WebDriverAgent.xcodeproj/project.pbxproj index c52bdd5cd..1f2ad08f3 100644 --- a/WebDriverAgent.xcodeproj/project.pbxproj +++ b/WebDriverAgent.xcodeproj/project.pbxproj @@ -821,6 +821,7 @@ EEE3764A1D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = EEE376481D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.m */; }; EEE9B4721CD02B88009D2030 /* FBRunLoopSpinner.h in Headers */ = {isa = PBXBuildFile; fileRef = EEE9B4701CD02B88009D2030 /* FBRunLoopSpinner.h */; settings = {ATTRIBUTES = (Public, ); }; }; EEE9B4731CD02B88009D2030 /* FBRunLoopSpinner.m in Sources */ = {isa = PBXBuildFile; fileRef = EEE9B4711CD02B88009D2030 /* FBRunLoopSpinner.m */; }; + SCENE0001CF7997600275851 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = SCENE0002CF7997600275851 /* SceneDelegate.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -1401,6 +1402,8 @@ EEE9B4701CD02B88009D2030 /* FBRunLoopSpinner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBRunLoopSpinner.h; sourceTree = ""; }; EEE9B4711CD02B88009D2030 /* FBRunLoopSpinner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBRunLoopSpinner.m; sourceTree = ""; }; EEF9882A1C486603005CA669 /* WebDriverAgentRunner.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebDriverAgentRunner.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + SCENE0002CF7997600275851 /* SceneDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; }; + SCENE0003CF7997600275851 /* SceneDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -2107,6 +2110,8 @@ children = ( EE9B76821CF7997600275851 /* AppDelegate.h */, EE9B76831CF7997600275851 /* AppDelegate.m */, + SCENE0003CF7997600275851 /* SceneDelegate.h */, + SCENE0002CF7997600275851 /* SceneDelegate.m */, EE1E06E51D182E95007CF043 /* FBAlertViewController.h */, EE1E06E61D182E95007CF043 /* FBAlertViewController.m */, EE8BA9781DCCED9A00A9DEF8 /* FBNavigationController.h */, @@ -3453,6 +3458,7 @@ buildActionMask = 2147483647; files = ( EE9B768E1CF7997600275851 /* AppDelegate.m in Sources */, + SCENE0001CF7997600275851 /* SceneDelegate.m in Sources */, EE1E06E71D182E95007CF043 /* FBAlertViewController.m in Sources */, 315A15072518CC2800A3A064 /* TouchSpotView.m in Sources */, EE9B76911CF7997600275851 /* main.m in Sources */, @@ -4006,9 +4012,11 @@ baseConfigurationReference = EEE5CABF1C80361500CBBDD9 /* IOSSettings.xcconfig */; buildSettings = { CLANG_STATIC_ANALYZER_MODE = deep; + CODE_SIGN_IDENTITY = "Apple Development"; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = NO; + DEVELOPMENT_TEAM = J4A3VPZQ87; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -4030,7 +4038,7 @@ /System/Developer/Library/Frameworks, ); OTHER_LDFLAGS = ""; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.WebDriverAgentLib; + PRODUCT_BUNDLE_IDENTIFIER = "--com.ahmet.WebDriverAgentRunner"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -4071,8 +4079,10 @@ baseConfigurationReference = EEE5CABF1C80361500CBBDD9 /* IOSSettings.xcconfig */; buildSettings = { CLANG_STATIC_ANALYZER_MODE = deep; + CODE_SIGN_IDENTITY = "Apple Development"; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = NO; + DEVELOPMENT_TEAM = J4A3VPZQ87; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -4095,7 +4105,7 @@ ); ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.WebDriverAgentLib; + PRODUCT_BUNDLE_IDENTIFIER = "--com.ahmet.WebDriverAgentRunner"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -4248,12 +4258,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ANALYZER_NONNULL = YES; DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = J4A3VPZQ87; INFOPLIST_FILE = WebDriverAgentTests/IntegrationApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.IntegrationApp; + PRODUCT_BUNDLE_IDENTIFIER = com.ahmet.WebDriverAgentRunner; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -4264,13 +4275,14 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ANALYZER_NONNULL = YES; + DEVELOPMENT_TEAM = J4A3VPZQ87; INFOPLIST_FILE = WebDriverAgentTests/IntegrationApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); ONLY_ACTIVE_ARCH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.facebook.IntegrationApp; + PRODUCT_BUNDLE_IDENTIFIER = com.ahmet.WebDriverAgentRunner; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/WebDriverAgentLib/Info.plist b/WebDriverAgentLib/Info.plist index d27f61f6c..ba948f617 100644 --- a/WebDriverAgentLib/Info.plist +++ b/WebDriverAgentLib/Info.plist @@ -1,26 +1,26 @@ - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 10.2.2 - CFBundleSignature - ???? - CFBundleVersion - 10.2.2 - NSPrincipalClass - - - \ No newline at end of file + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 10.2.2 + CFBundleSignature + ???? + CFBundleVersion + 10.2.2 + NSPrincipalClass + + + diff --git a/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.h b/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.h index 847dbec8a..e3834f2f7 100644 --- a/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.h +++ b/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.h @@ -10,6 +10,5 @@ #import @interface AppDelegate : UIResponder -@property (strong, nonatomic) UIWindow *window; @end diff --git a/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.m b/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.m index 3ac33aa25..bd854eebd 100644 --- a/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.m +++ b/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.m @@ -12,4 +12,19 @@ @interface AppDelegate () @end @implementation AppDelegate + +#pragma mark - UISceneSession Lifecycle + +- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; +} + +- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. +} + @end diff --git a/WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.h b/WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.h new file mode 100644 index 000000000..de8b02a1f --- /dev/null +++ b/WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.h @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface SceneDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.m b/WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.m new file mode 100644 index 000000000..533d150a3 --- /dev/null +++ b/WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.m @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "SceneDelegate.h" + +@interface SceneDelegate () +@end + +@implementation SceneDelegate + +- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). +} + +- (void)sceneDidDisconnect:(UIScene *)scene { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). +} + +- (void)sceneDidBecomeActive:(UIScene *)scene { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. +} + +- (void)sceneWillResignActive:(UIScene *)scene { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). +} + +- (void)sceneWillEnterForeground:(UIScene *)scene { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. +} + +- (void)sceneDidEnterBackground:(UIScene *)scene { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. +} + +@end diff --git a/WebDriverAgentTests/IntegrationApp/Info.plist b/WebDriverAgentTests/IntegrationApp/Info.plist index 2dfb754cd..231110dd8 100644 --- a/WebDriverAgentTests/IntegrationApp/Info.plist +++ b/WebDriverAgentTests/IntegrationApp/Info.plist @@ -30,6 +30,25 @@ Yo Yo NSPhotoLibraryUsageDescription Yo Yo + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + SceneDelegate + UISceneStoryboardFile + Main + + + + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile