[TIMOB-19489] iOS9: 3D-Touch: Support UIApplicationShortcutItem ("Quick Actions")
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-10-02T21:12:40.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.1.0 |
Components | iOS |
Labels | 3DTouch, iOS9 |
Reporter | Hans Knöchel |
Assignee | Hans Knöchel |
Created | 2015-09-10T01:48:37.000+0000 |
Updated | 2015-10-28T11:24:43.000+0000 |
Description
Apple just presented the new 3D-Touch feature of the iPhone6S. User can press a view and will review an instant feedback providing a context-like menu to select different actions, called section of our tiapp.xml. Dynamic shortcut items will need an own proxy to receive existing actions and configure own actions.
*Related documents*:
- https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIApplicationShortcutItem_class/
- https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIApplicationShortcutIcon_Class/index.html#//apple_ref/occ/cl/UIApplicationShortcutIcon
- https://developer.apple.com/library/prerelease/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW36
UIApplicationShortcutItem
. After clicking on one of the actions, the user will guided to the app where several actions can be performed depending on the action. There are the properties type
, localizedTitle
, localizedSubtitle
, icon
and userInfo
. There is also a UIApplicationShortcutIcon
to configure the icon or associate it with existing (contact) images to personalize the experience.
We differentiate *static* vs. *dynamic* shortcut items:
- *Static*: Are set in the Info.plist before launching the app.
- *Dynamic*: Are set in the app to offer a dynamic behavior at runtime.
As is currently see it, we can support static action very easy by letting the user write them in the Attachments
File | Date | Size |
---|---|---|
Screen Shot 2015-09-15 at 19.53.36.png | 2015-09-16T02:57:13.000+0000 | 554103 |
This would be an awesome thing to make apps more user-friendly
[~cbowley] Works great! Altough we can test using the device starting tomorrow. But great to have.
PR (by [~ben.bahrenburg@gmail.com], work in progress): https://github.com/appcelerator/titanium_mobile/pull/7236
PR approved, thank you [~ben.bahrenburg@gmail.com]!
How can I translate static shortcut items?
You can simply use a translation key e.g. "my_title" and translate it in the i18n/en/app.xml and i18n/de/app.xml. We will provide an example in the shortcuts docs. I remember [~fokkezb] created a ticket for that.
Verified as working correctly, Using the example code provided, tested the
UIApplicationShortcutItem
feature for 3D touch, adding & removing "Contact Us" shortcut, as well as the static / dynamic app shortcut count reading the appropriate values. Tested on both iPhone 6S & iPhone 6S + devices. Closing Ticket. OSX El Capitan 10.11 Studio: 4.3.1.201509302304 Ti SDK: 5.2.0.v20151009071418 & 5.1.0.v20151008153630 Appc NPM: 4.2.1-1 Appc CLI: 5.1.0-38[~benutzername] [~hansknoechel] that's TIDOC-2341
Great news! And the translations work well. But I still can't use 5.1.x causing TC-5718
How do I use an own icon file in dynamic shortcut icons?
[~benutzername] for now we're disabling main thread (TIMOB-19760) so TC-5718 is no issue anymore. Just set the path to the icon image to the icon property (
image/myIcon.png
) which should be a 35p b/w image (so-called template icon). I will release a sample app with it this week.Thanks [~fokkezb] I just was a little bit confused, because Apple splits it in iconType and iconFile. But if you say so, I'll do it that way.
Mmm, yes. I guess it's always a balance between staying close the original APIs and making it more JS-ish and staying close to our cross-platform APIs.
That's ok. It's even better to let the code in background decide, to take an integer or a string, than the let the user make mistakes ;)
[~fokkezb] Own images worked in 5.2.0.v20151021171225 and stopped working in 5.2.0.v20151026172037
[~hansknoechel] could this be because we decided to rip out image asset catalogs last minute? (which I heard we did in Flow, not sure why)
[~fokkezb] [~benutzername] We removed the asset catalog in the 5.1.0 by default, because they was discovered an issue where files could not be accessed any more (TIMOB-19757). You can turn it on by using
<use-app-thinning>true</use-app-thinning>
. That will also be documented in 5.1.0 and most probably fixed in 5.2.0.Ah, good to know. Thanks
[~hans123] to prevent surprises, cant we name the code work with both?
Nope, the API only accepts an image name inside the asset catalog.
Updated sample and blog post.