appium-webdriveragent 3.9.2 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/PrivateHeaders/.DS_Store +0 -0
  2. package/PrivateHeaders/XCTest/XCTestManager_ManagerInterface-Protocol.h +3 -0
  3. package/README.md +0 -1
  4. package/WebDriverAgent.xcodeproj/project.pbxproj +56 -56
  5. package/WebDriverAgent.xcodeproj/project.xcworkspace/xcuserdata/elf.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  6. package/WebDriverAgent.xcodeproj/xcuserdata/elf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +51 -0
  7. package/WebDriverAgent.xcodeproj/xcuserdata/{kazuaki.xcuserdatad → elf.xcuserdatad}/xcschemes/xcschememanagement.plist +23 -8
  8. package/WebDriverAgentLib/.DS_Store +0 -0
  9. package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.h +0 -17
  10. package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +0 -16
  11. package/WebDriverAgentLib/Categories/XCUIElement+FBIsVisible.m +28 -14
  12. package/WebDriverAgentLib/Categories/XCUIElement+FBResolve.h +37 -0
  13. package/WebDriverAgentLib/Categories/XCUIElement+FBResolve.m +51 -0
  14. package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m +8 -2
  15. package/WebDriverAgentLib/Commands/FBElementCommands.m +3 -1
  16. package/WebDriverAgentLib/Commands/FBOrientationCommands.m +20 -9
  17. package/WebDriverAgentLib/Commands/FBSessionCommands.m +119 -99
  18. package/WebDriverAgentLib/FBApplication.m +1 -1
  19. package/WebDriverAgentLib/Routing/FBElementCache.m +42 -11
  20. package/WebDriverAgentLib/Routing/FBResponsePayload.m +9 -3
  21. package/WebDriverAgentLib/Routing/FBSession.h +6 -0
  22. package/WebDriverAgentLib/Routing/FBSession.m +45 -55
  23. package/WebDriverAgentLib/Utilities/FBAlertsMonitor.h +1 -3
  24. package/WebDriverAgentLib/Utilities/FBAlertsMonitor.m +6 -13
  25. package/WebDriverAgentLib/Utilities/FBCapabilities.h +23 -0
  26. package/WebDriverAgentLib/Utilities/FBCapabilities.m +23 -0
  27. package/WebDriverAgentLib/Utilities/FBConfiguration.m +6 -1
  28. package/WebDriverAgentLib/Utilities/FBScreenshot.m +125 -14
  29. package/WebDriverAgentLib/Utilities/FBSettings.h +23 -23
  30. package/WebDriverAgentLib/Utilities/FBSettings.m +23 -23
  31. package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.h +16 -0
  32. package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m +16 -0
  33. package/WebDriverAgentLib/Utilities/FBXPath.m +15 -44
  34. package/WebDriverAgentLib/Utilities/LRUCache/.DS_Store +0 -0
  35. package/WebDriverAgentLib/Utilities/LRUCache/LRUCache.h +59 -0
  36. package/WebDriverAgentLib/Utilities/LRUCache/LRUCache.m +104 -0
  37. package/WebDriverAgentLib/Utilities/LRUCache/LRUCacheNode.h +43 -0
  38. package/WebDriverAgentLib/Utilities/LRUCache/LRUCacheNode.m +59 -0
  39. package/WebDriverAgentLib/Vendor/.DS_Store +0 -0
  40. package/WebDriverAgentRunner/.DS_Store +0 -0
  41. package/WebDriverAgentRunner-Runner.app.zip +0 -0
  42. package/WebDriverAgentTests/IntegrationApp/Resources/.DS_Store +0 -0
  43. package/WebDriverAgentTests/IntegrationTests/FBSessionIntegrationTests.m +20 -16
  44. package/WebDriverAgentTests/IntegrationTests/XCUIApplicationHelperTests.m +2 -1
  45. package/WebDriverAgentTests/IntegrationTests/XCUIElementFBFindTests.m +11 -0
  46. package/WebDriverAgentTests/UnitTests/Doubles/FBApplicationDouble.h +3 -0
  47. package/WebDriverAgentTests/UnitTests/Doubles/FBApplicationDouble.m +15 -0
  48. package/WebDriverAgentTests/UnitTests/Doubles/XCUIElementDouble.h +1 -0
  49. package/WebDriverAgentTests/UnitTests/Doubles/XCUIElementDouble.m +1 -0
  50. package/WebDriverAgentTests/UnitTests/FBSessionTests.m +11 -1
  51. package/WebDriverAgentTests/UnitTests/FBXPathTests.m +3 -1
  52. package/WebDriverAgentTests/UnitTests_tvOS/Doubles/XCUIElementDouble.h +1 -0
  53. package/WebDriverAgentTests/UnitTests_tvOS/Doubles/XCUIElementDouble.m +1 -0
  54. package/package.json +3 -3
  55. package/WebDriverAgent.xcodeproj/project.xcworkspace/xcuserdata/kazuaki.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  56. package/WebDriverAgent.xcodeproj/project.xcworkspace/xcuserdata/kazuaki.xcuserdatad/WorkspaceSettings.xcsettings +0 -20
  57. package/WebDriverAgent.xcodeproj/xcuserdata/kazuaki.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -906
  58. package/WebDriverAgentLib/Vendor/YYCache/YYCache.h +0 -206
  59. package/WebDriverAgentLib/Vendor/YYCache/YYCache.m +0 -140
  60. package/WebDriverAgentLib/Vendor/YYCache/YYDiskCache.h +0 -412
  61. package/WebDriverAgentLib/Vendor/YYCache/YYDiskCache.m +0 -462
  62. package/WebDriverAgentLib/Vendor/YYCache/YYKVStorage.h +0 -325
  63. package/WebDriverAgentLib/Vendor/YYCache/YYKVStorage.m +0 -1068
  64. package/WebDriverAgentLib/Vendor/YYCache/YYMemoryCache.h +0 -213
  65. package/WebDriverAgentLib/Vendor/YYCache/YYMemoryCache.m +0 -508
@@ -13,11 +13,13 @@
13
13
  #import "FBElementUtils.h"
14
14
  #import "FBMathUtils.h"
15
15
  #import "FBActiveAppDetectionPoint.h"
16
+ #import "FBSession.h"
16
17
  #import "FBXCodeCompatibility.h"
17
18
  #import "XCAccessibilityElement+FBComparison.h"
18
19
  #import "XCElementSnapshot+FBHelpers.h"
19
20
  #import "XCElementSnapshot+FBHitPoint.h"
20
21
  #import "XCUIElement+FBUtilities.h"
