[TIMOB-23519] iOS10: Expose new Ti.UI.Pasteboard APIs
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-06-14T22:33:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.5.0 |
Components | iOS |
Labels | ios10, qe-5.5.0 |
Reporter | Hans Knöchel |
Assignee | Hans Knöchel |
Created | 2016-06-14T16:51:58.000+0000 |
Updated | 2016-09-01T17:28:04.000+0000 |
Description
iOS 10 exposes new APIs to check whether or not the pasteboard currently has images, colors or URLs. Those should be exposed from the beginning to offer the user a more convenient way to validate the current pasteboard content.
https://github.com/appcelerator/titanium_mobile/pull/8066 Demo:
PR (5_5_X): https://github.com/appcelerator/titanium_mobile/pull/8219
This issue is currently blocked by TIMOB-23786 .
[~hansknoechel] These seem to use the general pasteboard. Are there plans or is there a way to be able to use/create a named pasetboard?
[~htbryant] Updated example code to be indipendent from the logs. [~ewieber] Not, yet. Thought about it already, but no space for it at this time.
I am able to use the APIs in my project without error, so this is implemented in that respect, however I have some notes: 1. Some features of the Pasteboards are not supported (addressed by Hans in TIMOB-23797) 2. We cannot create Named Pasteboards (not a blocker for this ticket and tracked by TIMOB-23799) 3.
hasColors()
is always returning false, for me. According to Apple docs it should return true ifcolors
is a non-empty array, but when I setcolors
to anything (TI.UI.Clipboard.setData("colors", \["blue", "#1234ff"\]);
), it still returns false.hasImages()
andhasURLs()
are working as expected.The way you set it looks incorrect. Let me investigate that.
There are square brackets around the second and third arguments, but I forgot to escape them on first post. I edited the comment. I tried several ways to set the data: {noformat} ["blue", "1234f"] {"blue":"ok", "color":"#1234ff"} "{blue}" "['blue', '#1234ff']" and others {noformat} I got the same result with each.
[~ewieber] Fixed the color-handling in [this commit](https://github.com/appcelerator/titanium_mobile/pull/8247/commits/687a177f8346d2bccd53ee92d6d51d6982fb88dd) as part of TIMOB-23797.
Verified implemented using: MacOS 10.12 (16A239m) Studio 4.7.1.201608190732 Ti SDK 5.5.0.v20160831100821 Appc NPM 4.2.7 Appc CLI 5.5.0-5 Alloy 1.9.1 Xcode 8.0 (8S201h) The
hasURLs()
,hasImages()
, andhasColors()
APIs are usable and correctly return for the data in the pasteboard items. Tested using the provided example as well as my own test case that sets, checks, and clears pasteboard data.