Titanium JIRA Archive
Appcelerator Community (AC)

[AC-92] Window Focus event Fire some times fire and some times it doesn't. Even app get hangs up and next window is not opening.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionCannot Reproduce
Resolution Date2015-11-11T02:46:24.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
LabelsWindow, bug, eventlistener, fires, focus, problem
ReporterMoizChhatriwala
AssigneeMostafizur Rahman
Created2015-04-20T10:55:11.000+0000
Updated2015-11-11T02:46:24.000+0000

Description

My application was running good with titanium sdk 3.4.0, but after updating the titanium SDK 3.5.1 and Titanium SDK 4.0 Beta, both version I am facing the same problem. Focus event some time fire for the window and some time it doesn't, I has created the application with JS pattern using Ti.UI.current window object and that application is created 1.5 years before, I always make the app compatible to the newer sdk which gets launch up. But with current sdk app is completely get disturbed and has lots of bugs, only because of the problem that window Focus event doesn't fire properly, due to this window get hangs up. I have created the sample application which can exactly reproduce this issue. Request for the appcelerator team to take this issue very seriously. Step To reproduce the issue: Run the application on iOS 1. Click on Open Blue Window. 2.Alert dialog will appear, click on Confirm. 3. Second window In blue color will get open. 4. On second window on top right navigation bar click on "Open third window" 5. On 3 window with pink color will get open, click on "Close pink window" Now when you go back to second window, second window focus will not fire, and then you navigate to first window, first window focus will not fire. Even the application will get hang, all the buttons will stop working and even next window doesn't get opens up on click of "open click window.

Attachments

FileDateSize
DemoNavigationApp.zip2015-05-06T07:38:15.000+000019290

