<commit_before>/*
 * Example app for demo of the DropboxTi module
 * 
 *
Member									Location			Notes
-(id)isLinked;							app.js
-(NSArray*)userIds:(id)args;			app.js
-(id)link:(id)args;						app.js
-(id)unlink:(id)args;					app.js
-(void)loadAccountInfo:(id)args;		app.js
-(void)loadMetadata:(id)args;			app.js
-(void)loadDelta:(id)cursor;			app.js				Two methods chunked and loadall
-(void)loadThumbnail:(id)args;			viewdetail.js
-(void)cancelThumbnailLoad:(id)args;	viewdetail.js
-(void)loadRevisionsForFile:(id)args;	app.js / fileui.js
-(void)restoreFile:(id)args;			app.js / fileui.js
-(void)loadFile:(id)args;				app.js / fileui.js
-(void)cancelFileLoad:(NSString*)path;
-(void)createFolder:(id)args;			app.js
-(void)deletePath:(id)args;				app.js
-(void)copyPath:(id)args;				app.js / fileui.js
-(void)createCopyRef:(id)args;			app.js / fileui.js
-(void)movePath:(id)args;				app.js / fileui.js
-(void)uploadFile:(id)args;				app.js
-(void)loadSharableLink:(id)args;		app.js / fileui.js
-(void)loadStreamableURL:(id)args;		app.js / fileui.js
-(void)searchPath:(id)args;				app.js
 
 */

//bootstrap and check dependencies
if (Ti.version < 3.0 ) {
	alert('Sorry - this application requires Titanium Mobile SDK 3.0 or later');	  	
}

