Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19708] Ti.App.iOS:shortcutitemclick lacks shortcutitem type

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-10-13T20:58:41.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sRelease 5.1.0
ComponentsiOS
Labelsn/a
ReporterFokke Zandbergen
AssigneeHans Knöchel
Created2015-10-11T11:51:22.000+0000
Updated2015-11-20T03:37:14.000+0000

Description

If you define a shortcut in tiapp.xml:
                <key>UIApplicationShortcutItems</key>
                <array>
                    <dict>
                        <key>UIApplicationShortcutItemIconType</key>
                        <string>UIApplicationShortcutIconTypeAdd</string>
                        <key>UIApplicationShortcutItemSubtitle</key>
                        <string>Take a brand new photo</string>
                        <key>UIApplicationShortcutItemTitle</key>
                        <string>Take photo</string>
                        <key>UIApplicationShortcutItemType</key>
                        <string>NewPhoto</string>
                        <key>UIApplicationShortcutItemUserInfo</key>
                        <dict>
                            <key>myCustomKey</key>
                            <string>myCustomValue</string>
                        </dict>
                    </dict>
                </array>
The shortcutitemclick event will not have the shortcut's type, probably because it is overwritten by the event type:
[INFO]  {
[INFO]      bubbles = 1;
[INFO]      cancelBubble = 0;
[INFO]      source = "[object TiAppiOS]";
[INFO]      subtitle = "Take a brand new photo";
[INFO]      title = "Take photo";
[INFO]      type = shortcutitemclick;
[INFO]      userInfo =     {
[INFO]          myCustomKey = myCustomValue;
[INFO]      };
[INFO]  }

Comments

  1. Fokke Zandbergen 2015-10-13

    PR FR using https://github.com/appcelerator-developer-relations/appc-sample-3dtouch verifies the fix, but icon is missing:
       [INFO]  Ti.App.iOS:shortcutitemclick {
       [INFO]    "title": "Take photo",
       [INFO]    "itemtype": "NewPhoto",
       [INFO]    "subtitle": "Take a brand new photo",
       [INFO]    "userInfo": {
       [INFO]      "myCustomKey": "myCustomValue"
       [INFO]    },
       [INFO]    "bubbles": true,
       [INFO]    "type": "shortcutitemclick",
       [INFO]    "source": {},
       [INFO]    "cancelBubble": false
       [INFO]  }
       
  2. Hans Knöchel 2015-10-13

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/7290 PR (5_1_X): https://github.com/appcelerator/titanium_mobile/pull/7298
  3. Harry Bryant 2015-10-15

    Verified as fixed, defined a shortcut in the tiapp.xml & built to device. when clicking on the shortcut item the shortcutitemclick event fired contains the shortcut's type (( "itemtype":"contact_us" )) . Tested on iPhone 6S + CLI Specs Template OSX El Capitan 10.11 Studio: 4.3.1.201509302304 Ti SDK: 5.2.0.v20151014085238 Appc NPM: 4.2.1-1 Appc CLI: 5.1.0-38 Closing ticket.

JSON Source