-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Provide a banal 'paste' postmessage implementation. #4189
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
Conversation
|
Can you give me steps how to test this?
|
|
Hi Tobias,
On 01/07/2019 10:45, Tobias Kaminsky wrote:
Can you give me steps how to test this?
I did this
* opened up a document within NC app
* long pressed on text to select it & copy it
Great.
* long pressed on a white area to paste it -> nothing happened
So - you'll need an updated C'bra Online build that posts the
PostMessage on paste at the right time to make that work - we're just
doing some final testing on that.
ATB,
Michael.
…--
michael.meeks@collabora.com <><, GM Collabora Productivity
Hangout: mejmeeks@gmail.com, Skype: mmeeks
(M) +44 7795 666 147 - timezone usually UK / Europe
|
Hm, but how/by whom is this postMessage triggered? As this is not in official release, there is no need for backporting it to 3.7. |
|
Please ping me, once there is a Collabora version, I can test (it can also be a docker tag/snapshot). |
|
Ah - this is easy; you need to double-tap to select text, not long-press =) |
|
Any console output ? I wonder - it could be a cross-site origin issue - we attempt to post directly to the top window, which may cause concern. Thanks. |
|
No meaningful error/info output. On my OnePlus3 with Swiftkey I can use the keyboard to paste the text snippet. |
|
Sure, using the system paste functionality should work, this is primarily intended to make non-system paste work ie. via the context menus or menu -> edit -> paste. And you're sure you're using the updated/instrumented app ? - I'd be curious to know if the postmessage arrives of course. Thanks. |
I am using the android app with this patch and collabora.nc (our staging server) for testing. This is correct, or? |
|
@mmeeks @juliushaertl if you also want to test this, in this PR is a QR code where you can install the app as "nextcloud qa" in parallel to existing one. |
|
@mmeeks The android app doesn't use postmessages for the integration but a call to See https://github.com/nextcloud/richdocuments/blob/842d5f2ef665edabaed581701a849736adcfde5c/js/documents.js#L940-L959 for the richdocuments implementation |
|
Tested together with @juliushaertl and @mmeeks and works 🎉 |
|
IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/10005 |
cc6ff7a to
63d2736
Compare
|
IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/10037 |
|
@tobiasKaminsky doesn't this need another rebase and fixes in the score-file? |
|
Yes, now that #4253 is merged, I'll do a rebase. |
63d2736 to
834a7eb
Compare
|
@tobiasKaminsky there are two lint warnings:
|
|
@mmeeks this is only possible for at least Nougat (Android 7), but RichDocuments/Collabora works with at least Lollipop (5.0). |
|
Ah - if we do nothing in older versions, then there will just be a popup saying "Please use a system paste button" or somesuch, which is fine - we can cope with that. Ideally we would have an 'internal paste' option inside that dialog I guess. Wrt. invoking a paste method dynamically, I guess there is a Java mechanism for that that will work if it is there (?) - but no expert; sorry for not noticing that. |
|
Oh, and ... it is possible that there is a 'Paste Key' - that could be inserted instead. Oddly that may work just as well and be more compatible (?). |
|
I only found https://developer.android.com/guide/topics/text/copy-paste#PastePlainText, but this is for accessing content of clip board. Pasting into webview/RichDocument is another step, which requires a javascript interface? |
|
With the other pieces of this work - you should be able to paste form anywhere, whenever you like without using a system-paste event. The problem is that a system paste event cannot be triggered from Javascript. In consequence we have to get it emitted by the native code. That could (probably) be done with a paste key injection instead. I guess some code like: BaseInputConnection mInputConnection = new BaseInputConnection( findViewById(R.id.main_content), true); Or somesuch; or even InputConnecction's sendKeyEvent ... not sure; for the case where that API is not there (?). |
|
The problem with your new code idea is that KeyEvent.KEYCODE_PASTE only exists beginning from API 24 only. |
Browsers will allow apps to populate the clipboard, but not read from it without user input. This patch makes it possible for context menus with 'Paste' in them to trigger a real OS paste when hosted inside the webview. Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
834a7eb to
c0588a0
Compare
Codecov Report
@@ Coverage Diff @@
## master #4189 +/- ##
============================================
- Coverage 14.33% 14.31% -0.03%
Complexity 1 1
============================================
Files 331 331
Lines 31030 31032 +2
Branches 4405 4405
============================================
- Hits 4447 4441 -6
- Misses 25801 25808 +7
- Partials 782 783 +1
|
Codecov Report
@@ Coverage Diff @@
## master #4189 +/- ##
===========================================
+ Coverage 14.33% 16.74% +2.4%
Complexity 1 1
===========================================
Files 331 356 +25
Lines 31030 31684 +654
Branches 4405 4482 +77
===========================================
+ Hits 4447 5304 +857
+ Misses 25801 25487 -314
- Partials 782 893 +111
|
|
IT test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/10083 |
|
@mmeeks I would merge it as is: Or do you have another idea? |
|
Merging after CI is green as it is for >= Nougat an improvement. |
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/10476.apk |
Codacy286Lint
SpotBugs (new)
SpotBugs (master)
|
b36067d Merge pull request #4294 from AlexNi245/#2216-activity-data-divers-design 9624019 activity header has now the same font size as a activity element fa11565 fixed issue Avoid reassigning parameters such as 'itemPosition' 5a3db5e replace do while loop in getHeaderPositionForItem with while loop 1dd2a5a change naming of Canvas c to Canvas canvas f4e964e change class name of ActivityListItemDecoration to StickyHeaderItemDecoration, which is more generic 52a7ffe add license text 6ffa9d0 remove duplicate entry of setContentView cdd5d38 add getHeaderPositionForItem unit test 0ac5a8b add static import for com.owncloud.android.lib.resources.activities.model.Activity; 4ea9667 unit test for isHeader(int pos) b61f9e0 format ActivityListAdapter 9012f43 set visibility from ActivityViewHeaderHolder back to protected 7a30070 remove unnecessary TAG field and replace nested if statement with && to fix codeacy-bot issues a26a895 apply changes to java doc c41dd38 optimize imports b4764f7 remove unnecessary files 792a6b9 finish implementation of sticky header implementation. This feature was created according to the this implementation : https://stackoverflow.com/questions/32949971/how-can-i-make-sticky-headers-in-recyclerview-without-external-lib 13e7aff increase height of header element and set backgroundcolor to white a184345 first implementation of sticky header logic. cd3d8dc start to implement sticky header behavior 259e106 Merge pull request #4355 from nextcloud/drawer caf1842 drawer: show only server address cb7d4a3 revert to old image (#4356) 7e44fec revert to old image f7c4eec Merge pull request #4345 from nextcloud/push a3fda5a no need to use owncloudClient 9a023c6 Check if app is excluded from battery optimization (#3589) 527c5db Use conscrypt (#4314) 6014e90 use conscrypt 5373660 Provide a banal 'paste' postmessage implementation. (#4189) 68cebf8 revert DeviceModule back to Kotlin 969ce78 Drone: update FindBugs results to reflect reduced error/warning count [skip ci] f26095f Merge pull request #4245 from fogninid/fixUploadListComparator e72a789 show on special vendors "disable power check" in auto upload menu - tint button - change logic when to show battery warning c8173c3 Use reloading on photo view (#2250) c38dcf3 Delete temp file on receive external files (#4349) c155edf Merge pull request #4347 from nextcloud/blacklistThumbnail a03ff84 daily dev 20190820



Browsers will allow apps to populate the clipboard, but not read
from it without user input. This patch makes it possible for
context menus with 'Paste' in them to trigger a real OS paste
when hosted inside the webview.
Signed-off-by: Michael Meeks michael.meeks@collabora.com