Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): shortcut click event payload parity #11823

Merged
merged 2 commits into from Jul 17, 2020

Conversation

garymathews
Copy link
Contributor

  • Amend Ti.UI.Shortcut click event to include item as ShortcutItem instead of directly emitting ShortcutItem
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' property
	console.log('shortcut: ' + JSON.stringify(e, null, 1))
});

window.open();

JIRA Ticket

@build
Copy link
Contributor

build commented Jul 15, 2020

Fails
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

Messages
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖

✅ All tests are passing
Nice one! All 4628 tests are passing.
(There are 464 skipped tests not included in that total)

Generated by 🚫 dangerJS against 1e7a93e

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass

@ssekhri
Copy link

ssekhri commented Jul 16, 2020

FR Passed.
Verified on:
Mac OS: 10.15.4
SDK: 9.1.0.v20200715150547
Appc CLI: 8.0.0
JDK: 11.0.4
Node: 10.17.0
Studio: 6.0.0.202005141803
Device: Pixel3(v10.0) emulator

@sgtcoolguy sgtcoolguy merged commit dc102e3 into tidev:master Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants