-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Don't access clipboard passively on iOS #60316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't access clipboard passively on iOS #60316
Conversation
goderbauer
left a comment
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.
LGTM
| // TODO(justinmc): Use the new iOS 14 clipboard API method hasStrings that | ||
| // won't trigger the notification. | ||
| // https://github.com/flutter/flutter/issues/60145 | ||
| if (defaultTargetPlatform == TargetPlatform.iOS) { |
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.
Use a switch when checking the defaultTargetPlatform.
| }, skip: isBrowser); | ||
| }, skip: isBrowser, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.android })); | ||
|
|
||
| // TODO(justinmc): https://github.com/flutter/flutter/issues/60145 |
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.
nit: indentation
|
Started Google testing for this PR |
|
Google testing passed! |
|
Started Google testing for this PR |
|
Google testing passed! |
|
Started Google testing for this PR |
|
Google testing passed! |
Description
iOS 14 started showing a notification whenever an app accesses the clipboard. Flutter does this in order to decide whether or not it can show the Paste button in the text selection menu (see #54902). As a stopgap solution, this PR removes this functionality on iOS and always shows the Paste button in order to avoid the notification.
The long-term solution involves using a new API provided by Apple. We can use this to detect a pasteable string in the clipboard without reading the text itself. However, the notification will still show when a user presses the paste button. Progress on this long term solution will continue to be tracked in the issue #60145.
Related Issues
#60145
Tests
I tested both cupertino and material on iOS to verify that the Paste button is shown despite there being nothing on the clipboard.
Breaking Change
None.