Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9d99dfd

Browse files
migrate iOS text input plugin to ARC
1 parent 6b1c0c2 commit 9d99dfd

File tree

4 files changed

+86
-120
lines changed

4 files changed

+86
-120
lines changed

shell/platform/darwin/ios/BUILD.gn

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,31 @@ _flutter_framework_headers = [
3939

4040
_flutter_framework_headers_copy_dir = "$_flutter_framework_dir/Headers"
4141

42+
source_set("flutter_framework_source_arc") {
43+
visibility = [ ":*" ]
44+
cflags_objc = flutter_cflags_objc_arc
45+
cflags_objcc = flutter_cflags_objcc_arc
46+
47+
defines = [ "FLUTTER_FRAMEWORK=1" ]
48+
allow_circular_includes_from = [ ":flutter_framework_source" ]
49+
deps = [
50+
":flutter_framework_source",
51+
"//flutter/fml",
52+
"//flutter/shell/platform/common:common_cpp_input",
53+
"//flutter/shell/platform/darwin/common:framework_shared",
54+
"//third_party/icu",
55+
]
56+
public_configs = [ "//flutter:config" ]
57+
58+
sources = [
59+
"framework/Source/FlutterTextInputDelegate.h",
60+
"framework/Source/FlutterTextInputPlugin.h",
61+
"framework/Source/FlutterTextInputPlugin.mm",
62+
]
63+
64+
frameworks = [ "UIKit.framework" ]
65+
}
66+
4267
source_set("flutter_framework_source") {
4368
visibility = [ ":*" ]
4469
cflags_objc = flutter_cflags_objc
@@ -81,9 +106,6 @@ source_set("flutter_framework_source") {
81106
"framework/Source/FlutterSemanticsScrollView.mm",
82107
"framework/Source/FlutterSpellCheckPlugin.h",
83108
"framework/Source/FlutterSpellCheckPlugin.mm",
84-
"framework/Source/FlutterTextInputDelegate.h",
85-
"framework/Source/FlutterTextInputPlugin.h",
86-
"framework/Source/FlutterTextInputPlugin.mm",
87109
"framework/Source/FlutterUIPressProxy.h",
88110
"framework/Source/FlutterUIPressProxy.mm",
89111
"framework/Source/FlutterUndoManagerDelegate.h",
@@ -209,6 +231,7 @@ source_set("ios_test_flutter_mrc") {
209231
]
210232
deps = [
211233
":flutter_framework_source",
234+
":flutter_framework_source_arc",
212235
"//flutter/common:common",
213236
"//flutter/lib/ui:ui",
214237
"//flutter/shell/common:common",
@@ -267,6 +290,7 @@ shared_library("ios_test_flutter") {
267290
deps = [
268291
":flutter_framework",
269292
":flutter_framework_source",
293+
":flutter_framework_source_arc",
270294
":ios_gpu_configuration",
271295
":ios_test_flutter_mrc",
272296
"//flutter/common:common",
@@ -295,7 +319,10 @@ shared_library("create_flutter_framework_dylib") {
295319

296320
public = _flutter_framework_headers
297321

298-
deps = [ ":flutter_framework_source" ]
322+
deps = [
323+
":flutter_framework_source",
324+
":flutter_framework_source_arc",
325+
]
299326

300327
public_configs = [ "//flutter:config" ]
301328
}

shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#import <UIKit/UIKit.h>
99

10-
#import "flutter/fml/memory/weak_ptr.h"
1110
#import "flutter/shell/platform/common/text_editing_delta.h"
1211
#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h"
1312
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterIndirectScribbleDelegate.h"
@@ -30,8 +29,8 @@ typedef NS_ENUM(NSInteger, FlutterScribbleInteractionStatus) {
3029
@interface FlutterTextInputPlugin
3130
: NSObject <FlutterKeySecondaryResponder, UIIndirectScribbleInteractionDelegate>
3231

33-
@property(nonatomic, assign) UIViewController* viewController;
34-
@property(nonatomic, assign) id<FlutterIndirectScribbleDelegate> indirectScribbleDelegate;
32+
@property(nonatomic, weak) UIViewController* viewController;
33+
@property(nonatomic, weak) id<FlutterIndirectScribbleDelegate> indirectScribbleDelegate;
3534
@property(nonatomic, strong)
3635
NSMutableDictionary<UIScribbleElementIdentifier, NSValue*>* scribbleElements;
3736

@@ -125,7 +124,7 @@ FLUTTER_DARWIN_EXPORT
125124
@property(readwrite, copy) UITextRange* selectedTextRange;
126125
@property(nonatomic, strong) UITextRange* markedTextRange;
127126
@property(nonatomic, copy) NSDictionary* markedTextStyle;
128-
@property(nonatomic, assign) id<UITextInputDelegate> inputDelegate;
127+
@property(nonatomic, weak) id<UITextInputDelegate> inputDelegate;
129128

130129
// UITextInputTraits
131130
@property(nonatomic) UITextAutocapitalizationType autocapitalizationType;
@@ -141,10 +140,10 @@ FLUTTER_DARWIN_EXPORT
141140
@property(nonatomic) UITextSmartDashesType smartDashesType API_AVAILABLE(ios(11.0));
142141
@property(nonatomic, copy) UITextContentType textContentType API_AVAILABLE(ios(10.0));
143142

144-
@property(nonatomic, assign) UIAccessibilityElement* backingTextInputAccessibilityObject;
143+
@property(nonatomic, weak) UIAccessibilityElement* backingTextInputAccessibilityObject;
145144

146145
// Scribble Support
147-
@property(nonatomic, assign) id<FlutterViewResponder> viewResponder;
146+
@property(nonatomic, weak) id<FlutterViewResponder> viewResponder;
148147
@property(nonatomic) FlutterScribbleFocusStatus scribbleFocusStatus;
149148
@property(nonatomic, strong) NSArray<FlutterTextSelectionRect*>* selectionRects;
150149
- (void)resetScribbleInteractionStatusIfEnding;

0 commit comments

Comments
 (0)