Description
When showing an alert dialog if one is already shown then the app will throw a runtime error.
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
backgroundColor:'#fff'
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
label1.addEventListener('click', function(){
alert('hi');
setTimeout(function(){
alert('hi2');
},1000);
})
win1.add(label1);
win1.open();
Steps to reproduce
1. Add the above code to an app.js
2. Build to an emulator/device
3. Tap the label
4. Dismiss the alert and the runtime error
5. Tap the label and then tap the close button
Actual result
3. The app will throw a runtime error
5. No runtime error as the first alert has been dismissed
Expected result
A runtime error should not be thrown
For comparison: on iOS, when I tried this, the first alert dialog remained open until I dismissed it, then the second one appeared. So it basically waited until the first was done. Looks like we need to implement some queue or locking mechanism for subsequent dialogs to wait until the first is dismissed. Here's the relevant code in iOS: https://github.com/appcelerator/titanium_mobile/blob/17dc8754653daaff170ea0c18f74218168a5633e/iphone/Classes/TiUIAlertDialogProxy.m#L90
PR: https://github.com/appcelerator/titanium_mobile_windows/pull/367
Verified the fix. Showing an alert dialog with another dialog now does not throw any runtime error. Closing. Environment: Appc Studio: 4.1.0.201507071122 Ti SDK: 4.2.0.v20150710092422 Ti CLI: 4.0.1 Alloy: 1.6.2 Windows: 8.1 Enterprise 64-bit APPC NPM: 4.1.0 APPC CLI: 4.1.0 Device: Nokia Lumia 928 - Windows Phone 8.1 Windows emulator : 8.1