// This is a single context application with multiple windows in a stack
(function() {

/*
 * BEFORE USING THIS APP YOU MUST CREATE A FILE CALLED
 * KeysNotForGit.js
 * In that file put:
 * 
	var myAppKey = "<< REPLACE WITH YOUR KEY>>"
	var myAppSecret = "<< REPLACE WITH YOUR SECRET >>";
 */
Ti.include('KeysNotForGit.js');

var Dropbox = require('com.clinsoftsol.dropboxti');
var DBClient = Dropbox.createClient({
									appKey: myAppKey,
                                    appSecret: myAppSecret,
                                    appRoot: Dropbox.DB_ROOT_FULL,
                                    onerror: function(e) {dbclientError(e.error,e.subtype,e.code);},
                                    });

// View detail needs the client object
require('viewdetail').setDropboxClient(DBClient);

if(DBClient.isLinked) {                                    
	// I don't know why, but it seem account info needs to be called before
	// any of the other network operations work.
	// So if linked call this straight away
    DBClient.loadAccountInfo({dontFireLoaded: true});
}

//var containingWin = Ti.UI.createWindow({});
var win = Ti.UI.createWindow({title: 'Dropbox Example App', backgroundColor: 'white', layout: 'vertical'});
//var nv = Ti.UI.iPhone.createNavigationGroup({window: win});
var nv = Ti.UI.iOS.createNavigationWindow({ window: win });
//containingWin.add(nv);

// var win2 = Titanium.UI.createWindow({    backgroundColor: 'red', title: 'Red Window' });
// var win1 = Titanium.UI.iOS.createNavigationWindow({ window: win2 });
// var win3 = Titanium.UI.createWindow({ backgroundColor: 'blue', title: 'Blue Window' });
// win1.open();

var data = [];

data.push({title: 'Version: '+Ti.App.version, func: 'noop'});
data.push({title: 'Link', func: 'link'});
data.push({title: 'Unlink', func: 'unlink'});
data.push({title: 'Get Account Info', func: 'acinfo'});
data.push({title: 'Load Metadata from path', func: 'loadmeta'});
data.push({title: 'Load Delta chunked', func: 'delta'});
data.push({title: 'Load Delta using loadall', func: 'deltaall'});
data.push({title: 'Create Folder', func: 'mkdir'});
data.push({title: 'Delete Path', func: 'rm'});
data.push({title: 'Search', func: 'search'});
data.push({title: 'Upload test file', func: 'upload'});
data.push({title: 'Upload known non-existent', func: 'uploadnon'});

var tv = Ti.UI.createTableView({
	data: data,
});

tv.addEventListener('click',function(e){
	var func = e.row.func;<commit_msg>remove dead code<commit_after>/*
 * Example app for demo of the DropboxTi module
 * 
 *
Member									Location			Notes
-(id)isLinked;							app.js
-(NSArray*)userIds:(id)args;			app.js
-(id)link:(id)args;						app.js
-(id)unlink:(id)args;					app.js
-(void)loadAccountInfo:(id)args;		app.js
-(void)loadMetadata:(id)args;			app.js
-(void)loadDelta:(id)cursor;			app.js				Two methods chunked and loadall
-(void)loadThumbnail:(id)args;			viewdetail.js
-(void)cancelThumbnailLoad:(id)args;	viewdetail.js
-(void)loadRevisionsForFile:(id)args;	app.js / fileui.js
-(void)restoreFile:(id)args;			app.js / fileui.js
-(void)loadFile:(id)args;				app.js / fileui.js
-(void)cancelFileLoad:(NSString*)path;
-(void)createFolder:(id)args;			app.js
-(void)deletePath:(id)args;				app.js
-(void)copyPath:(id)args;				app.js / fileui.js
-(void)createCopyRef:(id)args;			app.js / fileui.js
-(void)movePath:(id)args;				app.js / fileui.js
-(void)uploadFile:(id)args;				app.js
-(void)loadSharableLink:(id)args;		app.js / fileui.js
-(void)loadStreamableURL:(id)args;		app.js / fileui.js
-(void)searchPath:(id)args;				app.js
 
 */

//bootstrap and check dependencies
if (Ti.version < 3.0 ) {
	alert('Sorry - this application requires Titanium Mobile SDK 3.0 or later');	  	
}

// This is a single context application with multiple windows in a stack
(function() {

/*
 * BEFORE USING THIS APP YOU MUST CREATE A FILE CALLED
 * KeysNotForGit.js
 * In that file put:
 * 
	var myAppKey = "<< REPLACE WITH YOUR KEY>>"
	var myAppSecret = "<< REPLACE WITH YOUR SECRET >>";
 */
Ti.include('KeysNotForGit.js');

var Dropbox = require('com.clinsoftsol.dropboxti');
var DBClient = Dropbox.createClient({
									appKey: myAppKey,
                                    appSecret: myAppSecret,
                                    appRoot: Dropbox.DB_ROOT_FULL,
                                    onerror: function(e) {dbclientError(e.error,e.subtype,e.code);},
                                    });

// View detail needs the client object
require('viewdetail').setDropboxClient(DBClient);

if(DBClient.isLinked) {                                    
	// I don't know why, but it seem account info needs to be called before
	// any of the other network operations work.
	// So if linked call this straight away
    DBClient.loadAccountInfo({dontFireLoaded: true});
}

var win = Ti.UI.createWindow({title: 'Dropbox Example App', backgroundColor: 'white', layout: 'vertical'});
var nv = Ti.UI.iOS.createNavigationWindow({ window: win });

var data = [];

data.push({title: 'Version: '+Ti.App.version, func: 'noop'});
data.push({title: 'Link', func: 'link'});
data.push({title: 'Unlink', func: 'unlink'});
data.push({title: 'Get Account Info', func: 'acinfo'});
data.push({title: 'Load Metadata from path', func: 'loadmeta'});
data.push({title: 'Load Delta chunked', func: 'delta'});
data.push({title: 'Load Delta using loadall', func: 'deltaall'});
data.push({title: 'Create Folder', func: 'mkdir'});
data.push({title: 'Delete Path', func: 'rm'});
data.push({title: 'Search', func: 'search'});
data.push({title: 'Upload test file', func: 'upload'});
data.push({title: 'Upload known non-existent', func: 'uploadnon'});

var tv = Ti.UI.createTableView({
	data: data,
});

tv.addEventListener('click',function(e){
	var func = e.row.func;
{'fraction_non_alphanumeric': 0.16476299257567104, 'fraction_numerical': 0.0018560822387207311, 'mean_word_length': 3.5814257684761284, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2174064', 'n_tokens_mistral': 2564, 'n_tokens_neox': 2350, 'n_words': 571}