22
+ #import "XCUIElement+FBUID.h"
21
23
  #import "XCTestPrivateSymbols.h"
22
24
 
23
25
  @implementation XCUIElement (FBIsVisible)
@@ -32,35 +34,46 @@
32
34
 
33
35
  @implementation XCElementSnapshot (FBIsVisible)
34
36
 
35
- static NSMutableDictionary<NSNumber *, NSMutableDictionary<NSString *, NSNumber *> *> *fb_generationsCache;
36
-
37
- + (void)load
37
+ - (NSString *)fb_uniqId
38
38
  {
39
- fb_generationsCache = [NSMutableDictionary dictionary];
39
+ return self.fb_uid ?: [NSString stringWithFormat:@"%p", (void *)self];
40
40
  }
41
41
 
42
42
  - (nullable NSNumber *)fb_cachedVisibilityValue
43
43
  {
44
- NSNumber* generationObj = [NSNumber numberWithUnsignedLongLong:self.generation];
45
- NSDictionary<NSString *, NSNumber *> *result = [fb_generationsCache objectForKey:generationObj];
44
+ NSMutableDictionary *cache = FBSession.activeSession.elementsVisibilityCache;
45
+ if (nil == cache) {
46
+ return nil;
47
+ }
48
+
49
+ NSDictionary<NSString *, NSNumber *> *result = [cache objectForKey:@(self.generation)];
46
50
  if (nil == result) {
47
51
  // There is no need to keep the cached data for the previous generations
48
- [fb_generationsCache removeAllObjects];
49
- [fb_generationsCache setObject:[NSMutableDictionary dictionary] forKey:generationObj];
52
+ [cache removeAllObjects];
53
+ [cache setObject:[NSMutableDictionary dictionary] forKey:@(self.generation)];
50
54
  return nil;
51
55
  }
52
- return [result objectForKey:[NSString stringWithFormat:@"%p", (void *)self]];
56
+ return [result objectForKey:self.fb_uniqId];
53
57
  }
54
58
 
