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

refactor(android): ProgressIndicator dialog handling #11115

Merged
merged 6 commits into from Aug 22, 2019

Conversation

jquick-axway
Copy link
Contributor

@jquick-axway jquick-axway commented Aug 6, 2019

JIRA:

Summary:

  • TIMOB-27104 Fixed bug where ProgressIndicator logs "WindowLeaked" exception when hiding dialog and closing window at same time as of 8.0.2.
  • TIMOB-27308 Fixed bug where determinant ProgressIndicator ignores "value" property before shown.
  • TIMOB-27309 Fixed bug where you cannot re-show ProgressIndicator dialog if auto-closed by previous window.
  • Removed dialog's handleMessage() related code. No longer needed since JS runs on main UI thread.

Note:
The status bar ProgressIndicator is a dead feature. Google no longer supports it and their Java APIs effectively no-op. I've written up ticket TIMOB-27312 to refactor it in the future. In the meantime, there is no point in testing it. (I've already done some testing on it anyways with this PR and it's no worse.)


Test 1:
(Verifies dialog no longer logs exception when window closes.)

  1. Build and run the code attached to TIMOB-27104 on Android.
  2. Tap on the "Show Progress Dialog" button.
  3. Wait 2 seconds for the progress dialog and its window to close.
  4. Verify that a "WindowLeaked" exception was NOT logged.

Test 2:
(Verifies progress indicator reads "value" property when shown.)

  1. Build and run the code attached to TIMOB-27308 on Android.
  2. Tap on the "Show Progress Dialog" button.
  3. Verify that the dialog shows 50%.

Test 3:
(Verifies progress dialog can be re-shown after auto-closed.)

  1. Build and run the code attached to TIMOB-27309 on Android.
  2. Tap on the "Show Progress Dialog" button.
  3. Wait 2 seconds for the progress dialog and its window to close.
  4. Tap on the "Show Progress Dialog" button again.
  5. Verify that the progress dialog is re-shown.

Test 4:
(Verifies determinant progress indicator handling.)

  1. Build and run with the below code on Android.
  2. Tap on the "Show Progress Dialog" button.
  3. Verify that a progress dialog is shown.
  4. Verify that its progress bar slowly fills from 0% to 100% and then closes itself.
  5. Tap on the "Show Progress Dialog" button.
  6. Tap on the Android "back" button to close the progress dialog.
  7. Tap on the "Show Progress Dialog" button.
  8. Verify dialog is shown again and starts at 0%.
  9. Verify dialog auto-closes itself when it reaches 100%.
var timerId = null;
var progressIndicator = Ti.UI.Android.createProgressIndicator({
	message: "Progressing...",
	location: Ti.UI.Android.PROGRESS_INDICATOR_DIALOG,
	type: Ti.UI.Android.PROGRESS_INDICATOR_DETERMINANT,
	cancelable: true,
	min: 0,
	max: 100,
});
progressIndicator.addEventListener("cancel", function() {
	if (timerId) {
		clearInterval(timerId);
		timerId = null;
	}
});

var window = Ti.UI.createWindow();
var showButton = Ti.UI.createButton({
	title: "Show Progress Dialog",
	bottom: "30dp",
});
showButton.addEventListener("click", function() {
	progressIndicator.value = 0;
	progressIndicator.show();
	timerId = setInterval(function() {
		var value = progressIndicator.value;
		if (value >= progressIndicator.max) {
			progressIndicator.hide();
			clearInterval(timerId);
			timerId = null;
		} else {
			if (!value) {
				value = progressIndicator.min;
			}
			value += (progressIndicator.max - progressIndicator.min) / 10;
			progressIndicator.value = value;
		}
	}, 250);
});
window.add(showButton);
window.open();

- [TIMOB-27104] ProgressIndicator logs "WindowLeaked" exception when hiding dialog and closing window at same time as of 8.0.2
- [TIMOB-27308] Determinant ProgressIndicator ignores "value" property before shown
- [TIMOB-27309] Cannot re-show ProgressIndicator dialog if auto-closed by previous window
- Removed dialog's handleMessage() related code. No longer needed since JS runs on main UI thread.
@build
Copy link
Contributor

build commented Aug 6, 2019

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

💾 Here's the generated SDK zipfile.

📖 ❌ 2 tests have failed There are 2 tests failing and 472 skipped out of 4354 total tests.
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.

Tests:

ClassnameNameTimeError
ios.Titanium.UI.iOS#createPreviewContext()0.002
Error: expected 0 to equal 300
fail@file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/node_modules/should/cjs/should.js:275:23
value@file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/node_modules/should/cjs/should.js:356:23
file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti.ui.ios.previewcontext.test.js:26:48
file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti-mocha.js:4376:41
file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti-mocha.js:4763:17
file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti-mocha.js:4840:23
next@file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti-mocha.js:4688:20
file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti-mocha.js:4698:15
next@file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti-mocha.js:4636:30
file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti-mocha.js:4665:13
timeslice@file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti-mocha.js:5764:29
ios.Titanium.UI.Window.safeAreaPadding for window inside navigation window with extendSafeArea true0.006
Error: expected 34 to equal 0
fail@file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/node_modules/should/cjs/should.js:275:23
value@file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/node_modules/should/cjs/should.js:356:23
listener@file:///Users/build/Library/Developer/CoreSimulator/Devices/8161F144-7CF2-427F-9592-E4B4EA7537FF/data/Containers/Bundle/Application/5AC7B4FD-398F-42FE-9831-DDE3BA4405DF/mocha.app/ti.ui.window.test.js:721:38

Generated by 🚫 dangerJS against 5ac474c

* Please see the LICENSE included with this distribution for details.
*/
/* eslint-env mocha */
/* global Titanium */
Copy link
Contributor

Choose a reason for hiding this comment

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

  • 🚫 tests/Resources/ti.ui.android.progressindicator.addontest.js line 8 – 'Titanium' is already defined as a built-in global variable. (no-redeclare)
  • ⚠️ tests/Resources/ti.ui.android.progressindicator.addontest.js line 8 – 'Titanium' is defined but never used. (no-unused-vars)

Copy link
Contributor

@garymathews garymathews 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 Aug 20, 2019

FR Passed. The progress indicator works as expected.
The value set before the show() is shown on the progress indicator. Also the progress dialog is successfully re-shown and no error is shown in logs.
Verified on:
Mac OS 10.14.6
Ti SDK: 8.2.0.v20190820142426
Appc CLI: 7.1.1-master.2
Node: 10.5.0
JDK: 10.0.2
Studio: 5.1.3.201907112159

@sgtcoolguy sgtcoolguy merged commit 6a656b9 into tidev:master Aug 22, 2019
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