[TIMOB-27889] Android: Implement Ti.UI.Shortcut
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-08-11T11:08:25.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.1.0 |
Components | Android |
Labels | parity, shortcut |
Reporter | Vijay Singh |
Assignee | Gary Mathews |
Created | 2020-05-08T17:36:29.000+0000 |
Updated | 2020-08-11T11:08:25.000+0000 |
Description
iOS has Ti.UI.iOS.ApplicationShortcuts and android has implemented Ti.UI.ShortcutItem for shortcut. To have parity on both platform , it is discussed to move Shortcut APIs under Ti.UI.Shortcut. Following are the decided APIs -
1. var shortcutItem = Ti.UI.createShortcutItem({
id: String // Unique identifier
title: String
description: String
icon: String/Number
data: Dictionary
})
2. var shortcut = Ti.UI.createShortcut();
3. shortcut.add(Ti.UI.ShortcutItem);
4. shortcut.items -> Array<Ti.UI.ShortcutItem>
5. shortcut.getById(id) -> Ti.UI.ShortcutItem
6. shortcut.staticItems -> Array<Ti.UI.ShortcutItem>
7. shortcut.remove(Ti.UI.ShortcutItem);
8. shortcut.removeAll();
9. Event listener - Ti.UI.Shortcuts.addEventListener('click', listener); -> Ti.UI.ShortcutItem
master: https://github.com/appcelerator/titanium_mobile/pull/11759
FR Passed
Parity issue with eventListner. //Works on iOS //Does not work on android. On android it works with Ti.UI.Shortcut.addEventListner var shortcut = Ti.UI.createShortcut(); Shortcut.addEventListener('click', e => { // e should contain 'item' property console.log('shortcut: ' + JSON.stringify(e, null, 1)) });
9_1_X: https://github.com/appcelerator/titanium_mobile/pull/11853
Gary's PR will make it work like iOS. However... I don't think the
Ti.UI.createShortcut(}
method should exist on Android or iOS since it doesn't make sense to have multiple instances of it.We should be using it as a module like this...
...and possible have shortcut item creation done via the
Ti.UI.Shortcut
module...I apologize for not paying attention to the original design, but we might want to re-open this for both Android and iOS.
*Closing ticket*. Improvement verified in SDK version
9.1.0.v20200810120239
,9.2.0.v20200810085310
and9.3.0.v20200810090511
. *Test and other information can be found at:* https://github.com/appcelerator/titanium_mobile/pull/11856 *Test Environment*