Exemplo n.º 1
0
		var interval = setInterval(function(){
			
			if (database.databaseUpdated()) {
				
				Ti.API.info('Ready (finished updating)');
				
				if (database.userIsLogged()) {
					Ti.API.info('A user is Logged In');
					// Automatically gets the current user from database obj
					// If logged in, open the Dashboard
					var dash = Alloy.createController('dashboard').getView();
					dash.open();
				} else {
					var index = Alloy.createController('index').getView();
					index.open();
				}
				
				loader.close();
				loader = null;
				
				clearInterval(interval);
				imageSync.checkAndDownload();
				
			}
			
		}, 500);
Exemplo n.º 2
0
				
				clearInterval(interval);
				imageSync.checkAndDownload();
				
			}
			
		}, 500);
		
	}

} else {
	
	// Offline Mode
	Ti.API.info('offline');
     
	if (database.userIsLogged()) {
		Ti.API.info('A user is Logged In');
		// Automatically gets the current user from database obj
		// If logged in, open the Dashboard
		var dash = Alloy.createController('dashboard').getView();
		dash.open();
	} else {
		var index = Alloy.createController('index').getView();
		index.open();
	}
	
	loader.close();
	loader = null;
	
	alert('You are working in offline mode. Any quotes you receive are accurate since your last login. Prices may vary when you next come back online. Your quotes will be saved locally to your handset.');