[TIMOB-28020] Android: Parity with iOS Shortcut click event payload
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-07-28T20:37:10.000+0000 |
Affected Version/s | Release 9.1.0 |
Fix Version/s | Release 9.1.0 |
Components | Android |
Labels | n/a |
Reporter | Gary Mathews |
Assignee | Gary Mathews |
Created | 2020-07-15T22:01:22.000+0000 |
Updated | 2020-07-28T20:37:14.000+0000 |
Description
- Amend
Ti.UI.Shortcut
click event to include item
as Shortcut item instead
*TEST CASE*
const window = Ti.UI.createWindow({ backgroundColor: 'grey', layout: 'vertical' });
const shortcut = Ti.UI.createShortcut();
let lastShortcutItem;
function test(title, callback) {
const button = Ti.UI.createButton({ title, top: 50 });
button.addEventListener('click', callback);
window.add(button);
}
test('ADD RANDOM SHORTCUT', _ => {
const rand = Math.floor(Math.random() * (999 - 1)) + 1;
const item = Ti.UI.createShortcutItem({
id: test_shortcut_${rand}
,
title: SHORTCUT_${rand}
,
description: DESCRIPTION_${rand}
});
lastShortcutId = item;
shortcut.add(item);
});
test('REMOVE LAST SHORTCUT', _ => {
try {
shortcut.remove(lastShortcutItem);
} catch { }
});
test('REMOVE ALL SHORTCUTS', _ => {
shortcut.removeAll();
});
test('NUMBER OF SHORTCUTS', _ => {
alert(staticItems: ${shortcut.staticItems.length}
);
alert(items: ${shortcut.items.length}
);
});
Ti.UI.Shortcut.addEventListener('click', e => {
// e should contain 'item'
console.log('shortcut: ' + JSON.stringify(e, null, 1));
});
window.open();
master: https://github.com/appcelerator/titanium_mobile/pull/11823
FR Passed Waiting for Jenkins build
merged to master for 9.1.0 target
Verified on: Mac OS: 10.15.4 SDK: 9.1.0.v20200727104531 Appc CLI: 8.0.0 JDK: 11.0.4 Node: 10.17.0 Studio: 6.0.0.202005141803 Device: Pixel3(v10.0) emulator
Reopening to edit comment