20static constexpr char kTypeKey[] =
"type";
21static constexpr char kDataKey[] =
"data";
22static constexpr char kMessageKey[] =
"message";
24static constexpr char kAnnounceValue[] =
"announce";
28void HandleMessage(AccessibilityPlugin* plugin,
const EncodableValue&
message) {
29 const auto* map = std::get_if<EncodableMap>(&
message);
31 FML_LOG(ERROR) <<
"Accessibility message must be a map.";
34 const auto& type_itr = map->find(EncodableValue{
kTypeKey});
35 const auto& data_itr = map->find(EncodableValue{kDataKey});
36 if (type_itr == map->end()) {
37 FML_LOG(ERROR) <<
"Accessibility message must have a 'type' property.";
40 if (data_itr == map->end()) {
41 FML_LOG(ERROR) <<
"Accessibility message must have a 'data' property.";
44 const auto*
type = std::get_if<std::string>(&type_itr->second);
45 const auto*
data = std::get_if<EncodableMap>(&data_itr->second);
47 FML_LOG(ERROR) <<
"Accessibility message 'type' property must be a string.";
51 FML_LOG(ERROR) <<
"Accessibility message 'data' property must be a map.";
55 if (
type->compare(kAnnounceValue) == 0) {
56 const auto& message_itr =
data->find(EncodableValue{kMessageKey});
57 if (message_itr ==
data->end()) {
60 const auto*
message = std::get_if<std::string>(&message_itr->second);
66 if (view_itr ==
data->end()) {
67 FML_LOG(ERROR) <<
"Announce message 'viewId' property is missing.";
71 const auto* view_id_val = std::get_if<FlutterViewId>(&view_itr->second);
74 <<
"Announce message 'viewId' property must be a FlutterViewId.";
78 plugin->Announce(*view_id_val, *
message);
80 FML_LOG(WARNING) <<
"Accessibility message type '" << *
type
81 <<
"' is not supported.";
107 const std::string_view
message) {
118 view->AnnounceAlert(wide_text);
AccessibilityPlugin(FlutterWindowsEngine *engine)
static void SetUp(BinaryMessenger *binary_messenger, AccessibilityPlugin *plugin)
virtual void Announce(const FlutterViewId view_id, const std::string_view message)
FlutterWindowsView * view(FlutterViewId view_id) const
bool semantics_enabled() const
static const StandardMessageCodec & GetInstance(const StandardCodecSerializer *serializer=nullptr)
G_BEGIN_DECLS GBytes * message
G_BEGIN_DECLS FlutterViewId view_id
static constexpr char kViewIdKey[]
static constexpr char kAccessibilityChannelName[]
#define FML_LOG(severity)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
constexpr char kTypeKey[]
std::function< void(const T &reply)> MessageReply
std::wstring Utf8ToWideString(const std::string_view str)