Capture accessibility hierarchy and package it for the sonar plugin
Summary: In this diff we load and call a private API enabling voiceover hierarchy and pass it over via existing channel when client is in the accessibility mode Reviewed By: lblasa Differential Revision: D49393813 fbshipit-source-id: 437af1131547218cd52f4a56797707411787d7cf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3f0e1f76d5
commit
550b49e690
@@ -8,6 +8,7 @@
|
||||
#if FB_SONARKIT_ENABLED
|
||||
|
||||
#import "UIDTreeObserver.h"
|
||||
#import "UIDAllyTraversal.h"
|
||||
#import "UIDContext.h"
|
||||
#import "UIDHierarchyTraversal.h"
|
||||
#import "UIDTimeUtilities.h"
|
||||
@@ -39,15 +40,29 @@
|
||||
|
||||
uint64_t t0 = UIDPerformanceNow();
|
||||
|
||||
UIDHierarchyTraversal* traversal = [UIDHierarchyTraversal
|
||||
createWithDescriptorRegister:context.descriptorRegister];
|
||||
|
||||
UIDNodeDescriptor* descriptor =
|
||||
[context.descriptorRegister descriptorForClass:[node class]];
|
||||
UIDNodeDescriptor* rootDescriptor = [context.descriptorRegister
|
||||
descriptorForClass:[context.application class]];
|
||||
|
||||
NSArray* nodes = [traversal traverse:node];
|
||||
NSArray* nodes;
|
||||
switch (_traversalMode) {
|
||||
case UIDTraversalModeViewHierarchy: {
|
||||
UIDHierarchyTraversal* const traversal = [UIDHierarchyTraversal
|
||||
createWithDescriptorRegister:context.descriptorRegister];
|
||||
nodes = [traversal traverse:node];
|
||||
break;
|
||||
}
|
||||
case UIDTraversalModeAccessibilityHierarchy: {
|
||||
UIDAllyTraversal* allyTraversal = [[UIDAllyTraversal alloc]
|
||||
initWithDescriptorRegister:context.descriptorRegister];
|
||||
nodes = [allyTraversal traverse:context.application root:node];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Unexpected value, abort
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t t1 = UIDPerformanceNow();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user