20static constexpr char kTypeKey[] =
"type";
21static constexpr char kDataKey[] =
"data";
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) {
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.";
72 auto const view_id = view_itr->second.TryGetLongValue();
75 <<
"Announce message 'viewId' property must be a FlutterViewId.";
81 FML_LOG(WARNING) <<
"Accessibility message type '" << *
type
82 <<
"' is not supported.";
108 const std::string_view
message) {
119 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)
static constexpr char kViewIdKey[]
static constexpr char kMessageKey[]
static constexpr char kDataKey[]
G_BEGIN_DECLS FlutterViewId view_id
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)