Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23519] iOS10: Expose new Ti.UI.Pasteboard APIs

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-06-14T22:33:10.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.5.0
ComponentsiOS
Labelsios10, qe-5.5.0
ReporterHans Knöchel
AssigneeHans Knöchel
Created2016-06-14T16:51:58.000+0000
Updated2016-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.

Comments

  1. Hans Knöchel 2016-06-14

    https://github.com/appcelerator/titanium_mobile/pull/8066 Demo:
       var win = Ti.UI.createWindow({
           backgroundColor: "#fff",
           layout: "vertical"
       });
       var btn1 = Ti.UI.createButton({
           title: "Has URLs?",
           top: 40
       });
       
       btn1.addEventListener("click", function() {
           alert(Ti.UI.Clipboard.hasURLs());
       });
       var btn2 = Ti.UI.createButton({
           title: "Has images?",
           top: 40
       });
       
       btn2.addEventListener("click", function() {
           alert(Ti.UI.Clipboard.hasImages());
       });
       var btn3 = Ti.UI.createButton({
           title: "Has colors?",
           top: 40
       });
       
       btn3.addEventListener("click", function() {
           alert(Ti.UI.Clipboard.hasColors());
       });
       
       win.add(btn1);
       win.add(btn2);
       win.add(btn3);
       win.open();
       
  2. Hans Knöchel 2016-08-14

    PR (5_5_X): https://github.com/appcelerator/titanium_mobile/pull/8219
  3. Harry Bryant 2016-08-17

    This issue is currently blocked by TIMOB-23786 .
  4. Eric Wieber 2016-08-18

    [~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?
  5. Hans Knöchel 2016-08-18

    [~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.
  6. Eric Wieber 2016-08-22

    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 if colors is a non-empty array, but when I set colors to anything (TI.UI.Clipboard.setData("colors", \["blue", "#1234ff"\]);), it still returns false. hasImages() and hasURLs() are working as expected.
  7. Hans Knöchel 2016-08-26

    The way you set it looks incorrect. Let me investigate that.
  8. Eric Wieber 2016-08-26

    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.
  9. Hans Knöchel 2016-08-28

    [~ewieber] Fixed the color-handling in [this commit](https://github.com/appcelerator/titanium_mobile/pull/8247/commits/687a177f8346d2bccd53ee92d6d51d6982fb88dd) as part of TIMOB-23797.
  10. Eric Wieber 2016-08-31

    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(), and hasColors() 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.

JSON Source