Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28020] Android: Parity with iOS Shortcut click event payload

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2020-07-28T20:37:10.000+0000
Affected Version/sRelease 9.1.0
Fix Version/sRelease 9.1.0
ComponentsAndroid
Labelsn/a
ReporterGary Mathews
AssigneeGary Mathews
Created2020-07-15T22:01:22.000+0000
Updated2020-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();

Comments

  1. Gary Mathews 2020-07-15

    master: https://github.com/appcelerator/titanium_mobile/pull/11823
  2. Satyam Sekhri 2020-07-16

    FR Passed Waiting for Jenkins build
  3. Christopher Williams 2020-07-17

    merged to master for 9.1.0 target
  4. Satyam Sekhri 2020-07-28

    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
  5. Satyam Sekhri 2020-07-28

    Reopening to edit comment

JSON Source