Skip to content

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented Jun 25, 2020

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.

Screen Shot 2020-06-25 at 2 54 16 PM

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.

@justinmc justinmc self-assigned this Jun 25, 2020
@fluttergithubbot fluttergithubbot added f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Jun 25, 2020
@justinmc justinmc requested a review from goderbauer June 26, 2020 16:08
Copy link
Member

@goderbauer goderbauer left a 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) {
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation

@flutter-github-sync
Copy link

Started Google testing for this PR

@flutter-github-sync
Copy link

Google testing passed!

@flutter-github-sync
Copy link

Started Google testing for this PR

@flutter-github-sync
Copy link

Google testing passed!

@flutter-github-sync
Copy link

Started Google testing for this PR

@flutter-github-sync
Copy link

Google testing passed!

@fluttergithubbot fluttergithubbot merged commit f6cd2d4 into flutter:master Jun 29, 2020
@justinmc justinmc deleted the ios14-clipboard-notification branch June 29, 2020 16:49
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants