forked from appium/WebDriverAgent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFBConfiguration.m
More file actions
667 lines (559 loc) · 19.2 KB
/
FBConfiguration.m
File metadata and controls
667 lines (559 loc) · 19.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
/**
* 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. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "FBConfiguration.h"
#import "AXSettings.h"
#import "UIKeyboardImpl.h"
#import "TIPreferencesController.h"
#include <dlfcn.h>
#import <UIKit/UIKit.h>
#include "TargetConditionals.h"
#import "FBXCodeCompatibility.h"
#import "XCAXClient_iOS+FBSnapshotReqParams.h"
#import "XCTestPrivateSymbols.h"
#import "XCTestConfiguration.h"
#import "XCUIApplication+FBUIInterruptions.h"
static NSUInteger const DefaultStartingPort = 8100;
static NSUInteger const DefaultMjpegServerPort = 9100;
static NSUInteger const DefaultPortRange = 100;
static char const *const controllerPrefBundlePath = "/System/Library/PrivateFrameworks/TextInput.framework/TextInput";
static NSString *const controllerClassName = @"TIPreferencesController";
static NSString *const FBKeyboardAutocorrectionKey = @"KeyboardAutocorrection";
static NSString *const FBKeyboardPredictionKey = @"KeyboardPrediction";
static NSString *const axSettingsClassName = @"AXSettings";
static BOOL FBShouldUseTestManagerForVisibilityDetection = NO;
static BOOL FBShouldUseSingletonTestManager = YES;
static BOOL FBShouldRespectSystemAlerts = NO;
static CGFloat FBMjpegScalingFactor = 100.0;
static BOOL FBMjpegShouldFixOrientation = NO;
static NSUInteger FBMjpegServerScreenshotQuality = 25;
static NSUInteger FBMjpegServerFramerate = 10;
// Session-specific settings
static BOOL FBShouldTerminateApp;
static NSNumber* FBMaxTypingFrequency;
static NSUInteger FBScreenshotQuality;
static BOOL FBShouldUseFirstMatch;
static BOOL FBShouldBoundElementsByIndex;
static BOOL FBIncludeNonModalElements;
static NSString *FBAcceptAlertButtonSelector;
static NSString *FBDismissAlertButtonSelector;
static NSString *FBAutoClickAlertSelector;
static NSTimeInterval FBWaitForIdleTimeout;
static NSTimeInterval FBAnimationCoolOffTimeout;
static BOOL FBShouldUseCompactResponses;
static NSString *FBElementResponseAttributes;
static BOOL FBUseClearTextShortcut;
static BOOL FBLimitXpathContextScope = YES;
#if !TARGET_OS_TV
static UIInterfaceOrientation FBScreenshotOrientation;
#endif
static BOOL FBShouldIncludeHittableInPageSource = NO;
static BOOL FBShouldIncludeNativeFrameInPageSource = NO;
@implementation FBConfiguration
+ (NSUInteger)defaultTypingFrequency
{
NSInteger defaultFreq = [[NSUserDefaults standardUserDefaults]
integerForKey:@"com.apple.xctest.iOSMaximumTypingFrequency"];
return defaultFreq > 0 ? defaultFreq : 60;
}
+ (void)initialize
{
[FBConfiguration resetSessionSettings];
}
#pragma mark Public
+ (void)disableRemoteQueryEvaluation
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"XCTDisableRemoteQueryEvaluation"];
}
+ (void)disableApplicationUIInterruptionsHandling
{
[XCUIApplication fb_disableUIInterruptionsHandling];
}
+ (void)enableXcTestDebugLogs
{
((XCTestConfiguration *)XCTestConfiguration.activeTestConfiguration).emitOSLogs = YES;
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"XCTEmitOSLogs"];
}
+ (void)disableAttributeKeyPathAnalysis
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"XCTDisableAttributeKeyPathAnalysis"];
}
+ (void)disableScreenshots
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"DisableScreenshots"];
}
+ (void)enableScreenshots
{
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"DisableScreenshots"];
}
+ (void)disableScreenRecordings
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"DisableDiagnosticScreenRecordings"];
}
+ (void)enableScreenRecordings
{
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"DisableDiagnosticScreenRecordings"];
}
+ (NSRange)bindingPortRange
{
// 'WebDriverAgent --port 8080' can be passed via the arguments to the process
if (self.bindingPortRangeFromArguments.location != NSNotFound) {
return self.bindingPortRangeFromArguments;
}
// Existence of USE_PORT in the environment implies the port range is managed by the launching process.
if (NSProcessInfo.processInfo.environment[@"USE_PORT"] &&
[NSProcessInfo.processInfo.environment[@"USE_PORT"] length] > 0) {
return NSMakeRange([NSProcessInfo.processInfo.environment[@"USE_PORT"] integerValue] , 1);
}
return NSMakeRange(DefaultStartingPort, DefaultPortRange);
}
+ (NSInteger)mjpegServerPort
{
if (self.mjpegServerPortFromArguments != NSNotFound) {
return self.mjpegServerPortFromArguments;
}
if (NSProcessInfo.processInfo.environment[@"MJPEG_SERVER_PORT"] &&
[NSProcessInfo.processInfo.environment[@"MJPEG_SERVER_PORT"] length] > 0) {
return [NSProcessInfo.processInfo.environment[@"MJPEG_SERVER_PORT"] integerValue];
}
return DefaultMjpegServerPort;
}
+ (CGFloat)mjpegScalingFactor
{
return FBMjpegScalingFactor;
}
+ (void)setMjpegScalingFactor:(CGFloat)scalingFactor {
FBMjpegScalingFactor = scalingFactor;
}
+ (BOOL)mjpegShouldFixOrientation
{
return FBMjpegShouldFixOrientation;
}
+ (void)setMjpegShouldFixOrientation:(BOOL)enabled {
FBMjpegShouldFixOrientation = enabled;
}
+ (BOOL)verboseLoggingEnabled
{
return [NSProcessInfo.processInfo.environment[@"VERBOSE_LOGGING"] boolValue];
}
+ (void)setShouldUseTestManagerForVisibilityDetection:(BOOL)value
{
FBShouldUseTestManagerForVisibilityDetection = value;
}
+ (BOOL)shouldUseTestManagerForVisibilityDetection
{
return FBShouldUseTestManagerForVisibilityDetection;
}
+ (void)setShouldUseCompactResponses:(BOOL)value
{
FBShouldUseCompactResponses = value;
}
+ (BOOL)shouldUseCompactResponses
{
return FBShouldUseCompactResponses;
}
+ (void)setShouldTerminateApp:(BOOL)value
{
FBShouldTerminateApp = value;
}
+ (BOOL)shouldTerminateApp
{
return FBShouldTerminateApp;
}
+ (void)setElementResponseAttributes:(NSString *)value
{
FBElementResponseAttributes = value;
}
+ (NSString *)elementResponseAttributes
{
return FBElementResponseAttributes;
}
+ (void)setMaxTypingFrequency:(NSUInteger)value
{
FBMaxTypingFrequency = @(value);
}
+ (NSUInteger)maxTypingFrequency
{
if (nil == FBMaxTypingFrequency) {
return [self defaultTypingFrequency];
}
return FBMaxTypingFrequency.integerValue <= 0
? [self defaultTypingFrequency]
: FBMaxTypingFrequency.integerValue;
}
+ (void)setShouldUseSingletonTestManager:(BOOL)value
{
FBShouldUseSingletonTestManager = value;
}
+ (BOOL)shouldUseSingletonTestManager
{
return FBShouldUseSingletonTestManager;
}
+ (NSUInteger)mjpegServerFramerate
{
return FBMjpegServerFramerate;
}
+ (void)setMjpegServerFramerate:(NSUInteger)framerate
{
FBMjpegServerFramerate = framerate;
}
+ (NSUInteger)mjpegServerScreenshotQuality
{
return FBMjpegServerScreenshotQuality;
}
+ (void)setMjpegServerScreenshotQuality:(NSUInteger)quality
{
FBMjpegServerScreenshotQuality = quality;
}
+ (NSUInteger)screenshotQuality
{
return FBScreenshotQuality;
}
+ (void)setScreenshotQuality:(NSUInteger)quality
{
FBScreenshotQuality = quality;
}
+ (NSTimeInterval)waitForIdleTimeout
{
return FBWaitForIdleTimeout;
}
+ (void)setWaitForIdleTimeout:(NSTimeInterval)timeout
{
FBWaitForIdleTimeout = timeout;
}
+ (NSTimeInterval)animationCoolOffTimeout
{
return FBAnimationCoolOffTimeout;
}
+ (void)setAnimationCoolOffTimeout:(NSTimeInterval)timeout
{
FBAnimationCoolOffTimeout = timeout;
}
// Works for Simulator and Real devices
+ (void)configureDefaultKeyboardPreferences
{
void *handle = dlopen(controllerPrefBundlePath, RTLD_LAZY);
Class controllerClass = NSClassFromString(controllerClassName);
TIPreferencesController *controller = [controllerClass sharedPreferencesController];
// Auto-Correction in Keyboards
// 'setAutocorrectionEnabled' Was in TextInput.framework/TIKeyboardState.h over iOS 10.3
if ([controller respondsToSelector:@selector(setAutocorrectionEnabled:)]) {
// Under iOS 10.2
controller.autocorrectionEnabled = NO;
} else if ([controller respondsToSelector:@selector(setValue:forPreferenceKey:)]) {
// Over iOS 10.3
[controller setValue:@NO forPreferenceKey:FBKeyboardAutocorrectionKey];
}
// Predictive in Keyboards
if ([controller respondsToSelector:@selector(setPredictionEnabled:)]) {
controller.predictionEnabled = NO;
} else if ([controller respondsToSelector:@selector(setValue:forPreferenceKey:)]) {
[controller setValue:@NO forPreferenceKey:FBKeyboardPredictionKey];
}
// To dismiss keyboard tutorial on iOS 11+ (iPad)
if ([controller respondsToSelector:@selector(setValue:forPreferenceKey:)]) {
[controller setValue:@YES forPreferenceKey:@"DidShowGestureKeyboardIntroduction"];
if (isSDKVersionGreaterThanOrEqualTo(@"13.0")) {
[controller setValue:@YES forPreferenceKey:@"DidShowContinuousPathIntroduction"];
}
[controller synchronizePreferences];
}
dlclose(handle);
}
+ (void)forceSimulatorSoftwareKeyboardPresence
{
#if TARGET_OS_SIMULATOR
// Force toggle software keyboard on.
// This can avoid 'Keyboard is not present' error which can happen
// when send_keys are called by client
[[UIKeyboardImpl sharedInstance] setAutomaticMinimizationEnabled:NO];
if ([(NSObject *)[UIKeyboardImpl sharedInstance]
respondsToSelector:@selector(setSoftwareKeyboardShownByTouch:)]) {
// Xcode 13 no longer has this method
[[UIKeyboardImpl sharedInstance] setSoftwareKeyboardShownByTouch:YES];
}
#endif
}
+ (FBConfigurationKeyboardPreference)keyboardAutocorrection
{
return [self keyboardsPreference:FBKeyboardAutocorrectionKey];
}
+ (void)setKeyboardAutocorrection:(BOOL)isEnabled
{
[self configureKeyboardsPreference:isEnabled forPreferenceKey:FBKeyboardAutocorrectionKey];
}
+ (FBConfigurationKeyboardPreference)keyboardPrediction
{
return [self keyboardsPreference:FBKeyboardPredictionKey];
}
+ (void)setKeyboardPrediction:(BOOL)isEnabled
{
[self configureKeyboardsPreference:isEnabled forPreferenceKey:FBKeyboardPredictionKey];
}
+ (void)setSnapshotMaxDepth:(int)maxDepth
{
FBSetCustomParameterForElementSnapshot(FBSnapshotMaxDepthKey, @(maxDepth));
}
+ (int)snapshotMaxDepth
{
return [FBGetCustomParameterForElementSnapshot(FBSnapshotMaxDepthKey) intValue];
}
+ (void)setShouldRespectSystemAlerts:(BOOL)value
{
FBShouldRespectSystemAlerts = value;
}
+ (BOOL)shouldRespectSystemAlerts
{
return FBShouldRespectSystemAlerts;
}
+ (void)setUseFirstMatch:(BOOL)enabled
{
FBShouldUseFirstMatch = enabled;
}
+ (BOOL)useFirstMatch
{
return FBShouldUseFirstMatch;
}
+ (void)setBoundElementsByIndex:(BOOL)enabled
{
FBShouldBoundElementsByIndex = enabled;
}
+ (BOOL)boundElementsByIndex
{
return FBShouldBoundElementsByIndex;
}
+ (void)setIncludeNonModalElements:(BOOL)isEnabled
{
FBIncludeNonModalElements = isEnabled;
}
+ (BOOL)includeNonModalElements
{
return FBIncludeNonModalElements;
}
+ (void)setAcceptAlertButtonSelector:(NSString *)classChainSelector
{
FBAcceptAlertButtonSelector = classChainSelector;
}
+ (NSString *)acceptAlertButtonSelector
{
return FBAcceptAlertButtonSelector;
}
+ (void)setDismissAlertButtonSelector:(NSString *)classChainSelector
{
FBDismissAlertButtonSelector = classChainSelector;
}
+ (NSString *)dismissAlertButtonSelector
{
return FBDismissAlertButtonSelector;
}
+ (void)setAutoClickAlertSelector:(NSString *)classChainSelector
{
FBAutoClickAlertSelector = classChainSelector;
}
+ (NSString *)autoClickAlertSelector
{
return FBAutoClickAlertSelector;
}
+ (void)setUseClearTextShortcut:(BOOL)enabled
{
FBUseClearTextShortcut = enabled;
}
+ (BOOL)useClearTextShortcut
{
return FBUseClearTextShortcut;
}
+ (BOOL)limitXpathContextScope
{
return FBLimitXpathContextScope;
}
+ (void)setLimitXpathContextScope:(BOOL)enabled
{
FBLimitXpathContextScope = enabled;
}
#if !TARGET_OS_TV
+ (BOOL)setScreenshotOrientation:(NSString *)orientation error:(NSError **)error
{
// Only UIInterfaceOrientationUnknown is over iOS 8. Others are over iOS 2.
// https://developer.apple.com/documentation/uikit/uiinterfaceorientation/uiinterfaceorientationunknown
if ([orientation.lowercaseString isEqualToString:@"portrait"]) {
FBScreenshotOrientation = UIInterfaceOrientationPortrait;
} else if ([orientation.lowercaseString isEqualToString:@"portraitupsidedown"]) {
FBScreenshotOrientation = UIInterfaceOrientationPortraitUpsideDown;
} else if ([orientation.lowercaseString isEqualToString:@"landscaperight"]) {
FBScreenshotOrientation = UIInterfaceOrientationLandscapeRight;
} else if ([orientation.lowercaseString isEqualToString:@"landscapeleft"]) {
FBScreenshotOrientation = UIInterfaceOrientationLandscapeLeft;
} else if ([orientation.lowercaseString isEqualToString:@"auto"]) {
FBScreenshotOrientation = UIInterfaceOrientationUnknown;
} else {
return [[FBErrorBuilder.builder withDescriptionFormat:
@"The orientation value '%@' is not known. Only the following orientation values are supported: " \
"'auto', 'portrait', 'portraitUpsideDown', 'landscapeRight' and 'landscapeLeft'", orientation]
buildError:error];
}
return YES;
}
+ (NSInteger)screenshotOrientation
{
return FBScreenshotOrientation;
}
+ (NSString *)humanReadableScreenshotOrientation
{
switch (FBScreenshotOrientation) {
case UIInterfaceOrientationPortrait:
return @"portrait";
case UIInterfaceOrientationPortraitUpsideDown:
return @"portraitUpsideDown";
case UIInterfaceOrientationLandscapeRight:
return @"landscapeRight";
case UIInterfaceOrientationLandscapeLeft:
return @"landscapeLeft";
case UIInterfaceOrientationUnknown:
return @"auto";
}
}
#endif
+ (void)resetSessionSettings
{
FBShouldTerminateApp = YES;
FBShouldUseCompactResponses = YES;
FBElementResponseAttributes = @"type,label";
FBMaxTypingFrequency = @([self defaultTypingFrequency]);
FBScreenshotQuality = 3;
FBShouldUseFirstMatch = NO;
FBShouldBoundElementsByIndex = NO;
// This is diabled by default because enabling it prevents the accessbility snapshot to be taken
// (it always errors with kxIllegalArgument error)
FBIncludeNonModalElements = NO;
FBAcceptAlertButtonSelector = @"";
FBDismissAlertButtonSelector = @"";
FBAutoClickAlertSelector = @"";
FBWaitForIdleTimeout = 10.;
FBAnimationCoolOffTimeout = 2.;
// 50 should be enough for the majority of the cases. The performance is acceptable for values up to 100.
FBSetCustomParameterForElementSnapshot(FBSnapshotMaxDepthKey, @50);
FBUseClearTextShortcut = YES;
FBLimitXpathContextScope = YES;
#if !TARGET_OS_TV
FBScreenshotOrientation = UIInterfaceOrientationUnknown;
#endif
}
#pragma mark Private
+ (FBConfigurationKeyboardPreference)keyboardsPreference:(nonnull NSString *)key
{
Class controllerClass = NSClassFromString(controllerClassName);
TIPreferencesController *controller = [controllerClass sharedPreferencesController];
if ([key isEqualToString:FBKeyboardAutocorrectionKey]) {
if ([controller respondsToSelector:@selector(boolForPreferenceKey:)]) {
return [controller boolForPreferenceKey:FBKeyboardAutocorrectionKey]
? FBConfigurationKeyboardPreferenceEnabled
: FBConfigurationKeyboardPreferenceDisabled;
} else {
[FBLogger log:@"Updating keyboard autocorrection preference is not supported"];
return FBConfigurationKeyboardPreferenceNotSupported;
}
} else if ([key isEqualToString:FBKeyboardPredictionKey]) {
if ([controller respondsToSelector:@selector(boolForPreferenceKey:)]) {
return [controller boolForPreferenceKey:FBKeyboardPredictionKey]
? FBConfigurationKeyboardPreferenceEnabled
: FBConfigurationKeyboardPreferenceDisabled;
} else {
[FBLogger log:@"Updating keyboard prediction preference is not supported"];
return FBConfigurationKeyboardPreferenceNotSupported;
}
}
@throw [[FBErrorBuilder.builder withDescriptionFormat:@"No available keyboardsPreferenceKey: '%@'", key] build];
}
+ (void)configureKeyboardsPreference:(BOOL)enable forPreferenceKey:(nonnull NSString *)key
{
void *handle = dlopen(controllerPrefBundlePath, RTLD_LAZY);
Class controllerClass = NSClassFromString(controllerClassName);
TIPreferencesController *controller = [controllerClass sharedPreferencesController];
if ([key isEqualToString:FBKeyboardAutocorrectionKey]) {
// Auto-Correction in Keyboards
if ([controller respondsToSelector:@selector(setAutocorrectionEnabled:)]) {
controller.autocorrectionEnabled = enable;
} else {
[controller setValue:@(enable) forPreferenceKey:FBKeyboardAutocorrectionKey];
}
} else if ([key isEqualToString:FBKeyboardPredictionKey]) {
// Predictive in Keyboards
if ([controller respondsToSelector:@selector(setPredictionEnabled:)]) {
controller.predictionEnabled = enable;
} else {
[controller setValue:@(enable) forPreferenceKey:FBKeyboardPredictionKey];
}
}
[controller synchronizePreferences];
dlclose(handle);
}
+ (NSString*)valueFromArguments: (NSArray<NSString *> *)arguments forKey: (NSString*)key
{
NSUInteger index = [arguments indexOfObject:key];
if (index == NSNotFound || index == arguments.count - 1) {
return nil;
}
return arguments[index + 1];
}
+ (NSUInteger)mjpegServerPortFromArguments
{
NSString *portNumberString = [self valueFromArguments: NSProcessInfo.processInfo.arguments
forKey: @"--mjpeg-server-port"];
NSUInteger port = (NSUInteger)[portNumberString integerValue];
if (port == 0) {
return NSNotFound;
}
return port;
}
+ (NSRange)bindingPortRangeFromArguments
{
NSString *portNumberString = [self valueFromArguments:NSProcessInfo.processInfo.arguments
forKey: @"--port"];
NSUInteger port = (NSUInteger)[portNumberString integerValue];
if (port == 0) {
return NSMakeRange(NSNotFound, 0);
}
return NSMakeRange(port, 1);
}
+ (void)setReduceMotionEnabled:(BOOL)isEnabled
{
Class settingsClass = NSClassFromString(axSettingsClassName);
AXSettings *settings = [settingsClass sharedInstance];
// Below does not work on real devices because of iOS security model
// (lldb) po settings.reduceMotionEnabled = isEnabled
// 2019-08-21 22:58:19.776165+0900 WebDriverAgentRunner-Runner[322:13361] [User Defaults] Couldn't write value for key ReduceMotionEnabled in CFPrefsPlistSource<0x28111a700> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
if ([settings respondsToSelector:@selector(setReduceMotionEnabled:)]) {
[settings setReduceMotionEnabled:isEnabled];
}
}
+ (BOOL)reduceMotionEnabled
{
Class settingsClass = NSClassFromString(axSettingsClassName);
AXSettings *settings = [settingsClass sharedInstance];
if ([settings respondsToSelector:@selector(reduceMotionEnabled)]) {
return settings.reduceMotionEnabled;
}
return NO;
}
+ (void)setIncludeHittableInPageSource:(BOOL)enabled
{
FBShouldIncludeHittableInPageSource = enabled;
}
+ (BOOL)includeHittableInPageSource
{
return FBShouldIncludeHittableInPageSource;
}
+ (void)setIncludeNativeFrameInPageSource:(BOOL)enabled
{
FBShouldIncludeNativeFrameInPageSource = enabled;
}
+ (BOOL)includeNativeFrameInPageSource
{
return FBShouldIncludeNativeFrameInPageSource;
}
@end