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): handle shortcut exception #11798

Closed
wants to merge 2 commits into from
Closed

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Jun 27, 2020

JIRA: https://jira.appcelerator.org/browse/AC-6564

Optional Description:

Won't crash with an unhandled exception:

var win = Ti.UI.createWindow({
		backgroundColor: 'grey'
	}),
	btn = Ti.UI.createButton({
		top: 0,
		title: 'TOGGLE SHORTCUT'
	})

Ti.App.addEventListener('shortcutitemclick', function() {
	win.backgroundColor = 'blue';
});

btn.addEventListener('click', function() {
	for (var i = 0; i < 10; ++i) {
		var shortcut = Ti.UI.createShortcutItem({
			id: 'test_shortcut' + i,
			title: 'TEST' + i,
			description: 'DESCRIPTION' + i
		});
		if (shortcut.visible) {
			win.backgroundColor = 'red';
			shortcut.hide();
		} else {
			win.backgroundColor = 'green';
			shortcut.show();
		}
	}
});

win.add(btn);
win.open();

@build build added this to the 9.1.0 milestone Jun 27, 2020
@build build requested a review from a team June 27, 2020 15:08
@build
Copy link
Contributor

build commented Jun 27, 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.

🚫 Tests have failed, see below for more information.
Messages
📖

💾 Here's the generated SDK zipfile.

📖 🎉 Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. 👍
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖 ❌ 3 tests have failed There are 3 tests failing and 698 skipped out of 7345 total tests.

Tests:

ClassnameNameTimeError
android.emulator.Titanium.Androidactivity callbacks (9)5.11
Error: timeout of 5000ms exceeded
at Titanium.<anonymous> (/ti-mocha.js:6535:53120)
android.emulator.Titanium.UI.TextArea.focused (9)2.443
Error: timeout of 2000ms exceeded
at Titanium.<anonymous> (/ti-mocha.js:6535:53723)
android.emulator.Titanium.UI.TextField.focused (9)2.028
Error: timeout of 2000ms exceeded
at Titanium.<anonymous> (/ti-mocha.js:6535:53723)

Generated by 🚫 dangerJS against 6bfa28a

@garymathews
Copy link
Contributor

I have pushed an update to this PR, however this may be superseded by #11759

@sgtcoolguy
Copy link
Contributor

@garymathews What should we do with this PR now that this code has been re-written? It looks to me like a use case we still need to protect against in the refactored code. Specifically here: https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/ShortcutProxy.java#L139 and here: https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/ShortcutItemProxy.java#L124

@garymathews
Copy link
Contributor

Closing as #11759 has already addressed this issue.

@m1ga m1ga deleted the shortcut branch August 7, 2020 07:54
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

4 participants