From f2152f1e0d58c2d41adfe08b000933e700be701f Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Thu, 11 Apr 2024 16:59:24 -0700 Subject: [PATCH] Update iOS KeyCodeMap dictionary literal and migrate to ARC (flutter/engine#51981) Framework template updated in https://github.com/flutter/flutter/pull/146481. See [gen_keycodes README](https://github.com/flutter/flutter/tree/master/dev/tools/gen_keycodes ) for details. Fixes https://github.com/flutter/flutter/issues/146480 `-Wobjc-redundant-literal-use` error. Note `-Wobjc-redundant-literal-use` is already on for clang-tidy https://github.com/flutter/engine/blob/3e5e40c10a2730e10dc9e4e19ff2d6a6f2b3d343/.clang-tidy#L13 but in this case it's only true triggered when the file is compiled with ARC. When I migrated this file to ARC as part of https://github.com/flutter/flutter/issues/137801, it triggered the error. --- engine/src/flutter/shell/platform/darwin/ios/BUILD.gn | 4 ++-- .../platform/darwin/ios/framework/Source/KeyCodeMap.g.mm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn b/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn index 6515ce60a8..76039bd4b2 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn @@ -68,6 +68,8 @@ source_set("flutter_framework_source_arc") { "framework/Source/FlutterTextInputPlugin.mm", "framework/Source/FlutterTextureRegistryRelay.h", "framework/Source/FlutterTextureRegistryRelay.mm", + "framework/Source/KeyCodeMap.g.mm", + "framework/Source/KeyCodeMap_Internal.h", "framework/Source/UIViewController+FlutterScreenAndSceneIfLoaded.h", "framework/Source/UIViewController+FlutterScreenAndSceneIfLoaded.mm", ] @@ -129,8 +131,6 @@ source_set("flutter_framework_source") { "framework/Source/FlutterView.mm", "framework/Source/FlutterViewController.mm", "framework/Source/FlutterViewController_Internal.h", - "framework/Source/KeyCodeMap.g.mm", - "framework/Source/KeyCodeMap_Internal.h", "framework/Source/SemanticsObject.h", "framework/Source/SemanticsObject.mm", "framework/Source/accessibility_bridge.h", diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/KeyCodeMap.g.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/KeyCodeMap.g.mm index ef34913772..d8303ab129 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/KeyCodeMap.g.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/KeyCodeMap.g.mm @@ -329,7 +329,7 @@ const std::set functionKeyCodes = { }; API_AVAILABLE(ios(13.4)) -NSDictionary* specialKeyMapping = [[NSDictionary alloc] initWithDictionary:@{ +NSDictionary* specialKeyMapping = @{ @"UIKeyInputEscape" : @(0x10000001b), @"UIKeyInputF1" : @(0x100000801), @"UIKeyInputF2" : @(0x100000802), @@ -351,7 +351,7 @@ NSDictionary* specialKeyMapping = [[NSDictionary alloc] in @"UIKeyInputEnd" : @(0x10000000d), @"UIKeyInputPageUp" : @(0x100000308), @"UIKeyInputPageDown" : @(0x100000307), -}]; +}; const uint64_t kCapsLockPhysicalKey = 0x00070039; const uint64_t kCapsLockLogicalKey = 0x100000104;