<commit_before>Divvy = {}; // We want to intialize our program into a single function first

if (Ti.App.Properties.hasProperty('uuid'))
{
	Divvy.UUID = Ti.App.Properties.getString('uuid');
}
else
{
	Divvy.UUID = Ti.Platform.createUUID();
	Ti.App.Properties.setString('uuid', Divvy.UUID);
}

Divvy.jpgcompressor = require('com.sideshowcoder.jpgcompressor');
Divvy.jpgcompressor.setCompressSize(102400);
Divvy.jpgcompressor.setWorstCompressQuality(0.5);

Titanium.Storekit = Ti.Storekit = require('ti.storekit');
Titanium.Admob = Ti.Admob = require('ti.admob');

Divvy.developmentMode = true;

if (Divvy.developmentMode)
{
	Divvy.testflight = require('com.0x82.testflight');
	Divvy.testflight.takeOff('488eb7c844eded229570cdf2384e8137_MzgyNDcyMDExLTExLTAxIDIyOjIxOjQwLjA3NjIzNg');
}

/*
 * Any configurations to Titanium itself, and variables that need to be set
 * throughout the application. Kind of like Global Variables in a sense.
 */
Titanium.UI.iPhone.statusBarStyle = Titanium.UI.iPhone.StatusBar.TRANSLUCENT_BLACK;
Titanium.UI.orientation = Ti.UI.PORTRAIT;

if (Ti.Platform.osname == 'ipad')	
	Divvy.winBarImage = 'images/navbar-ipad.png';
else
	Divvy.winBarImage = 'images/navbar-iphone.png';
	
Divvy.winBarColor = '#333';

Divvy.deviceHeight = 480;
Divvy.deviceWidth = 320;
Divvy.device = 'iphone';

if (Ti.Platform.osname == 'ipad')
{
	Divvy.deviceHeight = 1024;
	Divvy.deviceWidth = 768;
	Divvy.device = 'ipad';
}

Divvy.url = 'https://divvy.burst-dev.com/api/';

/*
 * Take in all the other code we need.
 */
Ti.include(
	'aps.js',
	'network.js',
	'buckets.js',
	'view.js',
	'create.js',
	'join.js',
	'preview.js',
	'settings.js',
	'upgrade.js'
);

/* 
 * Now we begin rendering the UI itself.
 */
// TI Tabs is the overlord for windows.
Divvy.tabs = Ti.UI.createTabGroup({bottom: -50});
Divvy.tab = Ti.UI.createTab();

Divvy.open = function(window)
{
	Divvy.tab.open(window, {animated: true});
};

//init takes UI objects and places it in memory
Divvy.Buckets.init();
Divvy.View.init();
Divvy.Create.init();
Divvy.Join.init();
Divvy.Preview.init();
Divvy.Settings.init();
Divvy.Upgrade.init();

//TODO: Fix ads, they are really buggy.

if (!Divvy.Upgrade.check())
{
	Divvy.Buckets.addAds();
	Divvy.View.addAds();
}


//open actually shows our UI elements.
Divvy.Buckets.open();

if (Divvy.developmentMode)
{
	Network.cache.asyncPost(
		Divvy.url + 'join',
		{ duid: Divvy.UUID, bucket_id: '100075', password: '<PASSWORD>' },
		Divvy.Join.onSuccess,
		Divvy.Join.onError,
		'yellow'
	);
}

Divvy.tab.window = Divvy.Buckets.win; // this is our intial window, we need to pass it to the overlord
Divvy.tabs.addTab(Divvy.tab);
Divvy.tabs.open();

Divvy.APS.open();

// Save initial launch command line arguments
Ti.App.launchURL = '';
Ti.App.pauseURL = '';

Divvy.cmd = Ti.App.getArguments();
if (Divvy.cmd.hasOwnProperty('url'))
	Ti.App.launchURL = Divvy.cmd.url;
 
// Save launch URL at the time last paused
Ti.App.addEventListener('pause', function(e)
{
	Divvy.state = 'paused';
	Ti.App.pauseURL = Ti.App.launchURL;
});
 
// After app is fully resumed, recheck if launch arguments
// have changed and ignore duplicate schemes.
Ti.App.addEventListener('resumed', function(e)
{
	Ti.App.launchURL = '';
	
	Divvy.cmd = Ti.App.getArguments();
	if (Divvy.cmd.hasOwnProperty('url'))
	{
		if (Divvy.cmd.url != Ti.App.pauseURL)
		{
			Ti.App.launchURL = Divvy.cmd.url;
			var cmdObj = parseQS(Divvy.cmd.url)
			Divvy.Join.openWithValues(cmdObj.bucketId, cmdObj.bucketPw);
		}
   }
   
   Divvy.state = 'open';
});

/*
 * Adding event listeners if app is brought in and out of background
 * and refresh services, to refresh the bucket views.
 */