Comments

  1. Papia Chowdhury 2015-04-24

    Hello Could you please provide us test case regarding this issue? Thanks
  2. MoizChhatriwala 2015-04-27

  3. MoizChhatriwala 2015-05-06

    Step To reproduce the issue: 1. Click on Open Blue Window. 2.Alert dialog will appear, click on Confirm. 3. Second window In blue color will get open. 4. On second window on top right navigation bar click on "Open third window" 5. On 3 window with pink color will get open, click on "Close pink window" Now when you go back to second window, second window focus will not fire, and then you navigate to first window, first window focus will not fire. Even the application will get hang, all the buttons will stop working and even next window doesn't get opens up on click of "open click window.
  4. Radamantis Torres-Lechuga 2015-05-11

    [~moizchhatriwala], the use of "url" property for Ti.UI.window has been deprecated, please create a new test case that replicates this issue without the url property Thanks
  5. MoizChhatriwala 2015-05-12

    Actually the application in which we are facing problem, they are created long time before, if the API is deprecated so it doesn't mean that testing will not be done while upgrading the titanium SDK version. Rather than that if users are reporting the bug then efforts should be made to solve the major issue. Its The titanium appcelerator responsibility to resolve the issues which user are facing due to launch of new SDK version. Secondly to make the platform reliable and trustable for the customer this excuse should not be given, rather than efforts should be made in resolving the issues which are reported by the user. No platform can become best if they do not here about the users of that platform. Last point, its titanium responsibility to test the same bug using common.js pattern of code, to insure the Quality Assurance of the titanium product. Hope from your end that bug will be solved soon from your end. Regards, Moiz
  6. Radamantis Torres-Lechuga 2015-05-12

    [~moizchhatriwala] Of course we are responsible to fix bugs in the platform, mobile is a dynamic world and as Apple or Android, with every new release there are new API's and some deprecated API's, our responsibility is to let our users know through the docs, and the responsibility of the developers is to maintain their code, and adapt it with new releases, this is the same in all the platforms and also in all the frameworks, if an API has been deprecated it's going to stop to work and you as developer need to modify your code and adapt it to the new API's. So, if you can create a test case with non deprecated API's that can replicate this issue I would be happy to escalate this to our engineering team for a fix. Best
  7. Amimul Hossain 2015-09-19

    Hello [~moizchhatriwala], Using CommonJS Method, I have tested the below project. Its working as expected. Window focus event is working. As URL property is deprecated in Ti.UI.window, i modified your demo project in CommonJS method. Please follow this coding pattern for future development.

    app.js

       var win1 = Titanium.UI.createWindow({
       	backgroundColor : 'red',
       	title : 'Red Window',
       });
       
       var nav = require('nav').create(win1);
       
       var button = Titanium.UI.createButton({
       	title : 'Open Blue Window'
       });
       
       button.addEventListener('click', function() {
       	dialog.show();
       });
       
       var dialog = Ti.UI.createAlertDialog({
       	cancel : 1,
       	buttonNames : ['Confirm', 'Cancel'],
       	message : 'Would you like to open window 2?',
       	title : 'Window Option'
       });
       dialog.addEventListener('click', function(e) {
       	if (e.index == 0) {
       
       		var WindowTwo = require('WindowTwo');
       		var myWindowTwo = new WindowTwo();
       
       		nav.openWindow(myWindowTwo, {
       			animated : true
       		});
       	}
       
       });
       
       win1.add(button);
       
       var button1 = Titanium.UI.createButton({
       	title : 'Open Forth window',
       });
       
       button1.addEventListener('click', function() {
       	var WindowFour = require('WindowFour');
       	var myWindowFour = new WindowFour();
       	nav.openWindow(myWindowFour, {
       		animated : true
       	});
       });
       
       win1.leftNavButton = button1;
       win1.addEventListener("focus", function(e) {
       
       	Ti.API.info("Focus On First Window");
       });
       
       nav.open(); 
       

    WindowTwo.js

       var WindowTwo = function() {
       	
       	var nav = require('nav').getNav();
       	
       	var win2 = Titanium.UI.createWindow({
       		backgroundColor : 'blue',
       		title : 'Blue Window',
       		
       	});
       
       	var button1 = Titanium.UI.createButton({
       		title : 'Open Third Window',
       		top : 20,
       		height : 30
       	});
       
       	button1.addEventListener('click', function() {
       		var WindowThree = require('WindowThree');
           	var myWindowThree = new WindowThree();
       		nav.openWindow(myWindowThree, {
       			animated : true
       		});
       	});
       
       	win2.rightNavButton = button1;
       
       	var button = Titanium.UI.createButton({
       		title : 'Close Blue Window',
       	});
       	
       	button.addEventListener('click', function() {
       		alert("closing window 2");
       		nav.closeWindow(win2);
       	});
       
       	win2.add(button);
       
       	win2.addEventListener("focus", function(e) {
       		Ti.API.info("Focus On Second Window");
       	});
       
       	return win2;
       
       };
       
       module.exports = WindowTwo; 
       

    WindowThree.js

       var WindowThree = function(navWin) {
       	var nav = require('nav').getNav();
       	
       	var win3 = Titanium.UI.createWindow({
       		backgroundColor : 'gray',
       		title : 'Gray Window',
       		
       	});
       	
       	var button1 = Titanium.UI.createButton({
       		title : 'Open Forth Window',
       	});
       
       	button1.addEventListener('click', function() {
       		var WindowFour = require('WindowFour');
           	var myWindowFour = new WindowFour();
       		nav.openWindow(myWindowFour, {
       			animated : true
       		});
       	});
       	
       	win3.rightNavButton = button1;
       
       	var button = Titanium.UI.createButton({
       		title : 'Close Gray Window'
       	});
       	
       	button.addEventListener('click', function() {
       		alert("closing window 3");
       		nav.closeWindow(win3);
       	});
       
       	win3.add(button);
       
       	win3.addEventListener("focus", function(e) {
       		Ti.API.info("Focus On Third Window");
       	});
       
       	return win3;
       
       };
       
       module.exports = WindowThree; 
       

    WindowFour.js

       var WindowFour = function(navWin) {
       	var nav = require('nav').getNav();
       	
       	var win4 = Titanium.UI.createWindow({
       		backgroundColor : 'pink',
       		title : 'Pink Window',
       		
       	});
       
       	var button = Titanium.UI.createButton({
       		title : 'Close Pink Window'
       	});
       	button.addEventListener('click', function() {
       		alert("closing window 4");
       		nav.closeWindow(win4);
       	});
       
       	win4.add(button);
       
       	win4.addEventListener("focus", function(e) {
       		Ti.API.info("Focus On Forth Window");
       	});
       
       	return win4;
       
       };
       
       module.exports = WindowFour; 
       

    nav.js

       var nav;
        
       function create(win1) {
           nav = Ti.UI.iOS.createNavigationWindow({
               window: win1
           });
           return nav;
       }
       function getNav() {
           return nav;
       }
        
       exports.create = create;
       exports.getNav = getNav;
       
       
    Hope this helps, Thanks.

JSON Source