Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19711] Ti.UI.iOS.ApplicationShortcuts.listDynamicShortcuts() lacks icon

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionInvalid
Resolution Date2015-11-03T22:23:55.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterFokke Zandbergen
AssigneeHans Knöchel
Created2015-10-11T17:53:58.000+0000
Updated2017-03-17T18:11:07.000+0000

Description

The dictionary that Ti.UI.iOS.ApplicationShortcuts.listDynamicShortcuts() returns lacks the icon. Perhaps this is related to the [duplicate code](https://github.com/appcelerator/titanium_mobile/blob/361f942eaa9372f1fa25bad0f395c2822eab68be/iphone/Classes/TiUIiOSApplicationShortcutsProxy.m#L19) and one of the duplicates should have been for the icon. *JavaScript*
	appShortcuts.addDynamicShortcut({
		itemtype: 'details',
		title: 'Open last picture',
		subtitle: $model.get('time'),
		icon: 'images/shortcutItemIcon.png',
		userInfo: {
			filename: $model.get('filename')
		}
	});
*Console*
[INFO]  Ti.UI.iOS.ApplicationShortcuts.listDynamicShortcuts [
[INFO]    {
[INFO]      "title": "Open last picture",
[INFO]      "itemtype": "details",
[INFO]      "subtitle": "2015-10-11T17:15:07+02:00",
[INFO]      "userInfo": {
[INFO]        "filename": "D48297EA-8F88-447F-8CDC-48980BEA4EFD.jpg"
[INFO]      }
[INFO]    }
[INFO]  ]

Comments

  1. Fokke Zandbergen 2015-10-13

    Tested https://github.com/appcelerator/titanium_mobile/pull/7290 with https://github.com/appcelerator-developer-relations/appc-sample-3dtouch but still no icon:
       [INFO]  Ti.UI.iOS.ApplicationShortcuts.listDynamicShortcuts [
       [INFO]    {
       [INFO]      "title": "Open last picture",
       [INFO]      "itemtype": "details",
       [INFO]      "subtitle": "2015-10-11T20:10:42+02:00",
       [INFO]      "userInfo": {
       [INFO]        "filename": "35E96E30-D820-4C91-900D-DF4E7D4AFED3.jpg"
       [INFO]      }
       [INFO]    }
       [INFO]  ]
       [INFO]  Ti.UI.iOS.ApplicationShortcuts.listStaticShortcuts [
       [INFO]    {
       [INFO]      "title": "Take photo",
       [INFO]      "itemtype": "NewPhoto",
       [INFO]      "subtitle": "Take a brand new photo",
       [INFO]      "userInfo": {
       [INFO]        "myCustomKey": "myCustomValue"
       [INFO]      }
       [INFO]    }
       [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. Fokke Zandbergen 2015-10-14

    [~hansknoechel] I believe this ticket is not resolved by the linked PR. You mentioned yourself that it was not possible (at this time) to get the icon value.
  4. Fokke Zandbergen 2015-10-15

    That sounds like a huge overkill. Can't we just return the icon path as a string or Ti.UI.IOS constant for built-ins?
  5. Hans Knöchel 2015-10-20

    Simplified: There is no getter to receive an url or icon after creation, because the icon is just set using instance methods instead of properties. I don't see that working even with having a proxy surrounded. Besides this, there is still no use case a user would like to receive the url of a icon.
  6. Fokke Zandbergen 2015-10-20

    Ah, OK. I just created the ticket to make the payload identical to what you set so it is more predictable. The only use case I can think off is that you have icons depending on something variable and you want to check wether the current shortcut has the right icon. The workaround for that use case is to just replace the shortcut regardless. Let's keep it around low prio.
  7. Hans Knöchel 2015-11-03

    Ok, I thought about it again and I will create a Ti.UI.iOS.ApplicationShortcutIcon proxy for the 5.2.0 release, that holds the properties imagecontact, systemIcon which can be received using the usual getter. [~fokkezb] cool?
  8. Fokke Zandbergen 2015-11-03

    Am I correct that these are the benefits? * Able to get the type and value of the current icon of a shortcut * Able to change the type and value of a shortcut And are these the downsides? * Need to set the icon of a shortcut by creating and passing an instance of this proxy
  9. Hans Knöchel 2015-11-03

    Correct
  10. Fokke Zandbergen 2015-11-03

    Mmm, not sure if the benefits outweigh the downsides. What do you think?
  11. Hans Knöchel 2015-11-03

    I think we could make the proxy internally and just give back the property that is set. Cleanest way.
  12. Hans Knöchel 2015-11-03

    Spent quite a long time now creating a proxy to cover the shortcut icons after creation. But this will still never work, because we will always get the native UIApplicationShortcutIcon class in the delegate that is responsible for the shortcutitemclick event. So also no one else is able to receive the source of the icon and this was intended by Apple. Closing this ticket as invalid and wait if Apple maybe some day opens the API on the native side. Reference to what I'm talking about can be found [here](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIApplicationShortcutIcon_Class/).
  13. Fokke Zandbergen 2015-11-04

    Sounds fair. Too little use case to justify.
  14. Lee Morris 2017-03-17

    Closing ticket as invalid.

JSON Source