Skip to content
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

Polyfill clipboard API [VER-116] #1141

Merged
merged 4 commits into from
Jan 30, 2024
Merged

Polyfill clipboard API [VER-116] #1141

merged 4 commits into from
Jan 30, 2024

Conversation

zatteo
Copy link
Contributor

@zatteo zatteo commented Jan 23, 2024

We want to be able to use navigator.clipboard on our cozy apps to copy and paste. But :

That's why we polyfill here with a react native bridge. We support only readText and writeText.

Tested with a custom mespapiers build (git://github.com/cozy/mespapiers.git#build-test-copy-with-log) showing :

  • a button to use readText
  • a button to use writeText
  • a button to use read => throw an error
  • a button to use write => throw an error

Tested if the app is served by local http server OR by the stack.

  • Tested on iOS
  • Tested on Android

@zatteo zatteo changed the title Polyfill clipboard API Polyfill clipboard API VER-116 Jan 23, 2024
@zatteo zatteo changed the title Polyfill clipboard API VER-116 Polyfill clipboard API [VER-116] Jan 23, 2024
@zatteo zatteo force-pushed the feat/polyfill-clipboard-api branch from 904970b to 0aa112c Compare January 23, 2024 17:38
Every answer had the 'Crypto' type, even if it was a 'NavigatorShare' type. It had no consequences for the moment.
Only readText and writeText are supported. read and write throw an error.
On Android, navigator.clipboard is available but does not work. So we overwrite with our implementation even if navigator.clipboard is present.

react-native-webview/react-native-webview#2869
@zatteo zatteo force-pushed the feat/polyfill-clipboard-api branch from 0aa112c to 9891e73 Compare January 30, 2024 10:47
@zatteo zatteo marked this pull request as ready for review January 30, 2024 10:53
Copy link
Contributor

@Crash-- Crash-- left a comment

Choose a reason for hiding this comment

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

Nice!

@zatteo zatteo merged commit 0b193e0 into master Jan 30, 2024
1 check passed
@zatteo zatteo deleted the feat/polyfill-clipboard-api branch January 30, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants