-
Notifications
You must be signed in to change notification settings - Fork 6k
hasStrings Mac #20531
hasStrings Mac #20531
Changes from 3 commits
bb0f4be
97acb46
660092e
ffc7af4
98adfc9
59ad159
084c926
1a22b66
67f0173
6177e74
24d28c8
51280f2
a15798e
878aa78
c2bca18
54301f3
70286fc
6c778fe
b68a594
25385b5
45b81b4
2d0728d
3c9ec6e
a52595d
d14a117
3490d8a
e1566ac
491a585
8c2d240
06a6034
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,6 +173,14 @@ - (NSDictionary*)getClipboardData:(NSString*)format; | |
| */ | ||
| - (void)setClipboardData:(NSDictionary*)data; | ||
|
|
||
| /** | ||
| * Returns true iff the clipboard contains nonempty string data. | ||
| * | ||
| * See also: | ||
| * * https://developer.apple.com/documentation/uikit/uipasteboard/1829416-hasstrings | ||
| */ | ||
| - (NSDictionary*)clipboardHasStrings; | ||
|
|
||
| @end | ||
|
|
||
| #pragma mark - FlutterViewController implementation. | ||
|
|
@@ -505,6 +513,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { | |
| } else if ([call.method isEqualToString:@"Clipboard.setData"]) { | ||
| [self setClipboardData:call.arguments]; | ||
| result(nil); | ||
| } else if ([call.method isEqualToString:@"Clipboard.hasStrings"]) { | ||
| result([self clipboardHasStrings]); | ||
| } else { | ||
| result(FlutterMethodNotImplemented); | ||
| } | ||
|
|
@@ -534,6 +544,13 @@ - (void)setClipboardData:(NSDictionary*)data { | |
| } | ||
| } | ||
|
|
||
| - (NSDictionary*)clipboardHasStrings { | ||
|
||
| NSDictionary* data = [self getClipboardData:[NSString stringWithFormat:@"%s", kTextPlainFormat]]; | ||
| NSString* string = data[@"text"]; | ||
|
||
| BOOL hasStrings = string.length > 0; | ||
| return @{@"value" : @(hasStrings)}; | ||
| } | ||
|
|
||
| #pragma mark - FlutterViewReshapeListener | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you referencing UIKit documentation in the macOS embedding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be no equivalent hasStrings method for Mac. I'll add some details in the comment.