55
- - (BOOL)fb_cacheVisibilityWithValue:(BOOL)isVisible forAncestors:(nullable NSArray<XCElementSnapshot *> *)ancestors
59
+ - (BOOL)fb_cacheVisibilityWithValue:(BOOL)isVisible
60
+ forAncestors:(nullable NSArray<XCElementSnapshot *> *)ancestors
56
61
  {
57
- NSMutableDictionary<NSString *, NSNumber *> *destination = [fb_generationsCache objectForKey:@(self.generation)];
62
+ NSMutableDictionary *cache = FBSession.activeSession.elementsVisibilityCache;
63
+ if (nil == cache) {
64
+ return isVisible;
65
+ }
66
+ NSMutableDictionary<NSString *, NSNumber *> *destination = [cache objectForKey:@(self.generation)];
67
+ if (nil == destination) {
68
+ return isVisible;
69
+ }
70
+
58
71
  NSNumber *visibleObj = [NSNumber numberWithBool:isVisible];
59
- [destination setObject:visibleObj forKey:[NSString stringWithFormat:@"%p", (void *)self]];
72
+ [destination setObject:visibleObj forKey:self.fb_uniqId];
60
73
  if (isVisible && nil != ancestors) {
61
74
  // if an element is visible then all its ancestors must be visible as well
62
75
  for (XCElementSnapshot *ancestor in ancestors) {
63
- NSString *ancestorId = [NSString stringWithFormat:@"%p", (void *)ancestor];
76
+ NSString *ancestorId = ancestor.fb_uniqId;
64
77
  if (nil == [destination objectForKey:ancestorId]) {
65
78
  [destination setObject:visibleObj forKey:ancestorId];
66
79
  }
@@ -69,7 +82,8 @@ static NSMutableDictionary<NSNumber *, NSMutableDictionary<NSString *, NSNumber
69
82
  return isVisible;
70
83
  }
71
84
 
72
- - (CGRect)fb_frameInContainer:(XCElementSnapshot *)container hierarchyIntersection:(nullable NSValue *)intersectionRectange
85
+ - (CGRect)fb_frameInContainer:(XCElementSnapshot *)container
86
+ hierarchyIntersection:(nullable NSValue *)intersectionRectange
73
87
  {
74
88
  CGRect currentRectangle = nil == intersectionRectange ? self.frame : [intersectionRectange CGRectValue];
75
89
  XCElementSnapshot *parent = self.parent;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+ #import <XCTest/XCTest.h>
11
+
12
+ NS_ASSUME_NONNULL_BEGIN
13
+
14
+ @interface XCUIElement (FBResolve)
15
+
16
+ /*! This property is always true unless the element gets resolved by its internal UUID (e.g. results of an xpath query) */
17
+ @property (nullable, nonatomic) NSNumber *fb_isResolvedNatively;
18
+
19
+ /**
20
+ Returns element instance based on query by element's UUID rather than any other attributes, which
21
+ might be a subject of change during the application life cycle. The UUID is calculated based on the PID
22
+ of the application to which this particular element belongs and the identifier of the underlying AXElement
23
+ instance. That usually guarantees the same element is always going to be matched in scope of the parent
24
+ application independently of its current attribute values.
25
+ Example: We have an element X with value Y. Our locator looks like 'value == Y'. Normally, if the element's
26
+ value is changed to Z and we try to reuse this cached instance of it then a StaleElement error is thrown.
27
+ Although, if the cached element instance is the one returned by this API call then the same element
28
+ is going to be matched and no staleness exception will be thrown.
29
+
30
+ @return Either the same element instance if `fb_isResolvedNatively` was set to NO (usually the cache for elements
31
+ matched by xpath locators) or the stable instance of the self element based on the query by element's UUID.
32
+ */
33
+ - (XCUIElement *)fb_stableInstance;
34
+
35
+ @end
36
+
37
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+ #import "XCUIElement+FBResolve.h"
11
+
12
+ #import <objc/runtime.h>
13
+
14
+ #import "XCUIElement.h"
15
+ #import "FBXCodeCompatibility.h"
16
+ #import "XCUIElement+FBUID.h"
17
+
18
+ @implementation XCUIElement (FBResolve)
19
+
20
+ static char XCUIELEMENT_IS_RESOLVED_NATIVELY_KEY;
21
+
22
+ @dynamic fb_isResolvedNatively;
23
+
24
+ - (void)setFb_isResolvedNatively:(NSNumber *)isResolvedNatively
25
+ {
26
+ objc_setAssociatedObject(self, &XCUIELEMENT_IS_RESOLVED_NATIVELY_KEY, isResolvedNatively, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
27
+ }
28
+
29
+ - (NSNumber *)fb_isResolvedNatively
30
+ {
31
+ NSNumber *result = objc_getAssociatedObject(self, &XCUIELEMENT_IS_RESOLVED_NATIVELY_KEY);
32
+ return nil == result ? @YES : result;
33
+ }
34
+
35
+ - (XCUIElement *)fb_stableInstance
36
+ {
37
+ if (![self.fb_isResolvedNatively boolValue]) {
38
+ return self;
39
+ }
40
+
41
+ XCUIElementQuery *query = [self isKindOfClass:XCUIApplication.class]
42
+ ? self.application.fb_query
43
+ : [self.application.fb_query descendantsMatchingType:XCUIElementTypeAny];
44
+ XCElementSnapshot *cachedSnapshot = self.fb_cachedSnapshot;
45
+ NSString *uid = nil == cachedSnapshot ? self.fb_uid : cachedSnapshot.fb_uid;
46
+ return nil == uid
47
+ ? self
48
+ : [query matchingPredicate:[NSPredicate predicateWithFormat:@"%K = %@", FBStringify(XCUIElement, wdUID), uid]].fb_firstMatch;
49
+ }
50
+
51
+ @end
@@ -35,6 +35,7 @@
35
35
  #import "XCUIElementQuery+FBHelpers.h"
36
36
  #import "XCUIElement+FBUID.h"
37
37
  #import "XCUIScreen.h"
38
+ #import "XCUIElement+FBResolve.h"
38
39
 
39
40
  #define DEFAULT_AX_TIMEOUT 60.
40
41
 
@@ -113,7 +114,7 @@
113
114
  if (nil == snapshotWithAttributes) {
114
115
  [FBLogger logFmt:@"Cannot take a snapshot with attribute(s) %@ of '%@' after %.2f seconds",
115
116
  attributeNames, snapshot.fb_description, axTimeout];
116
- [FBLogger logFmt:@"This timeout could be customized via '%@' setting", CUSTOM_SNAPSHOT_TIMEOUT];
117
+ [FBLogger logFmt:@"This timeout could be customized via '%@' setting", FB_SETTING_CUSTOM_SNAPSHOT_TIMEOUT];
117
118
  [FBLogger logFmt:@"Internal error: %@", error.localizedDescription];
118
119
  [FBLogger logFmt:@"Falling back to the default snapshotting mechanism for the element '%@' (some attribute values, like visibility or accessibility might not be precise though)", snapshot.fb_description];
119
120
  snapshotWithAttributes = self.lastSnapshot;
@@ -159,6 +160,7 @@
159
160
  query = [query matchingPredicate:[NSPredicate predicateWithFormat:@"%K IN %@", FBStringify(XCUIElement, wdUID), sortedIds]];
160
161
  if (1 == snapshots.count) {
161
162
  XCUIElement *result = query.fb_firstMatch;
163
+ result.fb_isResolvedNatively = @NO;
162
164
  return result ? @[result] : @[];
163
165
  }
164
166
  // Rely here on the fact, that XPath always returns query results in the same
@@ -176,7 +178,11 @@
176
178
  // }
177
179
  // return NSOrderedSame;
178
180
  // }];
179
- return query.fb_allMatches;
181
+ NSArray<XCUIElement *> *result = query.fb_allMatches;
182
+ for (XCUIElement *el in result) {
183
+ el.fb_isResolvedNatively = @NO;
184
+ }
185
+ return result;
180
186
  }
181
187
 
182
188
  - (void)fb_waitUntilStable
@@ -38,6 +38,7 @@
38
38
  #import "XCUIElement+FBUtilities.h"
39
39
  #import "XCUIElement+FBWebDriverAttributes.h"
40
40
  #import "XCUIElement+FBTVFocuse.h"
41
+ #import "XCUIElement+FBResolve.h"
41
42
  #import "FBElementTypeTransformer.h"
42
43
  #import "XCUIElement.h"
43
44
  #import "XCUIElementQuery.h"
@@ -258,7 +259,8 @@
258
259
  XCUIElement *focusedElement = request.session.activeApplication.fb_focusedElement;
259
260
  if (focusedElement != nil) {
260
261
  FBElementCache *elementCache = request.session.elementCache;
261
- NSString *focusedUUID = [elementCache storeElement:focusedElement];
262
+ BOOL useNativeCachingStrategy = request.session.useNativeCachingStrategy;
263
+ NSString *focusedUUID = [elementCache storeElement:(useNativeCachingStrategy ? focusedElement : focusedElement.fb_stableInstance)];
262
264
  if (focusedUUID && [focusedUUID isEqualToString:(id)request.parameters[@"uuid"]]) {
263
265
  isFocused = YES;
264
266
  }
@@ -40,9 +40,13 @@ const struct FBWDOrientationValues FBWDOrientationValues = {
40
40
  return
41
41
  @[
42
42
  [[FBRoute GET:@"/orientation"] respondWithTarget:self action:@selector(handleGetOrientation:)],
43
+ [[FBRoute GET:@"/orientation"].withoutSession respondWithTarget:self action:@selector(handleGetOrientation:)],
43
44
  [[FBRoute POST:@"/orientation"] respondWithTarget:self action:@selector(handleSetOrientation:)],
45
+ [[FBRoute POST:@"/orientation"].withoutSession respondWithTarget:self action:@selector(handleSetOrientation:)],
44
46
  [[FBRoute GET:@"/rotation"] respondWithTarget:self action:@selector(handleGetRotation:)],
47
+ [[FBRoute GET:@"/rotation"].withoutSession respondWithTarget:self action:@selector(handleGetRotation:)],
45
48
  [[FBRoute POST:@"/rotation"] respondWithTarget:self action:@selector(handleSetRotation:)],
49
+ [[FBRoute POST:@"/rotation"].withoutSession respondWithTarget:self action:@selector(handleSetRotation:)],
46
50
  ];
47
51
  }
48
52
 
@@ -51,15 +55,15 @@ const struct FBWDOrientationValues FBWDOrientationValues = {
51
55
 
52
56
  + (id<FBResponsePayload>)handleGetOrientation:(FBRouteRequest *)request
53
57
  {
54
- FBSession *session = request.session;
55
- NSString *orientation = [self.class interfaceOrientationForApplication:session.activeApplication];
58
+ FBApplication *application = request.session.activeApplication ?: FBApplication.fb_activeApplication;
59
+ NSString *orientation = [self.class interfaceOrientationForApplication:application];
56
60
  return FBResponseWithObject([[self _wdOrientationsMapping] objectForKey:orientation]);
57
61
  }
58
62
 
59
63
  + (id<FBResponsePayload>)handleSetOrientation:(FBRouteRequest *)request
60
64
  {
61
- FBSession *session = request.session;
62
- if ([self.class setDeviceOrientation:request.arguments[@"orientation"] forApplication:session.activeApplication]) {
65
+ FBApplication *application = request.session.activeApplication ?: FBApplication.fb_activeApplication;
66
+ if ([self.class setDeviceOrientation:request.arguments[@"orientation"] forApplication:application]) {
63
67
  return FBResponseWithOK();
64
68
  }
65
69
 
@@ -69,7 +73,8 @@ const struct FBWDOrientationValues FBWDOrientationValues = {
69
73
  + (id<FBResponsePayload>)handleGetRotation:(FBRouteRequest *)request
70
74
  {
71
75
  XCUIDevice *device = [XCUIDevice sharedDevice];
72
- UIInterfaceOrientation orientation = request.session.activeApplication.interfaceOrientation;
76
+ FBApplication *application = request.session.activeApplication ?: FBApplication.fb_activeApplication;
77
+ UIInterfaceOrientation orientation = application.interfaceOrientation;
73
78
  return FBResponseWithObject(device.fb_rotationMapping[@(orientation)]);
74
79
  }
75
80
 
@@ -88,14 +93,20 @@ const struct FBWDOrientationValues FBWDOrientationValues = {
88
93
  };
89
94
  NSArray<NSDictionary *> *supportedRotations = XCUIDevice.sharedDevice.fb_rotationMapping.allValues;
90
95
  if (![supportedRotations containsObject:rotation]) {
91
- NSString *errMessage = [NSString stringWithFormat:@"%@ rotation is not supported. Only the following values are supported: %@", rotation, supportedRotations];
96
+ NSString *errMessage = [
97
+ NSString stringWithFormat:@"%@ rotation is not supported. Only the following values are supported: %@",
98
+ rotation, supportedRotations
99
+ ];
92
100
  return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:errMessage
93
101
  traceback:nil]);
94
102
  }
95
103
 
96
- FBApplication *app = request.session.activeApplication;
97
- if (![self.class setDeviceRotation:request.arguments forApplication:app]) {
98
- NSString *errMessage = [NSString stringWithFormat:@"The current rotation cannot be set to %@. Make sure the %@ application supports it", rotation, app.bundleID];
104
+ FBApplication *application = request.session.activeApplication ?: FBApplication.fb_activeApplication;
105
+ if (![self.class setDeviceRotation:request.arguments forApplication:application]) {
106
+ NSString *errMessage = [
107
+ NSString stringWithFormat:@"The current rotation cannot be set to %@. Make sure the %@ application supports it",
108
+ rotation, application.bundleID
109
+ ];
99
110
  return FBResponseWithStatus([FBCommandStatus invalidElementStateErrorWithMessage:errMessage
100
111
  traceback:nil]);
101
112
  }
@@ -10,6 +10,7 @@
10
10
  #import "FBSessionCommands.h"
11
11
 
12
12
  #import "FBApplication.h"
13
+ #import "FBCapabilities.h"
13
14
  #import "FBConfiguration.h"
14
15
  #import "FBLogger.h"
15
16
  #import "FBProtocolHelpers.h"
@@ -74,72 +75,91 @@
74
75
 
75
76
  + (id<FBResponsePayload>)handleCreateSession:(FBRouteRequest *)request
76
77
  {
77
- NSDictionary<NSString *, id> *requirements;
78
+ if (nil != FBSession.activeSession) {
79
+ [FBSession.activeSession kill];
80
+ }
81
+
82
+ NSDictionary<NSString *, id> *capabilities;
78
83
  NSError *error;
79
84
  if (![request.arguments[@"capabilities"] isKindOfClass:NSDictionary.class]) {
80
85
  return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:@"'capabilities' is mandatory to create a new session"
81
86
  traceback:nil]);
82
87
  }
83
- if (nil == (requirements = FBParseCapabilities((NSDictionary *)request.arguments[@"capabilities"], &error))) {
88
+ if (nil == (capabilities = FBParseCapabilities((NSDictionary *)request.arguments[@"capabilities"], &error))) {
84
89
  return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:error.description traceback:nil]);
85
90
  }
86
- [FBConfiguration setShouldUseTestManagerForVisibilityDetection:[requirements[@"shouldUseTestManagerForVisibilityDetection"] boolValue]];
87
- if (requirements[USE_COMPACT_RESPONSES]) {
88
- [FBConfiguration setShouldUseCompactResponses:[requirements[USE_COMPACT_RESPONSES] boolValue]];
91
+ [FBConfiguration setShouldUseTestManagerForVisibilityDetection:[capabilities[FB_CAP_USE_TEST_MANAGER_FOR_VISIBLITY_DETECTION] boolValue]];
92
+ if (capabilities[FB_SETTING_USE_COMPACT_RESPONSES]) {
93
+ [FBConfiguration setShouldUseCompactResponses:[capabilities[FB_SETTING_USE_COMPACT_RESPONSES] boolValue]];
89
94
  }
90
- NSString *elementResponseAttributes = requirements[ELEMENT_RESPONSE_ATTRIBUTES];
95
+ NSString *elementResponseAttributes = capabilities[FB_SETTING_ELEMENT_RESPONSE_ATTRIBUTES];
91
96
  if (elementResponseAttributes) {
92
97
  [FBConfiguration setElementResponseAttributes:elementResponseAttributes];
93
98
  }
94
- if (requirements[@"maxTypingFrequency"]) {
95
- [FBConfiguration setMaxTypingFrequency:[requirements[@"maxTypingFrequency"] unsignedIntegerValue]];
99
+ if (capabilities[FB_CAP_MAX_TYPING_FREQUNCY]) {
100
+ [FBConfiguration setMaxTypingFrequency:[capabilities[FB_CAP_MAX_TYPING_FREQUNCY] unsignedIntegerValue]];
96
101
  }
97
- if (requirements[@"shouldUseSingletonTestManager"]) {
98
- [FBConfiguration setShouldUseSingletonTestManager:[requirements[@"shouldUseSingletonTestManager"] boolValue]];
102
+ if (capabilities[FB_CAP_USE_SINGLETON_TEST_MANAGER]) {
103
+ [FBConfiguration setShouldUseSingletonTestManager:[capabilities[FB_CAP_USE_SINGLETON_TEST_MANAGER] boolValue]];
99
104
  }
100
- if (requirements[@"disableAutomaticScreenshots"]) {
101
- if ([requirements[@"disableAutomaticScreenshots"] boolValue]) {
105
+ if (capabilities[FB_CAP_DISABLE_AUTOMATIC_SCREENSHOTS]) {
106
+ if ([capabilities[FB_CAP_DISABLE_AUTOMATIC_SCREENSHOTS] boolValue]) {
102
107
  [FBConfiguration disableScreenshots];
103
108
  } else {
104
109
  [FBConfiguration enableScreenshots];
105
110
  }
106
111
  }
107
- if (requirements[@"shouldTerminateApp"]) {
108
- [FBConfiguration setShouldTerminateApp:[requirements[@"shouldTerminateApp"] boolValue]];
112
+ if (capabilities[FB_CAP_SHOULD_TERMINATE_APP]) {
113
+ [FBConfiguration setShouldTerminateApp:[capabilities[FB_CAP_SHOULD_TERMINATE_APP] boolValue]];
109
114
  }
110
- NSNumber *delay = requirements[@"eventloopIdleDelaySec"];
115
+ NSNumber *delay = capabilities[FB_CAP_EVENT_LOOP_IDLE_DELAY_SEC];
111
116
  if ([delay doubleValue] > 0.0) {
112
117
  [XCUIApplicationProcessDelay setEventLoopHasIdledDelay:[delay doubleValue]];
113
118
  } else {
114
119
  [XCUIApplicationProcessDelay disableEventLoopDelay];
115
120
  }
116
121
 
117
- if (nil != requirements[WAIT_FOR_IDLE_TIMEOUT]) {
118
- FBConfiguration.waitForIdleTimeout = [requirements[WAIT_FOR_IDLE_TIMEOUT] doubleValue];
122
+ if (nil != capabilities[FB_SETTING_WAIT_FOR_IDLE_TIMEOUT]) {
123
+ FBConfiguration.waitForIdleTimeout = [capabilities[FB_SETTING_WAIT_FOR_IDLE_TIMEOUT] doubleValue];
119
124
  }
120
125
 
121
- NSString *bundleID = requirements[@"bundleId"];
126
+ NSString *bundleID = capabilities[FB_CAP_BUNDLE_ID];
122
127
  FBApplication *app = nil;
123
128
  if (bundleID != nil) {
124
- app = [[FBApplication alloc] initPrivateWithPath:requirements[@"app"]
125
- bundleID:bundleID];
126
- app.fb_shouldWaitForQuiescence = nil == requirements[@"shouldWaitForQuiescence"]
127
- || [requirements[@"shouldWaitForQuiescence"] boolValue];
128
- app.launchArguments = (NSArray<NSString *> *)requirements[@"arguments"] ?: @[];
129
- app.launchEnvironment = (NSDictionary <NSString *, NSString *> *)requirements[@"environment"] ?: @{};
130
- [app launch];
131
- if (app.processID == 0) {
132
- return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:[NSString stringWithFormat:@"Failed to launch %@ application", bundleID] traceback:nil]);
129
+ app = [[FBApplication alloc] initWithBundleIdentifier:bundleID];
130
+ BOOL forceAppLaunch = YES;
131
+ if (nil != capabilities[FB_CAP_FORCE_APP_LAUNCH]) {
132
+ forceAppLaunch = [capabilities[FB_CAP_FORCE_APP_LAUNCH] boolValue];
133
+ }
134
+ NSUInteger appState = [app fb_state];
135
+ BOOL isAppRunning = appState >= 2;
136
+ if (!isAppRunning || (isAppRunning && forceAppLaunch)) {
137
+ app.fb_shouldWaitForQuiescence = nil == capabilities[FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE]
138
+ || [capabilities[FB_CAP_SHOULD_WAIT_FOR_QUIESCENCE] boolValue];
139
+ app.launchArguments = (NSArray<NSString *> *)capabilities[FB_CAP_ARGUMENTS] ?: @[];
140
+ app.launchEnvironment = (NSDictionary <NSString *, NSString *> *)capabilities[FB_CAP_ENVIRNOMENT] ?: @{};
141
+ [app launch];
142
+ if (![app running]) {
143
+ NSString *errorMsg = [NSString stringWithFormat:@"Cannot launch %@ application. Make sure the correct bundle identifier has been provided in capabilities and check the device log for possible crash report occurrences", bundleID];
144
+ return FBResponseWithStatus([FBCommandStatus sessionNotCreatedError:errorMsg
145
+ traceback:nil]);
146
+ }
147
+ } else if (appState < 4 && !forceAppLaunch) {
148
+ [app fb_activate];
133
149
  }
134
150
  }
135
151
 
136
- if (requirements[DEFAULT_ALERT_ACTION]) {
152
+ if (capabilities[FB_SETTING_DEFAULT_ALERT_ACTION]) {
137
153
  [FBSession initWithApplication:app
138
- defaultAlertAction:(id)requirements[DEFAULT_ALERT_ACTION]];
154
+ defaultAlertAction:(id)capabilities[FB_SETTING_DEFAULT_ALERT_ACTION]];
139
155
  } else {
140
156
  [FBSession initWithApplication:app];
141
157
  }
142
158
 
159
+ if (nil != capabilities[FB_CAP_USE_NATIVE_CACHING_STRATEGY]) {
160
+ FBSession.activeSession.useNativeCachingStrategy = [capabilities[FB_CAP_USE_NATIVE_CACHING_STRATEGY] boolValue];
161
+ }
162
+
143
163
  return FBResponseWithObject(FBSessionCommands.sessionInformation);
144
164
  }
145
165
 
@@ -214,7 +234,7 @@
214
234
  @"name" : [[UIDevice currentDevice] systemName],
215
235
  @"version" : [[UIDevice currentDevice] systemVersion],
216
236
  @"sdkVersion": FBSDKVersion() ?: @"unknown",
217
- @"testmanagerdVersion": @([XCUIApplication fb_testmanagerdVersion]),
237
+ @"testmanagerdVersion": @(FBTestmanagerdVersion()),
218
238
  },
219
239
  @"ios" :
220
240
  @{
@@ -240,29 +260,29 @@
240
260
  {
241
261
  return FBResponseWithObject(
242
262
  @{
243
- USE_COMPACT_RESPONSES: @([FBConfiguration shouldUseCompactResponses]),
244
- ELEMENT_RESPONSE_ATTRIBUTES: [FBConfiguration elementResponseAttributes],
245
- MJPEG_SERVER_SCREENSHOT_QUALITY: @([FBConfiguration mjpegServerScreenshotQuality]),
246
- MJPEG_SERVER_FRAMERATE: @([FBConfiguration mjpegServerFramerate]),
247
- MJPEG_SCALING_FACTOR: @([FBConfiguration mjpegScalingFactor]),
248
- SCREENSHOT_QUALITY: @([FBConfiguration screenshotQuality]),
249
- KEYBOARD_AUTOCORRECTION: @([FBConfiguration keyboardAutocorrection]),
250
- KEYBOARD_PREDICTION: @([FBConfiguration keyboardPrediction]),
251
- CUSTOM_SNAPSHOT_TIMEOUT: @([FBConfiguration customSnapshotTimeout]),
252
- SNAPSHOT_MAX_DEPTH: @([FBConfiguration snapshotMaxDepth]),
253
- USE_FIRST_MATCH: @([FBConfiguration useFirstMatch]),
254
- WAIT_FOR_IDLE_TIMEOUT: @([FBConfiguration waitForIdleTimeout]),
255
- ANIMATION_COOL_OFF_TIMEOUT: @([FBConfiguration animationCoolOffTimeout]),
256
- BOUND_ELEMENTS_BY_INDEX: @([FBConfiguration boundElementsByIndex]),
257
- REDUCE_MOTION: @([FBConfiguration reduceMotionEnabled]),
258
- DEFAULT_ACTIVE_APPLICATION: request.session.defaultActiveApplication,
259
- ACTIVE_APP_DETECTION_POINT: FBActiveAppDetectionPoint.sharedInstance.stringCoordinates,
260
- INCLUDE_NON_MODAL_ELEMENTS: @([FBConfiguration includeNonModalElements]),
261
- ACCEPT_ALERT_BUTTON_SELECTOR: FBConfiguration.acceptAlertButtonSelector,
262
- DISMISS_ALERT_BUTTON_SELECTOR: FBConfiguration.dismissAlertButtonSelector,
263
- DEFAULT_ALERT_ACTION: request.session.defaultAlertAction ?: @"",
263
+ FB_SETTING_USE_COMPACT_RESPONSES: @([FBConfiguration shouldUseCompactResponses]),
264
+ FB_SETTING_ELEMENT_RESPONSE_ATTRIBUTES: [FBConfiguration elementResponseAttributes],
265
+ FB_SETTING_MJPEG_SERVER_SCREENSHOT_QUALITY: @([FBConfiguration mjpegServerScreenshotQuality]),
266
+ FB_SETTING_MJPEG_SERVER_FRAMERATE: @([FBConfiguration mjpegServerFramerate]),
267
+ FB_SETTING_MJPEG_SCALING_FACTOR: @([FBConfiguration mjpegScalingFactor]),
268
+ FB_SETTING_SCREENSHOT_QUALITY: @([FBConfiguration screenshotQuality]),
269
+ FB_SETTING_KEYBOARD_AUTOCORRECTION: @([FBConfiguration keyboardAutocorrection]),
270
+ FB_SETTING_KEYBOARD_PREDICTION: @([FBConfiguration keyboardPrediction]),
271
+ FB_SETTING_CUSTOM_SNAPSHOT_TIMEOUT: @([FBConfiguration customSnapshotTimeout]),
272
+ FB_SETTING_SNAPSHOT_MAX_DEPTH: @([FBConfiguration snapshotMaxDepth]),
273
+ FB_SETTING_USE_FIRST_MATCH: @([FBConfiguration useFirstMatch]),
274
+ FB_SETTING_WAIT_FOR_IDLE_TIMEOUT: @([FBConfiguration waitForIdleTimeout]),
275
+ FB_SETTING_ANIMATION_COOL_OFF_TIMEOUT: @([FBConfiguration animationCoolOffTimeout]),
276
+ FB_SETTING_BOUND_ELEMENTS_BY_INDEX: @([FBConfiguration boundElementsByIndex]),
277
+ FB_SETTING_REDUCE_MOTION: @([FBConfiguration reduceMotionEnabled]),
278
+ FB_SETTING_DEFAULT_ACTIVE_APPLICATION: request.session.defaultActiveApplication,
279
+ FB_SETTING_ACTIVE_APP_DETECTION_POINT: FBActiveAppDetectionPoint.sharedInstance.stringCoordinates,
280
+ FB_SETTING_INCLUDE_NON_MODAL_ELEMENTS: @([FBConfiguration includeNonModalElements]),
281
+ FB_SETTING_ACCEPT_ALERT_BUTTON_SELECTOR: FBConfiguration.acceptAlertButtonSelector,
282
+ FB_SETTING_DISMISS_ALERT_BUTTON_SELECTOR: FBConfiguration.dismissAlertButtonSelector,
283
+ FB_SETTING_DEFAULT_ALERT_ACTION: request.session.defaultAlertAction ?: @"",
264
284
  #if !TARGET_OS_TV
265
- SCREENSHOT_ORIENTATION: [FBConfiguration humanReadableScreenshotOrientation],
285
+ FB_SETTING_SCREENSHOT_ORIENTATION: [FBConfiguration humanReadableScreenshotOrientation],
266
286
  #endif
267
287
  }
268
288
  );
@@ -274,86 +294,86 @@
274
294
  {
275
295
  NSDictionary* settings = request.arguments[@"settings"];
276
296
 
277
- if (nil != [settings objectForKey:USE_COMPACT_RESPONSES]) {
278
- [FBConfiguration setShouldUseCompactResponses:[[settings objectForKey:USE_COMPACT_RESPONSES] boolValue]];
297
+ if (nil != [settings objectForKey:FB_SETTING_USE_COMPACT_RESPONSES]) {
298
+ [FBConfiguration setShouldUseCompactResponses:[[settings objectForKey:FB_SETTING_USE_COMPACT_RESPONSES] boolValue]];
279
299
  }
280
- if (nil != [settings objectForKey:ELEMENT_RESPONSE_ATTRIBUTES]) {
281
- [FBConfiguration setElementResponseAttributes:(NSString *)[settings objectForKey:ELEMENT_RESPONSE_ATTRIBUTES]];
300
+ if (nil != [settings objectForKey:FB_SETTING_ELEMENT_RESPONSE_ATTRIBUTES]) {
301
+ [FBConfiguration setElementResponseAttributes:(NSString *)[settings objectForKey:FB_SETTING_ELEMENT_RESPONSE_ATTRIBUTES]];
282
302
  }
283
- if (nil != [settings objectForKey:MJPEG_SERVER_SCREENSHOT_QUALITY]) {
284
- [FBConfiguration setMjpegServerScreenshotQuality:[[settings objectForKey:MJPEG_SERVER_SCREENSHOT_QUALITY] unsignedIntegerValue]];
303
+ if (nil != [settings objectForKey:FB_SETTING_MJPEG_SERVER_SCREENSHOT_QUALITY]) {
304
+ [FBConfiguration setMjpegServerScreenshotQuality:[[settings objectForKey:FB_SETTING_MJPEG_SERVER_SCREENSHOT_QUALITY] unsignedIntegerValue]];
285
305
  }
286
- if (nil != [settings objectForKey:MJPEG_SERVER_FRAMERATE]) {
287
- [FBConfiguration setMjpegServerFramerate:[[settings objectForKey:MJPEG_SERVER_FRAMERATE] unsignedIntegerValue]];
306
+ if (nil != [settings objectForKey:FB_SETTING_MJPEG_SERVER_FRAMERATE]) {
307
+ [FBConfiguration setMjpegServerFramerate:[[settings objectForKey:FB_SETTING_MJPEG_SERVER_FRAMERATE] unsignedIntegerValue]];
288
308
  }
289
- if (nil != [settings objectForKey:SCREENSHOT_QUALITY]) {
290
- [FBConfiguration setScreenshotQuality:[[settings objectForKey:SCREENSHOT_QUALITY] unsignedIntegerValue]];
309
+ if (nil != [settings objectForKey:FB_SETTING_SCREENSHOT_QUALITY]) {
310
+ [FBConfiguration setScreenshotQuality:[[settings objectForKey:FB_SETTING_SCREENSHOT_QUALITY] unsignedIntegerValue]];
291
311
  }
292
- if (nil != [settings objectForKey:MJPEG_SCALING_FACTOR]) {
293
- [FBConfiguration setMjpegScalingFactor:[[settings objectForKey:MJPEG_SCALING_FACTOR] unsignedIntegerValue]];
312
+ if (nil != [settings objectForKey:FB_SETTING_MJPEG_SCALING_FACTOR]) {
313
+ [FBConfiguration setMjpegScalingFactor:[[settings objectForKey:FB_SETTING_MJPEG_SCALING_FACTOR] unsignedIntegerValue]];
294
314
  }
295
- if (nil != [settings objectForKey:KEYBOARD_AUTOCORRECTION]) {
296
- [FBConfiguration setKeyboardAutocorrection:[[settings objectForKey:KEYBOARD_AUTOCORRECTION] boolValue]];
315
+ if (nil != [settings objectForKey:FB_SETTING_KEYBOARD_AUTOCORRECTION]) {
316
+ [FBConfiguration setKeyboardAutocorrection:[[settings objectForKey:FB_SETTING_KEYBOARD_AUTOCORRECTION] boolValue]];
297
317
  }
298
- if (nil != [settings objectForKey:KEYBOARD_PREDICTION]) {
299
- [FBConfiguration setKeyboardPrediction:[[settings objectForKey:KEYBOARD_PREDICTION] boolValue]];
318
+ if (nil != [settings objectForKey:FB_SETTING_KEYBOARD_PREDICTION]) {
319
+ [FBConfiguration setKeyboardPrediction:[[settings objectForKey:FB_SETTING_KEYBOARD_PREDICTION] boolValue]];
300
320
  }
301
321
  // SNAPSHOT_TIMEOUT setting is deprecated. Please use CUSTOM_SNAPSHOT_TIMEOUT instead
302
- if (nil != [settings objectForKey:SNAPSHOT_TIMEOUT]) {
303
- [FBConfiguration setCustomSnapshotTimeout:[[settings objectForKey:SNAPSHOT_TIMEOUT] doubleValue]];
322
+ if (nil != [settings objectForKey:FB_SETTING_SNAPSHOT_TIMEOUT]) {
323
+ [FBConfiguration setCustomSnapshotTimeout:[[settings objectForKey:FB_SETTING_SNAPSHOT_TIMEOUT] doubleValue]];
304
324
  }
305
- if (nil != [settings objectForKey:CUSTOM_SNAPSHOT_TIMEOUT]) {
306
- [FBConfiguration setCustomSnapshotTimeout:[[settings objectForKey:CUSTOM_SNAPSHOT_TIMEOUT] doubleValue]];
325
+ if (nil != [settings objectForKey:FB_SETTING_CUSTOM_SNAPSHOT_TIMEOUT]) {
326
+ [FBConfiguration setCustomSnapshotTimeout:[[settings objectForKey:FB_SETTING_CUSTOM_SNAPSHOT_TIMEOUT] doubleValue]];
307
327
  }
308
- if (nil != [settings objectForKey:SNAPSHOT_MAX_DEPTH]) {
309
- [FBConfiguration setSnapshotMaxDepth:[[settings objectForKey:SNAPSHOT_MAX_DEPTH] intValue]];
328
+ if (nil != [settings objectForKey:FB_SETTING_SNAPSHOT_MAX_DEPTH]) {
329
+ [FBConfiguration setSnapshotMaxDepth:[[settings objectForKey:FB_SETTING_SNAPSHOT_MAX_DEPTH] intValue]];
310
330
  }
311
- if (nil != [settings objectForKey:USE_FIRST_MATCH]) {
312
- [FBConfiguration setUseFirstMatch:[[settings objectForKey:USE_FIRST_MATCH] boolValue]];
331
+ if (nil != [settings objectForKey:FB_SETTING_USE_FIRST_MATCH]) {
332
+ [FBConfiguration setUseFirstMatch:[[settings objectForKey:FB_SETTING_USE_FIRST_MATCH] boolValue]];
313
333
  }
314
- if (nil != [settings objectForKey:BOUND_ELEMENTS_BY_INDEX]) {
315
- [FBConfiguration setBoundElementsByIndex:[[settings objectForKey:BOUND_ELEMENTS_BY_INDEX] boolValue]];
334
+ if (nil != [settings objectForKey:FB_SETTING_BOUND_ELEMENTS_BY_INDEX]) {
335
+ [FBConfiguration setBoundElementsByIndex:[[settings objectForKey:FB_SETTING_BOUND_ELEMENTS_BY_INDEX] boolValue]];
316
336
  }
317
- if (nil != [settings objectForKey:REDUCE_MOTION]) {
318
- [FBConfiguration setReduceMotionEnabled:[[settings objectForKey:REDUCE_MOTION] boolValue]];
337
+ if (nil != [settings objectForKey:FB_SETTING_REDUCE_MOTION]) {
338
+ [FBConfiguration setReduceMotionEnabled:[[settings objectForKey:FB_SETTING_REDUCE_MOTION] boolValue]];
319
339
  }
320
- if (nil != [settings objectForKey:DEFAULT_ACTIVE_APPLICATION]) {
321
- request.session.defaultActiveApplication = (NSString *)[settings objectForKey:DEFAULT_ACTIVE_APPLICATION];
340
+ if (nil != [settings objectForKey:FB_SETTING_DEFAULT_ACTIVE_APPLICATION]) {
341
+ request.session.defaultActiveApplication = (NSString *)[settings objectForKey:FB_SETTING_DEFAULT_ACTIVE_APPLICATION];
322
342
  }
323
- if (nil != [settings objectForKey:ACTIVE_APP_DETECTION_POINT]) {
343
+ if (nil != [settings objectForKey:FB_SETTING_ACTIVE_APP_DETECTION_POINT]) {
324
344
  NSError *error;
325
- if (![FBActiveAppDetectionPoint.sharedInstance setCoordinatesWithString:(NSString *)[settings objectForKey:ACTIVE_APP_DETECTION_POINT]
345
+ if (![FBActiveAppDetectionPoint.sharedInstance setCoordinatesWithString:(NSString *)[settings objectForKey:FB_SETTING_ACTIVE_APP_DETECTION_POINT]
326
346
  error:&error]) {
327
347
  return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:error.description traceback:nil]);
328
348
  }
329
349
  }
330
- if (nil != [settings objectForKey:INCLUDE_NON_MODAL_ELEMENTS]) {
350
+ if (nil != [settings objectForKey:FB_SETTING_INCLUDE_NON_MODAL_ELEMENTS]) {
331
351
  if ([XCUIElement fb_supportsNonModalElementsInclusion]) {
332
- [FBConfiguration setIncludeNonModalElements:[[settings objectForKey:INCLUDE_NON_MODAL_ELEMENTS] boolValue]];
352
+ [FBConfiguration setIncludeNonModalElements:[[settings objectForKey:FB_SETTING_INCLUDE_NON_MODAL_ELEMENTS] boolValue]];
333
353
  } else {
334
- [FBLogger logFmt:@"'%@' settings value cannot be assigned, because non modal elements inclusion is not supported by the current iOS SDK", INCLUDE_NON_MODAL_ELEMENTS];
354
+ [FBLogger logFmt:@"'%@' settings value cannot be assigned, because non modal elements inclusion is not supported by the current iOS SDK", FB_SETTING_INCLUDE_NON_MODAL_ELEMENTS];
335
355
  }
336
356
  }
337
- if (nil != [settings objectForKey:ACCEPT_ALERT_BUTTON_SELECTOR]) {
338
- [FBConfiguration setAcceptAlertButtonSelector:(NSString *)[settings objectForKey:ACCEPT_ALERT_BUTTON_SELECTOR]];
357
+ if (nil != [settings objectForKey:FB_SETTING_ACCEPT_ALERT_BUTTON_SELECTOR]) {
358
+ [FBConfiguration setAcceptAlertButtonSelector:(NSString *)[settings objectForKey:FB_SETTING_ACCEPT_ALERT_BUTTON_SELECTOR]];
339
359
  }
340
- if (nil != [settings objectForKey:DISMISS_ALERT_BUTTON_SELECTOR]) {
341
- [FBConfiguration setDismissAlertButtonSelector:(NSString *)[settings objectForKey:DISMISS_ALERT_BUTTON_SELECTOR]];
360
+ if (nil != [settings objectForKey:FB_SETTING_DISMISS_ALERT_BUTTON_SELECTOR]) {
361
+ [FBConfiguration setDismissAlertButtonSelector:(NSString *)[settings objectForKey:FB_SETTING_DISMISS_ALERT_BUTTON_SELECTOR]];
342
362
  }
343
- if (nil != [settings objectForKey:WAIT_FOR_IDLE_TIMEOUT]) {
344
- [FBConfiguration setWaitForIdleTimeout:[[settings objectForKey:WAIT_FOR_IDLE_TIMEOUT] doubleValue]];
363
+ if (nil != [settings objectForKey:FB_SETTING_WAIT_FOR_IDLE_TIMEOUT]) {
364
+ [FBConfiguration setWaitForIdleTimeout:[[settings objectForKey:FB_SETTING_WAIT_FOR_IDLE_TIMEOUT] doubleValue]];
345
365
  }
346
- if (nil != [settings objectForKey:ANIMATION_COOL_OFF_TIMEOUT]) {
347
- [FBConfiguration setAnimationCoolOffTimeout:[[settings objectForKey:ANIMATION_COOL_OFF_TIMEOUT] doubleValue]];
366
+ if (nil != [settings objectForKey:FB_SETTING_ANIMATION_COOL_OFF_TIMEOUT]) {
367
+ [FBConfiguration setAnimationCoolOffTimeout:[[settings objectForKey:FB_SETTING_ANIMATION_COOL_OFF_TIMEOUT] doubleValue]];
348
368
  }
349
- if ([[settings objectForKey:DEFAULT_ALERT_ACTION] isKindOfClass:NSString.class]) {
350
- request.session.defaultAlertAction = [settings[DEFAULT_ALERT_ACTION] lowercaseString];
369
+ if ([[settings objectForKey:FB_SETTING_DEFAULT_ALERT_ACTION] isKindOfClass:NSString.class]) {
370
+ request.session.defaultAlertAction = [settings[FB_SETTING_DEFAULT_ALERT_ACTION] lowercaseString];
351
371
  }
352
372
 
353
373
  #if !TARGET_OS_TV
354
- if (nil != [settings objectForKey:SCREENSHOT_ORIENTATION]) {
374
+ if (nil != [settings objectForKey:FB_SETTING_SCREENSHOT_ORIENTATION]) {
355
375
  NSError *error;
356
- if (![FBConfiguration setScreenshotOrientation:(NSString *)[settings objectForKey:SCREENSHOT_ORIENTATION]
376
+ if (![FBConfiguration setScreenshotOrientation:(NSString *)[settings objectForKey:FB_SETTING_SCREENSHOT_ORIENTATION]
357
377
  error:&error]) {
358
378
  return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:error.description traceback:nil]);
359
379
  }
@@ -149,7 +149,7 @@ static const NSTimeInterval APP_STATE_CHANGE_TIMEOUT = 5.0;
149
149
  if ([FBXCAXClientProxy.sharedClient hasProcessTracker]) {
150
150
  return (FBApplication *)[FBXCAXClientProxy.sharedClient monitoredApplicationWithProcessIdentifier:processID];
151
151
  }
152
- return [super applicationWithPID:processID];
152
+ return [super applicationWithPID:processID];
153
153
  }
154
154
 
155
155
  - (void)launch