/* Copyright 2009 Palm, Inc.  All rights reserved. */

EndThreeAssistant = Class.create({
		
	initialize: function() {
		
	},
	
	setup: function() {
		this.controller.enableFullScreenMode(true);
		this.timer = setTimeout(this.doneHandler.bind(this), 1000);	
	},
	
	handleCommand : function(event) {
		if (event.type == Mojo.Event.back) {
			event.stop();
            event.preventDefault();
            event.stopPropagation();
		}
  	},
	
	doneHandler: function(){
		if(this.timer) {
			clearTimeout(this.timer);
		}  	
	  	this.audioRequest = AppAssistant.accountService.resetDefaultVolume(this.controller);
	  
		if ("cdma" == Account.platformType.toLowerCase()) {
			this.notifyRequest = AppAssistant.accountService.notifyProvisioning(this.readNotificationStatus.bind(this), this.controller);
		} else {
			FirstUseUtil.saveDoneState();
		}											
  	},
	
  	readNotificationStatus: function (response) {
		if(response.errorCode) {
			Mojo.Log.error("--------- Could not notify provisioning to process NIDC ---------", Object.toJSON(response));
		} else {
			Mojo.Log.info("--------- Notified provisioning to process NIDC ---------", Object.toJSON(response));
		}
		FirstUseUtil.saveDoneState();
	}
});
