<commit_before>var args = arguments[0] || {};

if(OS_ANDROID) {
	$.landingPage.addEventListener('open', function(){	
		$.landingPage.activity.actionBar.hide();
	});
}
function createBeaconDialog(msg, title, link, beacon){
	var dialog = Ti.UI.createAlertDialog({
	    cancel: 1,
	    buttonNames: ['Confirm', 'Cancel'],
	    message: msg,
	    title: title,
	});
	dialog.addEventListener('click', function(e){
	    if (e.index === e.source.cancel){
	      	Ti.API.info('The cancel button was clicked');
	    }else{
	    	Ti.API.info(link);	
	    	beacon = true;
	    }
	});
  	dialog.show();
}

///BEACONS IOS
if(OS_IOS){
		Alloy.Globals.TiBeacon.addEventListener("changeAuthorizationStatus", function(e){
		   if (e.status != "authorized") {
		      Ti.API.error("not authorized");
		   }
		});
		
		Alloy.Globals.TiBeacon.addEventListener("bluetoothStatus", function(e){
		   if (e.status != "on") {
		      
		      
		      	var dialog = Ti.UI.createAlertDialog({
		      		message: 'Sätt på bluetooth för att få ut det mesta från appen.',
		      		title:'Bluetooth',
		      		ok: 'Ok',
		      	});
		      	
		      	dialog.show();
		     
		   }
		});
		
		Alloy.Globals.TiBeacon.requestBluetoothStatus();
		
		function enterRegion(e) {
			
			if(e.identifier == 'conference'){
				createBeaconDialog("Välkommen till JimDavis!", "Välkommen", "http://www.jimdavislabs.se", Alloy.Globals.AcceptedBeacon1);
			}else if(e.identifier == 'hall'){
				createBeaconDialog("Glöm inte toapappret", "Toaletten", "link", Alloy.Globals.AcceptedBeacon2);
			}else if(e.identifier == 'kitchen'){
				createBeaconDialog("Sätt gärna på kaffet i köket", "Köket", "kitchen", Alloy.Globals.AcceptedBeacon3);
			}
			
			Alloy.Globals.TiBeacon.startRangingForBeacons(e);
		}
		
		function exitRegion(e){
			if(e.identifier == 'conference'){
				alert("Du lämnar konferensrumemt nu. Tack för besöket!");
			}
		}
		
		function updateInformation(e){
			if (e.identifier == 'conference' && e.proximity == "near"){
				//alert("Du är i konferensrummet nu. Grattis!");
			}else if (e.identifier == 'hall' && e.proximity == "near"){
				//alert("Du är i hallen nu. Grattis!");
			}else if (e.identifier == 'kitchen' && e.proximity == "near"){
				//alert("Du är i köket! Glöm inte kaffet!");
			}
		}

		Alloy.Globals.TiBeacon.addEventListener("enteredRegion", enterRegion);
		Alloy.Globals.TiBeacon.addEventListener("beaconProximity", updateInformation);
		Alloy.Globals.TiBeacon.addEventListener("exitedRegion", exitRegion);
			
		
        Alloy.Globals.TiBeacon.startMonitoringForRegion({
            uuid : "B9407F30-F5F8-466E-AFF9-25556B57FE6D",
            identifier : "conference",
            major: 25458,
            minor: 53209
        });
        Alloy.Globals.TiBeacon.startMonitoringForRegion({
        	uuid : "B9407F30-F5F8-466E-AFF9-25556B57FE6D",
        	identifier: "hall",
        	major: 41796, 
        	minor: 19133,
        });
       Alloy.Globals.TiBeacon.startMonitoringForRegion({
        	uuid: "B9407F30-F5F8-466E-AFF9-25556B57FE6D",
        	identifier: "kitchen",
        	major: 51092,
        	minor: 34572,
        });
}else if(OS_ANDROID){
	
		if(Ti.Platform.version >= 4.3){
			Alloy.Globals.TiBeacon.initBeacon({
				success: onSuccess,
				error: onError,
				interval: 10,
				region: onRegion,
				found: onFound,
			});
			
			function onSuccess(e){
				Ti.API.info("SUCCESS : " + JSON.stringify(e));
			}
			
	
				
			function onRegion(e){
				Ti.API.info("BEACON : "+ JSON.stringify(e));
				if(e.uuid == "B9407F30-F5F8-466E-AFF9-25556B57FE6D"){
					if(e.major == "25458" && e.minor == "53209"){
						createBeaconDialog("Välkommen till JimDavis!", "Välkommen", "http://www.jimdavislabs.se", Alloy.Globals.AcceptedBeacon1);
					}
					if(e.major == "41796" && e.minor == "19133"){
						createBeaconDialog("Glöm inte toapappret", "Toaletten", "link", Alloy.Globals.AcceptedBeacon2);
					}
					if(e.major == "51092" && e.minor == "34572"){
						createBeaconDialog("Sätt gärna på kaffet i köket", "Köket", "kitchen", Alloy.Globals.AcceptedBeacon3);
					}
				}
			}
			
			function onFound(e){
				Ti.API.info("FOUND : " + JSON.stringify(e));
				if(e.uuid == "B9407F30F5F8466EAFF925556B57FE6D"){
					if(e.major == "25458" && e.minor == "53209"){
						createBeaconDialog("Välkommen till JimDavis!", "Välkommen", "http://www.jimdavislabs.se", Alloy.Globals.AcceptedBeacon1);
					}
					if(e.major == "41796" && e.minor == "19133"){
						createBeaconDialog("Glöm inte toapappret", "Toaletten", "link", Alloy.Globals.AcceptedBeacon2);
					}
					if(e.major == "51092" && e.minor == "34572"){
						createBeaconDialog("Sätt gärna på kaffet i köket", "Köket", "kitchen", Alloy.Globals.AcceptedBeacon3);
					}
				}
			}
			
			function onError(e){
				Ti.API.info("ERROR BEACON : " + JSON.stringify(e));
			}
			
			if(Alloy.Globals.TiBeacon.isEnabled()){
				Alloy.Globals.TiBeacon.startScanning();
			}
			<commit_msg>beacons<commit_after>var args = arguments[0] || {};

if(OS_ANDROID) {
	$.landingPage.addEventListener('open', function(){	
		$.landingPage.activity.actionBar.hide();
	});
}
function createBeaconDialog(msg, title, link, beacon){
	var dialog = Ti.UI.createAlertDialog({
	    cancel: 1,
	    buttonNames: ['Confirm', 'Cancel'],
	    message: msg,
	    title: title,
	});
	dialog.addEventListener('click', function(e){
	    if (e.index === e.source.cancel){
	      	Ti.API.info('The cancel button was clicked');
	    }else{
	    	Ti.API.info(link);	
	    	beacon = true;
	    }
	});
  	dialog.show();
}

///BEACONS IOS
if(OS_IOS){
		Alloy.Globals.TiBeacon.addEventListener("changeAuthorizationStatus", function(e){
		   if (e.status != "authorized") {
		      Ti.API.error("not authorized");
		   }
		});
		
		Alloy.Globals.TiBeacon.addEventListener("bluetoothStatus", function(e){
		   if (e.status != "on") {
		      
		      
		      	var dialog = Ti.UI.createAlertDialog({
		      		message: 'Sätt på bluetooth för att få ut det mesta från appen.',
		      		title:'Bluetooth',
		      		ok: 'Ok',
		      	});
		      	
		      	dialog.show();
		     
		   }
		});
		
		Alloy.Globals.TiBeacon.requestBluetoothStatus();
		
		function enterRegion(e) {
			
			if(e.identifier == 'conference'){
				createBeaconDialog("Välkommen till JimDavis!", "Välkommen", "http://www.jimdavislabs.se", Alloy.Globals.AcceptedBeacon1);
			}else if(e.identifier == 'hall'){
				createBeaconDialog("Glöm inte toapappret", "Toaletten", "link", Alloy.Globals.AcceptedBeacon2);
			}else if(e.identifier == 'kitchen'){
				createBeaconDialog("Sätt gärna på kaffet i köket", "Köket", "kitchen", Alloy.Globals.AcceptedBeacon3);
			}
			
			Alloy.Globals.TiBeacon.startRangingForBeacons(e);
		}
		
		function exitRegion(e){
			if(e.identifier == 'conference'){
				alert("Du lämnar konferensrumemt nu. Tack för besöket!");
			}
		}
		
		function updateInformation(e){
			if (e.identifier == 'conference' && e.proximity == "near"){
				//alert("Du är i konferensrummet nu. Grattis!");
			}else if (e.identifier == 'hall' && e.proximity == "near"){
				//alert("Du är i hallen nu. Grattis!");
			}else if (e.identifier == 'kitchen' && e.proximity == "near"){
				//alert("Du är i köket! Glöm inte kaffet!");
			}
		}

		Alloy.Globals.TiBeacon.addEventListener("enteredRegion", enterRegion);
		Alloy.Globals.TiBeacon.addEventListener("beaconProximity", updateInformation);
		Alloy.Globals.TiBeacon.addEventListener("exitedRegion", exitRegion);
			
		
        Alloy.Globals.TiBeacon.startMonitoringForRegion({
            uuid : "B9407F30-F5F8-466E-AFF9-25556B57FE6D",
            identifier : "conference",
            major: 25458,
            minor: 53209
        });
        Alloy.Globals.TiBeacon.startMonitoringForRegion({
        	uuid : "B9407F30-F5F8-466E-AFF9-25556B57FE6D",
        	identifier: "hall",
        	major: 41796, 
        	minor: 19133,
        });
       Alloy.Globals.TiBeacon.startMonitoringForRegion({
        	uuid: "B9407F30-F5F8-466E-AFF9-25556B57FE6D",
        	identifier: "kitchen",
        	major: 51092,
        	minor: 34572,
        });
}else if(OS_ANDROID){
	
		if(Ti.Platform.version >= 4.3){
			Alloy.Globals.TiBeacon.initBeacon({
				success: onSuccess,
				error: onError,
				interval: 5,
				region: onRegion,
				found: onFound,
			});
			
			function onSuccess(e){
				Ti.API.info("SUCCESS : " + JSON.stringify(e));
			}
			
	
				
			function onRegion(e){
				Ti.API.info("BEACON : "+ JSON.stringify(e));
				e = e.device;
				if(e.uuid == "B9407F30F5F8466EAFF925556B57FE6D"){
					if(e.major == "25458" && e.minor == "53209"){
						createBeaconDialog("Välkommen till JimDavis!", "Välkommen", "http://www.jimdavislabs.se", Alloy.Globals.AcceptedBeacon1);
					}
					if(e.major == "41796" && e.minor == "19133"){
						createBeaconDialog("Glöm inte toapappret", "Toaletten", "link", Alloy.Globals.AcceptedBeacon2);
					}
					if(e.major == "51092" && e.minor == "34572"){
						createBeaconDialog("Sätt gärna på kaffet i köket", "Köket", "kitchen", Alloy.Globals.AcceptedBeacon3);
					}
				}
			}
			
			function onFound(e){
				Ti.API.info("FOUND : " + JSON.stringify(e));
				e = e.device;
				if(e.uuid == "B9407F30F5F8466EAFF925556B57FE6D"){
					if(e.major == "25458" && e.minor == "53209"){
						createBeaconDialog("Välkommen till JimDavis <- Found!", "Välkommen", "http://www.jimdavislabs.se", Alloy.Globals.AcceptedBeacon1);
					}
					if(e.major == "41796" && e.minor == "19133"){
						createBeaconDialog("Glöm inte toapappret <- Found", "Toaletten", "link", Alloy.Globals.AcceptedBeacon2);
					}
					if(e.major == "51092" && e.minor == "34572"){
						createBeaconDialog("Sätt gärna på kaffet i köket <- Found", "Köket", "kitchen", Alloy.Globals.AcceptedBeacon3);
					}
				}
			}
			
			function onError(e){
				Ti.API.info("ERROR BEACON : " + JSON.stringify(e));
			}
			
			if(Alloy.Globals.TiBeacon.isEnabled()){
				Alloy.Globals.TiBeacon.startScanning();
			}
			
{'fraction_non_alphanumeric': 0.1614457831325301, 'fraction_numerical': 0.04106425702811245, 'mean_word_length': 2.952777777777778, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3687749', 'n_tokens_mistral': 4570, 'n_tokens_neox': 3651, 'n_words': 591}