[TIMOB-19711] Ti.UI.iOS.ApplicationShortcuts.listDynamicShortcuts() lacks icon
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2015-11-03T22:23:55.000+0000 |
Affected Version/s | Release 5.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Fokke Zandbergen |
Assignee | Hans Knöchel |
Created | 2015-10-11T17:53:58.000+0000 |
Updated | 2017-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] ]
Tested https://github.com/appcelerator/titanium_mobile/pull/7290 with https://github.com/appcelerator-developer-relations/appc-sample-3dtouch but still no icon:
PR (master): https://github.com/appcelerator/titanium_mobile/pull/7290 PR (5_1_X): https://github.com/appcelerator/titanium_mobile/pull/7298
[~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.
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?
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.
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.
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 propertiesimage
,contact
,systemIcon
which can be received using the usual getter. [~fokkezb] cool?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
Correct
Mmm, not sure if the benefits outweigh the downsides. What do you think?
I think we could make the proxy internally and just give back the property that is set. Cleanest way.
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 theshortcutitemclick
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/).Sounds fair. Too little use case to justify.
Closing ticket as invalid.