<commit_before>function InitView() {
	
	// create object instance
	var self = Ti.UI.createWindow({
		title:'Login',
	    width: '100%',
	    height: '100%',
		backgroundColor:'#ffffff',
	});
		
	var containerView = Ti.UI.createView({
		backgroundColor: 'transparent',
		width: '90%',
		height: '90%',
		top: '5%',
		left: '5%',
		layout: 'vertical'
	});
	self.add(containerView);
	
	var logoImage = Titanium.UI.createImageView({
	  image:'/zwarm-logo.png',
	  top: '7%'
	});
	containerView.add(logoImage);
	
	var nicknameLabel = Titanium.UI.createLabel({
		color:'#000000',
		text:'Please enter a nickname',
		font:{fontSize:30, fontFamily:'Helvetica Neue'},
		textAlign:'center',
		width:Ti.UI.FILL,
		height:Ti.UI.SIZE,
		top: '7%'
	});
	containerView.add(nicknameLabel);
	
	var nicknameInput = Ti.UI.createTextField({
		width:Ti.UI.FILL,
		height:Ti.UI.SIZE,
		top: '7%',
		hintText: 'anonymous'
	});
	containerView.add(nicknameInput);
	
	var initButton = Ti.UI.createButton({
		title: 'Go!',
		width: Ti.UI.FILL,
		top: '7%',
	});
	initButton.addEventListener('click', function(event) {
		var user = {
			id: Ti.Platform.createUUID(), 
			nickname: getNickname(),
			platform: getPlatform(),
			notificationToken: getNotificationToken(),
		}
		
	    // call server		
		var SwarmClient = require('/network/SwarmClient');
		var swarmClient = new SwarmClient();
		swarmClient.addUser(user, function(userJSON) {
			// set properties
			Ti.App.Properties.setString('user.id', userJSON.id);
			Ti.App.Properties.setString('user.name', userJSON.name);
			self.close();
		});
		
	});
	containerView.add(initButton);
	
	var getNickname = function() {
		var nickname = nicknameInput.value.trim();
		if (nickname.length == 0) {
			nickname = nicknameInput.hintText;
		}
		return nickname;
	}
	var getPlatform = function() {
		var platform = 'unknown';
		
		var osname = Ti.Platform.osname;
		if ((osname === 'iphone') || (osname === 'ipad')) {
			platform = 'ios';
		} else if (osname === 'android') {
			platform = 'android';
		}
		
		return platform;
	}
	var getNotificationToken = function() {
		var notificationToken = 'unknown';
		if (Ti.App.Properties.hasProperty('user.notificationToken')) {
			notificationToken = Ti.App.Properties.getString('user.notificationToken');
		}		
		return notificationToken;
	}
	
	return self;
};

module.exports = InitView;<commit_msg>Send empty notification token and not "unknown"<commit_after>function InitView() {
	
	// create object instance
	var self = Ti.UI.createWindow({
		title:'Login',
	    width: '100%',
	    height: '100%',
		backgroundColor:'#ffffff',
	});
		
	var containerView = Ti.UI.createView({
		backgroundColor: 'transparent',
		width: '90%',
		height: '90%',
		top: '5%',
		left: '5%',
		layout: 'vertical'
	});
	self.add(containerView);
	
	var logoImage = Titanium.UI.createImageView({
	  image:'/zwarm-logo.png',
	  top: '7%'
	});
	containerView.add(logoImage);
	
	var nicknameLabel = Titanium.UI.createLabel({
		color:'#000000',
		text:'Please enter a nickname',
		font:{fontSize:30, fontFamily:'Helvetica Neue'},
		textAlign:'center',
		width:Ti.UI.FILL,
		height:Ti.UI.SIZE,
		top: '7%'
	});
	containerView.add(nicknameLabel);
	
	var nicknameInput = Ti.UI.createTextField({
		width:Ti.UI.FILL,
		height:Ti.UI.SIZE,
		top: '7%',
		hintText: 'anonymous'
	});
	containerView.add(nicknameInput);
	
	var initButton = Ti.UI.createButton({
		title: 'Go!',
		width: Ti.UI.FILL,
		top: '7%',
	});
	initButton.addEventListener('click', function(event) {
		var user = {
			id: Ti.Platform.createUUID(), 
			nickname: getNickname(),
			platform: getPlatform(),
			notificationToken: getNotificationToken(),
		}
		
	    // call server		
		var SwarmClient = require('/network/SwarmClient');
		var swarmClient = new SwarmClient();
		swarmClient.addUser(user, function(userJSON) {
			// set properties
			Ti.App.Properties.setString('user.id', userJSON.id);
			Ti.App.Properties.setString('user.name', userJSON.name);
			self.close();
		});
		
	});
	containerView.add(initButton);
	
	var getNickname = function() {
		var nickname = nicknameInput.value.trim();
		if (nickname.length == 0) {
			nickname = nicknameInput.hintText;
		}
		return nickname;
	}
	var getPlatform = function() {
		var platform = 'unknown';
		
		var osname = Ti.Platform.osname;
		if ((osname === 'iphone') || (osname === 'ipad')) {
			platform = 'ios';
		} else if (osname === 'android') {
			platform = 'android';
		}
		
		return platform;
	}
	var getNotificationToken = function() {
		var notificationToken = '';
		if (Ti.App.Properties.hasProperty('user.notificationToken')) {
			notificationToken = Ti.App.Properties.getString('user.notificationToken');
		}		
		return notificationToken;
	}
	
	return self;
};

module.exports = InitView;
{'fraction_non_alphanumeric': 0.16480975404666806, 'fraction_numerical': 0.010510826150935463, 'mean_word_length': 3.88, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5685305', 'n_tokens_mistral': 1871, 'n_tokens_neox': 1603, 'n_words': 318}