/*
Ti.App.addEventListener('resume', function(e)<commit_msg>More fixes.<commit_after>Divvy = {}; // We want to intialize our program into a single function first

if (Ti.App.Properties.hasProperty('uuid'))
{
	Divvy.UUID = Ti.App.Properties.getString('uuid');
}
else
{
	Divvy.UUID = Ti.Platform.createUUID();
	Ti.App.Properties.setString('uuid', Divvy.UUID);
}

Divvy.jpgcompressor = require('com.sideshowcoder.jpgcompressor');
Divvy.jpgcompressor.setCompressSize(102400);
Divvy.jpgcompressor.setWorstCompressQuality(0.5);

Titanium.Storekit = Ti.Storekit = require('ti.storekit');
Titanium.Admob = Ti.Admob = require('ti.admob');

Divvy.developmentMode = true;

if (Divvy.developmentMode)
{
	Divvy.testflight = require('com.0x82.testflight');
	Divvy.testflight.takeOff('488eb7c844eded229570cdf2384e8137_MzgyNDcyMDExLTExLTAxIDIyOjIxOjQwLjA3NjIzNg');
}

/*
 * Any configurations to Titanium itself, and variables that need to be set
 * throughout the application. Kind of like Global Variables in a sense.
 */
Titanium.UI.iPhone.statusBarStyle = Titanium.UI.iPhone.StatusBar.TRANSLUCENT_BLACK;
Titanium.UI.orientation = Ti.UI.PORTRAIT;

if (Ti.Platform.osname == 'ipad')	
	Divvy.winBarImage = 'images/navbar-ipad.png';
else
	Divvy.winBarImage = 'images/navbar-iphone.png';
	
Divvy.winBarColor = '#333';

Divvy.deviceHeight = 480;
Divvy.deviceWidth = 320;
Divvy.device = 'iphone';

if (Ti.Platform.osname == 'ipad')
{
	Divvy.deviceHeight = 1024;
	Divvy.deviceWidth = 768;
	Divvy.device = 'ipad';
}

Divvy.url = 'https://divvy.burst-dev.com/api/';

/*
 * Take in all the other code we need.
 */
Ti.include(
	'aps.js',
	'network.js',
	'buckets.js',
	'view.js',
	'create.js',
	'join.js',
	'preview.js',
	'settings.js',
	'upgrade.js'
);

/* 
 * Now we begin rendering the UI itself.
 */
// TI Tabs is the overlord for windows.
Divvy.tabs = Ti.UI.createTabGroup({bottom: -50});
Divvy.tab = Ti.UI.createTab();

Divvy.open = function(window)
{
	Divvy.tab.open(window, {animated: true});
};

//init takes UI objects and places it in memory
Divvy.Buckets.init();
Divvy.View.init();
Divvy.Create.init();
Divvy.Join.init();
Divvy.Preview.init();
Divvy.Settings.init();
Divvy.Upgrade.init();

//TODO: Fix ads, they are really buggy.

if (!Divvy.Upgrade.check())
{
	Divvy.Buckets.addAds();
	Divvy.View.addAds();
}


//open actually shows our UI elements.
Divvy.Buckets.open();

if (Divvy.developmentMode)
{
	Network.cache.asyncPost(
		Divvy.url + 'join',
		{ duid: Divvy.UUID, bucket_id: '100075', password: '<PASSWORD>' },
		Divvy.Join.onSuccess,
		Divvy.Join.onError,
		'yellow'
	);
}

Divvy.tab.window = Divvy.Buckets.win; // this is our intial window, we need to pass it to the overlord
Divvy.tabs.addTab(Divvy.tab);
Divvy.tabs.open();

Divvy.APS.open();

// Save initial launch command line arguments
Ti.App.launchURL = '';
Ti.App.pauseURL = '';

Divvy.cmd = Ti.App.getArguments();
if (Divvy.cmd.hasOwnProperty('url'))
	Ti.App.launchURL = Divvy.cmd.url;
 
// Save launch URL at the time last paused
Ti.App.addEventListener('pause', function(e)
{
	Divvy.state = 'paused';
	Ti.App.pauseURL = Ti.App.launchURL;
});
 
// After app is fully resumed, recheck if launch arguments
// have changed and ignore duplicate schemes.
Ti.App.addEventListener('resumed', function(e)
{
	Ti.App.launchURL = '';
	
	Divvy.cmd = Ti.App.getArguments();
	if (Divvy.cmd.hasOwnProperty('url'))
	{
		if (Divvy.cmd.url != Ti.App.pauseURL)
		{
			Ti.App.launchURL = Divvy.cmd.url;
			var cmdObj = parseQS(Divvy.cmd.url)
			Divvy.Join.openWithValues(cmdObj.bucketId, cmdObj.bucketPw);
		}
   }
   
   Divvy.state = 'open';
});

Divvy.state = 'open';

/*
 * Adding event listeners if app is brought in and out of background
 * and refresh services, to refresh the bucket views.
 */

/*
Ti.App.addEventListener('resume', function(e)
{'fraction_non_alphanumeric': 0.1581282775312626, 'fraction_numerical': 0.015328761597418314, 'mean_word_length': 4.238028169014084, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1304795', 'n_tokens_mistral': 2985, 'n_tokens_neox': 2786, 'n_words': 570}