<commit_before>/**
 * events raised here:
 * 'my_timeline_refresh' 
 */

function MyTimelineAssistant(argFromPusher) {
	
	/* this is the creator function for your scene assistant object. It will be passed all the 
	   additional parameters (after the scene name) that were passed to pushScene. The reference
	   to the scene controller (this.controller) has not be established yet, so any initialization
	   that needs the scene controller should be done in the setup function below. */
	scene_helpers.addCommonSceneMethods(this);

	var thisA = this;
	

	/*
		this connects App to this property of the appAssistant
	*/
	App = Spaz.getAppObj();
	
	
	Mojo.Log.error('argFromPusher: %j', argFromPusher);
	if (argFromPusher && argFromPusher.filter) {
		sch.error('argFromPusher.filter:'+argFromPusher.filter);
	}

	if (argFromPusher && argFromPusher.firstload === true) {
		// console.debug();
		// this.clearTimelineCache();
	}

	if (argFromPusher && argFromPusher.filter) {
		this.setFilterState(argFromPusher.filter);
		this.toggleCmd = argFromPusher.filter;
		// this.filterTimeline(null, true);
	}

	if (argFromPusher && argFromPusher.mark_cache_as_read === false) {
		this.markCacheAsRead = false;
	} else {
	this.markCacheAsRead = true;
}
	
	this.cacheVersion = 3;  // we increment this when we change how the cache works	
	
	/**
	 * empties the timeline and resets the lastids in the twit object
	 * 
	 * bound to temp_cache_cleared 
	 * 
	 * we define this here to get the closure thisA
	 */
	this.resetTwitState = function() {
		App.master_timeline_model.items = [];
		thisA.timeline_model.items = [];
		thisA.controller.modelChanged(thisA.timeline_model);
		thisA.twit.setLastId(SPAZCORE_SECTION_HOME, 0);
		thisA.twit.setLastId(SPAZCORE_SECTION_REPLIES, 0);
		thisA.twit.setLastId(SPAZCORE_SECTION_DMS,     0);

	};
	
	/*
		we might need to NOT save the cache on deactivate, if we switch users from here
	*/
	this.doNotSaveCacheOnDeactivate = false;
	
}

MyTimelineAssistant.prototype.aboutToActivate = function(callback){
	callback.defer(); //delays displaying scene, looks better
};


MyTimelineAssistant.prototype.setup = function() {
	Mojo.Log.error("SETUP");

	var thisA = this;
	

	this.scroller = this.controller.getSceneScroller();


	/* this function is for setup tasks that have to happen when the scene is first created */

	this.initAppMenu({ 'items':LOGGEDIN_APPMENU_ITEMS });

	this.initTwit('DOM');
	//Sets up meta-tap + scroll handler
	<commit_msg>set this.cacheLoaded = false in constructor<commit_after>/**
 * events raised here:
 * 'my_timeline_refresh' 
 */

function MyTimelineAssistant(argFromPusher) {
	
	/* this is the creator function for your scene assistant object. It will be passed all the 
	   additional parameters (after the scene name) that were passed to pushScene. The reference
	   to the scene controller (this.controller) has not be established yet, so any initialization
	   that needs the scene controller should be done in the setup function below. */
	scene_helpers.addCommonSceneMethods(this);

	var thisA = this;
	

	/*
		this connects App to this property of the appAssistant
	*/
	App = Spaz.getAppObj();
	
	
	Mojo.Log.error('argFromPusher: %j', argFromPusher);
	if (argFromPusher && argFromPusher.filter) {
		sch.error('argFromPusher.filter:'+argFromPusher.filter);
	}

	if (argFromPusher && argFromPusher.firstload === true) {
		// console.debug();
		// this.clearTimelineCache();
	}

	if (argFromPusher && argFromPusher.filter) {
		this.setFilterState(argFromPusher.filter);
		this.toggleCmd = argFromPusher.filter;
		// this.filterTimeline(null, true);
	}

	if (argFromPusher && argFromPusher.mark_cache_as_read === false) {
		this.markCacheAsRead = false;
	} else {
	this.markCacheAsRead = true;
}
	
	this.cacheVersion = 3;  // we increment this when we change how the cache works	
	
	/**
	 * empties the timeline and resets the lastids in the twit object
	 * 
	 * bound to temp_cache_cleared 
	 * 
	 * we define this here to get the closure thisA
	 */
	this.resetTwitState = function() {
		App.master_timeline_model.items = [];
		thisA.timeline_model.items = [];
		thisA.controller.modelChanged(thisA.timeline_model);
		thisA.twit.setLastId(SPAZCORE_SECTION_HOME, 0);
		thisA.twit.setLastId(SPAZCORE_SECTION_REPLIES, 0);
		thisA.twit.setLastId(SPAZCORE_SECTION_DMS,     0);

	};
	
	/*
		we might need to NOT save the cache on deactivate, if we switch users from here
	*/
	this.doNotSaveCacheOnDeactivate = false;
	
	/*
		when we first create this, the cache is definitely NOT loaded
	*/
	this.cacheLoaded = false;
	
}

MyTimelineAssistant.prototype.aboutToActivate = function(callback){
	callback.defer(); //delays displaying scene, looks better
};


MyTimelineAssistant.prototype.setup = function() {
	Mojo.Log.error("SETUP");

	var thisA = this;
	

	this.scroller = this.controller.getSceneScroller();


	/* this function is for setup tasks that have to happen when the scene is first created */

	this.initAppMenu({ 'items':LOGGEDIN_APPMENU_ITEMS });

	this.initTwit('DOM');
	//Sets up meta-tap + scroll handler
	
{'fraction_non_alphanumeric': 0.10482758620689656, 'fraction_numerical': 0.0015763546798029558, 'mean_word_length': 4.070929070929071, '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': '4877818', 'n_tokens_mistral': 1753, 'n_tokens_neox': 1648, 'n_words': 439}