5 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_
8 #import <UIKit/UIKit.h>
11 #include <unordered_map>
12 #include <unordered_set>
15 #include "flutter/fml/macros.h"
16 #include "flutter/fml/memory/weak_ptr.h"
17 #include "flutter/lib/ui/semantics/custom_accessibility_action.h"
18 #include "flutter/lib/ui/semantics/semantics_node.h"
54 std::unique_ptr<IosDelegate> ios_delegate =
nullptr);
62 const flutter::CustomAccessibilityActionUpdates& actions);
65 void HandleEvent(NSDictionary<NSString*, id>* annotatedEvent);
68 flutter::SemanticsAction action,
69 fml::MallocMapping args)
override;
76 UIView*
view()
const override {
return view_controller_.view; }
78 UIView*
ViewIfLoaded()
const override {
return view_controller_.viewIfLoaded; }
81 return ViewIfLoaded() ?: accessibility_element_init_container_;
89 return platform_views_controller_;
95 bool AccessibilityElementsWereInstalledByBridge(NSArray* elements)
const;
96 void ClearAccessibilityElementsIfOwnedByBridge(UIView*
view);
97 void UpdateAccessibilityElementsForCurrentView();
98 void NotifySemanticsObjectsViewChanged();
99 SemanticsObject* GetOrCreateObject(int32_t
id, flutter::SemanticsNodeUpdates& updates);
107 NSMutableArray<NSNumber*>* doomed_uids);
110 UIView* accessibility_element_init_container_;
117 static constexpr int32_t kSemanticObjectIdInvalid = -1;
118 int32_t last_focused_semantics_object_id_ = kSemanticObjectIdInvalid;
120 NSMutableDictionary<NSNumber*, SemanticsObject*>* objects_;
122 int32_t previous_route_id_ = 0;
123 std::unordered_map<int32_t, flutter::CustomAccessibilityAction> actions_;
124 std::vector<int32_t> previous_routes_;
125 std::unique_ptr<IosDelegate> ios_delegate_;
126 fml::WeakPtrFactory<AccessibilityBridge> weak_factory_;
FlutterViewController * viewController
virtual void PostAccessibilityNotification(UIAccessibilityNotifications notification, id argument)=0
virtual bool IsFlutterViewControllerPresentingModalViewController(FlutterViewController *view_controller)=0
virtual ~IosDelegate()=default
void UpdateSemantics(flutter::SemanticsNodeUpdates nodes, const flutter::CustomAccessibilityActionUpdates &actions)
void DispatchSemanticsAction(int32_t id, flutter::SemanticsAction action) override
void AccessibilityObjectDidLoseFocus(int32_t id) override
FlutterPlatformViewsController * GetPlatformViewsController() const override
AccessibilityBridge(FlutterViewController *view_controller, PlatformViewIOS *platform_view, __weak FlutterPlatformViewsController *platform_views_controller, std::unique_ptr< IosDelegate > ios_delegate=nullptr)
void SetViewController(FlutterViewController *viewController, FlutterView *previousView)
bool HasSemantics() const
UIView * AccessibilityElementInitializationContainer() const override
void DispatchSemanticsAction(int32_t id, flutter::SemanticsAction action, fml::MallocMapping args) override
bool isVoiceOverRunning() const override
void HandleEvent(NSDictionary< NSString *, id > *annotatedEvent)
NSString * GetDefaultLocale() override
fml::WeakPtr< AccessibilityBridge > GetWeakPtr()
UIView< UITextInput > * textInputView() override
UIView * view() const override
UIView * ViewIfLoaded() const override
void AccessibilityObjectDidBecomeFocused(int32_t id) override
Interface that represents an accessibility bridge for iOS.