Commit ef14267c278810b51be8e5da2feadeaa44a330a2

  • avatar
  • dBsooner's Stuff <dbsooner @del…ge.vision5.com>
  • Sun Mar 07 03:05:32 CET 2010
1 New, 1 Updated.
  
1diff --git a/usr/palm/applications/com.palm.app.findapps/allscripts.js b/usr/palm/applications/com.palm.app.findapps/allscripts.js
2index 4b788aa..25e1612 100644
3--- a/usr/palm/applications/com.palm.app.findapps/allscripts.js
4+++ b/usr/palm/applications/com.palm.app.findapps/allscripts.js
5@@ -191,6 +191,10 @@ var DefaultStageAssistant = Class.create(
6 var self = this;
7 var menu = new Weave.Utilities.AppMenu()
8 .addEdit()
9+ .addItem($L("Hide App Vendors"),
10+ function () {
11+ self.controller.pushScene("hide");
12+ })
13 .addItem($L('Preferences & Accounts'),
14 function()
15 {
16@@ -256,6 +260,10 @@ var WebDistributedStageAssistant = Class.create(
17 var self = this;
18 var menu = new Weave.Utilities.AppMenu()
19 .addEdit()
20+ .addItem($L("Hide App Vendors"),
21+ function () {
22+ self.controller.pushScene("hide");
23+ })
24 .addItem($L('Preferences & Accounts'),
25 function()
26 {
27diff --git a/usr/palm/applications/com.palm.app.findapps/allscriptscompressed.js b/usr/palm/applications/com.palm.app.findapps/allscriptscompressed.js
28index 185b8ae..dba7f7c 100644
29--- a/usr/palm/applications/com.palm.app.findapps/allscriptscompressed.js
30+++ b/usr/palm/applications/com.palm.app.findapps/allscriptscompressed.js
31@@ -1 +1 @@
32-var AppAssistant=Class.create({_name:"findapps",initialize:function(){Mojo.Log.info("AppAssistant::initialize");Weave.Services.ConnectionManager.monitor()},setup:function(){Mojo.Log.info("AppAssistant::setup");var a=this;Weave.System.Activator.addInterface("main",{_defaultStage:"default",init:function(c){var b=this;Weave.System.Activator.open(this._defaultStage,"DefaultStageAssistant",function(d){b.start(d,b._defaultStage)})},start:function(b,c){Mojo.Log.info("AppAssistant(main) start");if(!TermsOfUse.isAccepted()){b.controller.pushScene("terms",function(d){if(d){b._gotoMain()}else{Weave.System.Activator.close(c)}})}else{b._gotoMain()}},});Weave.System.Activator.addInterface("myapps",{_defaultStage:"default",init:function(c){var b=this;Weave.System.Activator.open(this._defaultStage,"DefaultStageAssistant",function(d){b.start(d,b._defaultStage)})},start:function(b,c){Mojo.Log.info("AppAssistant(myapps) start");var d=b.controller.topScene();if(!d||d.sceneName!="myapps"){b.controller.pushScene("myapps")}},});Weave.System.Activator.addInterface("target",{_defaultStage:"default",_webDistributedStage:"webDistributed",init:function(d){Mojo.Log.info("AppAssistant(target).init target %s",d);var b=a._findAppAndPackageId(d);var c=new AppDetails(b.applicationId,b.packageId);c.attach(this);c.getDetailsFromServer()},updateDetails:function(f){var e=this._defaultStage;var d="DefaultStageAssistant";var b=f.getProgramType();Mojo.Log.info("AppAssistant(target).updateDetails programType %s",b);if(b&&(b=="W"||b=="B")){e=this._webDistributedStage+(new Date()).getTime();d="WebDistributedStageAssistant"}var c=this;Weave.System.Activator.open(e,d,function(g){c.target(f,g,e)})},target:function(d,b,c){Mojo.Log.info("AppAssistant(target).target id:%j",d._packageid);d.detach(this);if(!TermsOfUse.isAccepted()){b.controller.pushScene("terms",function(e){if(e){b.controller.swapScene("details",null,null,d)}else{Weave.System.Activator.close(c)}})}else{b.controller.pushScene("details",null,null,d)}}})},cleanup:function(){Mojo.Log.info("AppAssistant.cleanup");if(Catalog&&Catalog.AppDownloadMngr){Catalog.AppDownloadMngr.cleanup()}Weave.Services.ConnectionManager.cleanup()},handleLaunch:function(a){Mojo.Log.info("AppAssistant::handleLaunch params *%j*",a);if(!a||a==""){a={main:""}}Weave.System.Activator.run(a)},_findAppAndPackageId:function(b){Mojo.Log.info("AppAssistant::_findAppAndPackageId target",b);var a=/[?&]packageid=([^&]*)(?:&applicationid=(\d*)){0,1}/.exec(b);return a?{packageId:a[1],applicationId:a[2]}:{}},});var DefaultStageAssistant=Class.create({setup:function(){var a=this;var b=new Weave.Utilities.AppMenu().addEdit().addItem($L("Preferences & Accounts"),function(){a.controller.pushScene("prefs")},function(){return myProfile.uscarrier}).addHelp("http://help.palm.com/app_catalog/index.html");Weave.Utilities.AppMenu.setDefault(b);Weave.Services.DeviceProfile.getCarrierIdentification(function(c,d){if(c&&((d.mcc>=310&&d.mcc<=316)||PalmSystem.version.match("desktop"))){myProfile.uscarrier=true;myProfile.carrierName=d.shortName}else{b._items.splice(1,1)}})},_gotoMain:function(){var b=false;var c=this.controller.getScenes();if(c){for(var a=c.size()-1;a>=0;a--){var e=c[a];if(e.sceneName=="main"){b=true;break}}}var d=this.controller.topScene();if(d&&d.sceneName!="main"){this.controller.popScenesTo("main")}if(!b){this.controller.pushScene("main")}}});var WebDistributedStageAssistant=Class.create({setup:function(){var a=this;var b=new Weave.Utilities.AppMenu().addEdit().addItem($L("Preferences & Accounts"),function(){a.controller.pushScene("prefs")},function(){return myProfile.uscarrier}).addHelp("http://help.palm.com/app_catalog/index.html");Weave.Utilities.AppMenu.setDefault(b);Weave.Services.DeviceProfile.getCarrierIdentification(function(c,d){if(c&&((d.mcc>=310&&d.mcc<=316)||PalmSystem.version.match("desktop"))){myProfile.uscarrier=true;myProfile.carrierName=d.shortName}else{b._items.splice(1,1)}})},});var MainAssistant=Class.create({initialize:function(){Mojo.Log.info("MainAssistant.initialize")},setup:function(){Mojo.Log.info("MainAssistant.setup");this._gotoApp=this._gotoApp.bindAsEventListener(this);this._gotoTag=this._gotoTag.bindAsEventListener(this);this._gotoTagCloud=this._gotoTagCloud.bindAsEventListener(this);this._gotoTopRated=this._gotoTopRated.bindAsEventListener(this);this._gotoMostRecent=this._gotoMostRecent.bindAsEventListener(this);this._gotoFreeApps=this._gotoFreeApps.bindAsEventListener(this);this._gotoSearch=this._gotoSearch.bindAsEventListener(this);this._searchKey=this._searchKey.bindAsEventListener(this);this._gotoExploreTags=this._gotoExploreTags.bindAsEventListener(this);this._focusSearch=this._focusSearch.bindAsEventListener(this);this._searchModel={value:""};this.controller.setupWidget("in-fa-ma-search-text",{hintText:$L("Search..."),focus:false,enterSubmits:true,multiline:false,modifierState:Mojo.Widget.sentenceCase,focusMode:Mojo.Widget.focusInsertMode,requiresEnterKey:true,changeOnKeyPress:true,},this._searchModel);this.controller.setupWidget("dv-fa-ma-popularappslist",{itemTemplate:"main/main-app",itemsCallback:this._featuredItemsCallback.bind(this),formatters:{dummy:this._formatFeaturedItem.bind(this),},onItemRendered:this._renderFeaturedItem.bind(this),},{});this.controller.setupWidget("dv-fa-ma-popularappslist-scroller",{},{mode:"horizontal"});this.controller.setupWidget(Mojo.Menu.commandMenu,{menuClass:"no-fade",},{items:[{},{},{label:$L("My Apps"),command:"myapps",icon:"bag"},],});Catalog.AppDownloadMngr.attach(this);Weave.Utilities.AppMenu.useDefault(this)},ready:function(){if(myProfile.validCC===undefined){Weave.Services.PaymentServer.verifyPaymentSetup(function(a,b){if(a&&b.OutGetCCPaymentInfos.ccPaymentInfos.length>0){myProfile.validCC=b}})}},cleanup:function(){Catalog.AppDownloadMngr.detach(this);Mojo.Log.info("MainAssistant.cleanup")},activate:function(){Mojo.Log.info("MainAssistant.activate");this.controller.get("in-fa-ma-search-text").addEventListener(Mojo.Event.propertyChange,this._searchKey);this.controller.get("dv-fa-ma-popularappslist").addEventListener(Mojo.Event.listTap,this._gotoApp);this.controller.get("dv-fa-ma-tag-explore").addEventListener(Mojo.Event.tap,this._gotoExploreTags);this.controller.get("dv-fa-ma-tag-mostrecent").addEventListener(Mojo.Event.tap,this._gotoMostRecent);this.controller.get("dv-fa-ma-tag-toprated").addEventListener(Mojo.Event.tap,this._gotoTopRated);this.controller.get("search-button").addEventListener(Mojo.Event.tap,this._gotoSearch);this._searchModel.value="";this.controller.modelChanged(this._searchModel);this.controller.get("search-button").style.visibility="hidden";this.controller.document.addEventListener(Mojo.Event.tap,this._focusSearch);this.controller.get("in-fa-ma-search-text").mojo.focus()},deactivate:function(){Mojo.Log.info("MainAssistant.deactivate");this.controller.get("in-fa-ma-search-text").removeEventListener(Mojo.Event.propertyChange,this._gotoSearch);this.controller.get("dv-fa-ma-popularappslist").removeEventListener(Mojo.Event.listTap,this._gotoApp);this.controller.get("dv-fa-ma-tag-explore").removeEventListener(Mojo.Event.tap,this._gotoExploreTags);this.controller.get("dv-fa-ma-tag-mostrecent").removeEventListener(Mojo.Event.tap,this._gotoMostRecent);this.controller.get("dv-fa-ma-tag-toprated").removeEventListener(Mojo.Event.tap,this._gotoTopRated);this.controller.get("search-button").removeEventListener("mouseup",this._gotoSearch);this.controller.document.removeEventListener(Mojo.Event.tap,this._focusSearch)},_featuredItemsCallback:function(c,d,b){var a=this;Weave.Services.ApplicationServer.getFeaturedApplications(function(e,h,i,g){a.controller.get("popularapps-loader").style.display="none";a.controller.get("dv-fa-ma-popularappslist-scroller").style.display="block";if(e){var f=a.controller.get("palm-disclaimer");if(g=="final"&&f.hasClassName("beta")){f.removeClassName("beta")}else{if(g=="beta"&&!f.hasClassName("beta")){f.addClassName("beta")}}a.controller.get("dv-fa-ma-popularappslist").mojo.noticeUpdatedItems(0,i)}else{Utilities.Errors.displayError(h)}})},_formatFeaturedItem:function(b,a){a.formattedAverageRating=(""+(Math.round(a.averageRating*2)/2)).replace(/\./,"");if(this._getApplicationInstalledState(a)=="update"){a.formattedUpdateAvailable="has-update"}else{a.formattedUpdateAvailable=""}},_renderFeaturedItem:function(c,a,b){new LazyLoadImage(a.appIcon,b.querySelector(".app-picture"))},_gotoApp:function(a){this.controller.stageController.pushScene("details",a.item.id,a.item.publicApplicationId)},_gotoExploreTags:function(a){this.controller.stageController.pushScene("browse",undefined,false)},_gotoTag:function(a){this.controller.stageController.pushScene("search","tag",a.item.name)},_gotoTagCloud:function(a){this.controller.stageController.pushScene("tagcloud")},_gotoTopRated:function(a){this.controller.stageController.pushScene("search","sort","by_rating")},_gotoMostRecent:function(a){this.controller.stageController.pushScene("search","sort","by_date")},_gotoFreeApps:function(a){this.controller.stageController.pushScene("search","sort","PRICE_DESC")},_gotoSearch:function(a){this.controller.stageController.pushScene("search","query",this.controller.get("in-fa-ma-search-text").mojo.getValue())},_searchKey:function(a){if(a.originalEvent.type=="keyup"&&a.originalEvent.keyCode==Mojo.Char.enter){this.controller.stageController.pushScene("search","query",a.value)}else{if(a.value==""){this.controller.get("search-button").style.visibility="hidden"}else{this.controller.get("search-button").style.visibility="visible"}}},updateInstalledApps:function(){Mojo.Log.info("MainAssistant.updateInstalledApps");var a=this.controller.get("dv-fa-ma-popularappslist").mojo;if(a){var b=a.getLoadedItemRange();a.noticeUpdatedItems(b.offset,a.getItems(b.offset,b.limit))}},_getApplicationInstalledState:function(a){var b=Catalog.AppDownloadMngr.getInstalledApp(a.publicApplicationId);if(b){Mojo.Log.info("versions: installed %s download %s",b.installedVersion,a.appVersion);if(Utilities.VersionCheck.compare(b.installedVersion,a.appVersion)!=-1){return"installed"}else{return"update"}}return"notinstalled"},handleCommand:function(a){if(a.type==Mojo.Event.command&&a.command=="myapps"){this.controller.stageController.pushScene("myapps")}},_focusSearch:function(a){this.controller.get("in-fa-ma-search-text").mojo.focus.defer()}});var PasswordAssistant=Class.create({initialize:function(a,b){this.sceneAssistant=a;this.controller=a.controller;this._loginAttemptCount=0;this._params=b;this._params.sceneAssistant=a;this._custserviceurl=$L("http://www.palm.com/us/support/mobile/webos/contact.html")},setup:function(a){this.widget=a;this.acctPasswordAttr={hintText:$L("enter password"),modelProperty:"original",autoFocus:true,maxLength:20,changeOnKeyPress:true,requiresEnterKey:true,focusMode:Mojo.Widget.focusSelectMode};this.acctPasswordModel={original:""};this.controller.setupWidget("acctPassword",this.acctPasswordAttr,this.acctPasswordModel);this.controller.get("acctPassword").observe(Mojo.Event.propertyChange,this._passwordChanged.bind(this));this.buttonAttr={disabledProperty:"disabled"};this.buttonModel={disabled:true,buttonLabel:$L("Continue"),buttonClass:"palm-button"};this.controller.setupWidget("submitPassword",this.buttonAttr,this.buttonModel);Mojo.listen(this.controller.get("submitPassword"),Mojo.Event.tap,this._isUserValid.bindAsEventListener(this));this.forgotButtonAttr={disabledProperty:"disabled"};this.forgotButtonModel={disabled:false,buttonLabel:$L("Forgot password"),buttonClass:"palm-button"};this.controller.setupWidget("forgotPasswordButton",this.forgotButtonAttr,this.forgotButtonModel);this.controller.listen("forgotPasswordButton",Mojo.Event.tap,this._forgotPassword.bindAsEventListener(this));this._getAccountToken();this.passwordField=this.controller.get("acctPassword")},activate:function(){this.passwordField.mojo.focus()},_passwordChanged:function(a){if(this.acctPasswordModel.original.length>0){this.buttonModel.disabled=false}else{this.buttonModel.disabled=true}this.controller.modelChanged(this.buttonModel);if(Mojo.Char.isEnterKey(a.originalEvent.keyCode)){if(this.buttonModel.disabled==false){this.passwordField.mojo.blur();this._isUserValid();Event.stop(a)}else{this.passwordField.mojo.focus()}}},_getAccountToken:function(){Mojo.Log.info("------------------- Get account token ------------------");Weave.Services.AccountServices.getAccountToken(function(a,c,b,d){if(a){if(b!=undefined){myProfile.email=b;myProfile.state=d}else{Mojo.Log.error("PasswordAssistant._getAccountToken: accountAlias == undefined: No account token")}}else{Mojo.Log.error("No account token")}})},_displayErrors:function(a,b){this.controller.get("passwordLengthError").style.display=(a?null:"none");this.controller.get("passwordError").style.display=(b?null:"none")},_isUserValid:function(){this._loginAttemptCount++;myProfile.password=this.acctPasswordModel.original;if((myProfile.password.length<6)||(myProfile.password.length>20)){this._displayErrors(true,false);this.passwordField.mojo.focus.defer()}else{if(!Weave.Services.ConnectionManager.isOnline()){this._displayErrors(false,false)}else{this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel);var a=this;Weave.Services.DeviceProfile.getDeviceId(function(c,b){if(c&&b){Weave.Services.AccountServices.isUserValid(myProfile.email,myProfile.password.replace(/ /g,""),b,function(d,e){if(d){Mojo.Log.info("Login attempt: "+a._loginAttemptCount);if(e.isValid==true){a._displayErrors(false,false);myProfile.idToken=e.idToken;a.widget.mojo.close();if(e.passwordResetFlag){a.controller.showDialog({template:"payment-setup/reset-password-dialog",assistant:new ResetPasswordAssistant(a,a._params)})}else{Preferences.setLoginTime();a._params.onComplete({passwordValid:true})}}else{if(myProfile.questionId==-2){Weave.Services.AccountServices.getAccountSecurityQuestions(myProfile.email,Mojo.Locale.current,function(f,g){if(f){if(g.id!==undefined){Mojo.Log.info("Got security question",g.id);myProfile.questionId=g.id;myProfile.questionText=g.question}else{myProfile.questionId=-1}}else{Mojo.Log.error("Error in getting account security question = %o",$H(g));myProfile.questionId=-1}a._loginError()})}else{a._loginError()}}}else{if(e.errorCode&&e.errorCode==="CONNECTION_ERROR"){this.widget.mojo.close()}}})}else{Mojo.Log.error("Could not get device id %o",$H(response))}})}}},_loginError:function(){if(this._loginAttemptCount>=3){if(myProfile.questionId>=0){this._forgotPassword()}else{Mojo.Log.info("sending password reset");var a=this;Weave.Services.AccountServices.requestPasswordResetEmail(myProfile.email,function(b,c){if(b){Mojo.Log.info("------------ resetEmailSuccess -----------------%o",$H(c));a.controller.showAlertDialog({onChoose:function(d){a.widget.mojo.close();a._params.onComplete({})},title:$L("Password reset"),message:$L('Follow the instructions we sent to <b>#{email}</b> to reset your password or <a href="#{url}">contact customer service.</a>').interpolate({email:myProfile.email,url:a._custserviceurl}),allowHTMLMessage:true,choices:[{label:$L("Done"),value:"done",type:"color"}]})}else{Mojo.Log.error("could not send password reset email %o",$H(c))}})}}else{Mojo.Log.info("Login attempt: ",this._loginAttemptCount);if(myProfile.questionId>=0){this.controller.get("forgotPassword").show()}this._displayErrors(false,true);this.passwordField.mojo.focus()}},_forgotPassword:function(){this.widget.mojo.close();this.controller.showDialog({template:"payment-setup/security-question-dialog",assistant:new ForgotPasswordAssistant(this,this._params)})},});var ForgotPasswordAssistant=Class.create({initialize:function(a,b){this.sceneAssistant=a;this.controller=a.controller;this.attemptCount=1;this._params=b},setup:function(a){this.widget=a;this._clearErrorMessages();this.controller.get("questionText").update(myProfile.questionText);this.responseAttributes={modelProperty:"response",multiline:false,maxLength:50,textReplacement:false,focusMode:Mojo.Widget.focusInsertMode,changeOnKeyPress:true,requiresEnterKey:true};this.responseModel={response:"",disabled:false};this.controller.setupWidget("response",this.responseAttributes,this.responseModel);this.controller.get("response").observe(Mojo.Event.propertyChange,this.responseTextChanged.bind(this));this.buttonAttr={disabledProperty:"disabled"};this.buttonModel={disabled:true,buttonLabel:$L("Done"),buttonClass:"palm-button"};this.controller.setupWidget("submitAnswer",this.buttonAttr,this.buttonModel);this.controller.listen("submitAnswer",Mojo.Event.tap,this.submitAnswer.bindAsEventListener(this))},activate:function(){this.controller.get("response").mojo.focus()},toggleDisabled:function(){if(this.responseModel.response.length>0){this.buttonModel.disabled=false;this.controller.modelChanged(this.buttonModel)}else{this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel)}},responseTextChanged:function(a){this.responseModel.response=a.value;this.controller.modelChanged(this.responseModel,this);this.toggleDisabled();if(a&&Mojo.Char.isEnterKey(a.originalEvent.keyCode)){if(this.buttonModel.disabled==false){this.submitAnswer();Event.stop(a)}}},_clearErrorMessages:function(){this.controller.get("noResponseMessage").hide();this.controller.get("wrongResponse").hide()},submitAnswer:function(){this.response=this.responseModel.response;this._clearErrorMessages();if(this.response==""||this.response==undefined){this.controller.get("noResponseMessage").show();return}if(Weave.Services.ConnectionManager.isOnline()===false){return}this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel);this.attemptCount++;var a=this;Weave.Services.AccountServices.authenticateAccountFromSecurityQuestion(myProfile.email,myProfile.questionId,this.response,function(b,c){if(b){Mojo.Log.info("authenticate successful: %o",$H(c));if(c.returnValue==true){myProfile.idToken=c.idToken;a.widget.mojo.close();a.controller.showDialog({template:"payment-setup/reset-password-dialog",assistant:new ResetPasswordAssistant(a,a._params)})}}else{a._clearErrorMessages();Mojo.Log.error("changePassword error = %o",$H(c));if(a.attemptCount<=3){a.controller.get("wrongResponse").show();a.controller.get("response").mojo.focus()}else{Weave.Services.AccountServices.requestPasswordResetEmail(myProfile.email,function(d,e){if(d){a.widget.mojo.close();a.controller.showDialog({template:"payment-setup/reset-email-dialog",assistant:new ResetEmailAssistant(a)})}else{a.widget.mojo.close();Mojo.Controller.errorDialog($L("We could not send an email to reset your password. Visit palm.com/support for more help."))}})}}})},});var ResetPasswordAssistant=Class.create({initialize:function(a,b){this.sceneAssistant=a;this.controller=a.controller;this._params=b},setup:function(a){this.widget=a;this.clearErrorMessages();this.acctPasswordAttr={hintText:$L("enter password"),modelProperty:"original",autoFocus:true,maxLength:20,enterSubmits:true,focusMode:Mojo.Widget.focusSelectMode};this.acctPasswordModel={original:""};this.controller.setupWidget("newPassword",this.acctPasswordAttr,this.acctPasswordModel);this.verifyPasswordAttr={hintText:$L("confirm password"),modelProperty:"verify",autoFocus:false,maxLength:20,className:" ",changeOnKeyPress:true,requiresEnterKey:true,focusMode:Mojo.Widget.focusSelectMode};this.verifyPasswordModel={verify:""};this.controller.setupWidget("confirmPassword",this.verifyPasswordAttr,this.verifyPasswordModel);this.controller.get("newPassword").observe(Mojo.Event.propertyChange,this.passwordChanged.bind(this));this.controller.get("confirmPassword").observe(Mojo.Event.propertyChange,this.verifyPasswordChanged.bind(this));this.buttonAttr={disabledProperty:"disabled"};this.buttonModel={disabled:true,buttonLabel:$L("Done"),buttonClass:"palm-button"};this.controller.setupWidget("submitResetPassword",this.buttonAttr,this.buttonModel);this.controller.listen("submitResetPassword",Mojo.Event.tap,this.resetPassword.bindAsEventListener(this))},clearErrorMessages:function(){this.controller.get("mismatchMessage").hide();this.controller.get("noPasswordMessage").hide();this.controller.get("noConfirmMessage").hide();this.controller.get("systemErrorMessage").hide();this.controller.get("passwordLengthError").hide()},toggleDisabled:function(){if(this.acctPasswordModel.original.length>0&&this.verifyPasswordModel.verify.length>0){this.buttonModel.disabled=false;this.controller.modelChanged(this.buttonModel)}else{this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel)}},passwordChanged:function(a){this.toggleDisabled()},verifyPasswordChanged:function(a){this.toggleDisabled();if(a&&Mojo.Char.isEnterKey(a.originalEvent.keyCode)){if(this.buttonModel.disabled==false){if(this.resetPassword()===true){this.controller.get("newPassword").mojo.focus.defer()}Event.stop(a)}}},resetPassword:function(){this.newPassword=this.acctPasswordModel.original;this.confirmPassword=this.verifyPasswordModel.verify;this.clearErrorMessages();this.controller.get("newPassword").mojo.focus.defer();if(this.newPassword==""||this.newPassword==undefined){this.controller.get("noPasswordMessage").show();return true}else{if((this.newPassword.length<6)||(this.newPassword.length>20)){this.controller.get("passwordLengthError").show();return true}else{if(this.confirmPassword==""||this.confirmPassword==undefined){this.controller.get("noConfirmMessage").show();return true}else{if(this.newPassword!=this.confirmPassword){this.controller.get("mismatchMessage").show();return true}else{if(Weave.Services.ConnectionManager.isOnline()===false){}else{Mojo.Log.info("AUTHING ACCOUNT",myProfile.email,myProfile.password,this.newPassword);this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel);var a=this;Weave.Services.AccountServices.changePassword(this.newPassword.replace(/ /g,""),myProfile.questionId,undefined,myProfile.idToken,true,function(b,c){if(b&&c.returnValue){Mojo.Log.info("changePassword successful: %o",$H(c));myProfile.password=a.newPassword;Preferences.setLoginTime();a._params.onComplete({passwordValid:true,passwordChanged:true,})}else{Mojo.Log.error("changePassword error = %o",$H(c));if(Weave.Services.ConnectionManager.isOnline()===false||c.errorText==="No response"){Mojo.Log.info("show connection error ---------------");a.widget.mojo.close()}else{a.controller.get("systemErrorMessage").show()}}})}}}}}},});var ResetEmailAssistant=Class.create({initialize:function(a){this.sceneAssistant=a;this.controller=a.controller},setup:function(a){this.widget=a;this.controller.get("emailAddress").update(myProfile.email);this.controller.listen("doneResetEmail",Mojo.Event.tap,this.doneResetEmail.bindAsEventListener(this))},doneResetEmail:function(a){this.widget.mojo.close()}});var myProfile={email:"",password:"",firstName:"",lastName:"",questionId:-2,response:"",securityQuestions:[],};var Preferences={_timeout:4*60*60*1000,getPaymentLogin:function(){var a=(new Mojo.Model.Cookie("com.palm.app.findapps.paymentPref")).get()||{};Mojo.Log.info("getPaymentLogin %j",a);return a.paymentPref||"timeout"},setPaymentLogin:function(c){var a=new Mojo.Model.Cookie("com.palm.app.findapps.paymentPref");var b=a.get()||{};Mojo.Log.info("setPaymentLogin %j %s",b,c);b.paymentPref=c;a.put(b)},setLoginTime:function(){var a=new Mojo.Model.Cookie("com.palm.app.findapps.paymentPref");var b=a.get()||{};Mojo.Log.info("setLoginTime %j",b);b.loginTime=new Date().getTime();a.put(b)},isLoginTimedOut:function(){var b=(new Mojo.Model.Cookie("com.palm.app.findapps.paymentPref")).get()||{loginTime:0};var a=new Date().getTime();Mojo.Log.info("now %d then %d timeout %d diff %d",a,b.loginTime,this._timeout,a-b.loginTime);if(a-b.loginTime>this._timeout||b.paymentPref=="every"){return true}else{return false}},};var TermsOfUse={_TOSDate:"7th Aug 2009",isAccepted:function(){var a=(new Mojo.Model.Cookie("com.palm.app.findapps.terms")).get()||{};return a.termsOfUseAccepted==this._TOSDate},setAccepted:function(){var a=new Mojo.Model.Cookie("com.palm.app.findapps.terms");var b=a.get()||{};b.termsOfUseAccepted=this._TOSDate;a.put(b)},};var Spinner=Class.create({initialize:function(c,e,d,b,a){this._controller=c.controller;this._model={spinning:false};this._controller.setupWidget(e,{spinnerSize:b?b:"small"},this._model);this._scrim=this._controller.get(a?a:e+"Cont");this._state="stopped";if(d){this.start()}},start:function(){if(this._scrim){this._scrim.show()}this._fire("start")},stop:function(){this._fire("stop")},_fire:function(b){Mojo.Log.info("Spinner event",b,"state",this._state);var a=this;switch(this._state){case"stopped":switch(b){case"start":this._state="starting";this._timer=setTimeout(function(){a._fire("starting2sec")},2000);break;case"stop":case"starting1sec":case"running1sec":break}break;case"starting":switch(b){case"starting2sec":this._state="runningquick";this._model.spinning=true;this._controller.modelChanged(a._model);this._timer=setTimeout(function(){a._fire("running1sec")},1000);break;case"stop":clearTimeout(this._timer);this._state="stopped";if(this._scrim){this._scrim.hide()}break;case"start":case"running1sec":break}break;case"runningquick":switch(b){case"running1sec":this._state="running";break;case"stop":this._state="stopping";break;case"start":case"starting2sec":break}break;case"running":switch(b){case"stop":this._state="stopped";this._model.spinning=false;this._controller.modelChanged(this._model);if(this._scrim){this._scrim.hide()}break;case"start":case"starting2sec":case"running1sec":break}break;case"stopping":switch(b){case"running1sec":this._state="stopped";this._model.spinning=false;this._controller.modelChanged(this._model);if(this._scrim){this._scrim.hide()}break;case"start":this._state="running";break;case"stop":case"starting2sec":break}break}},});var Utilities=Utilities||{};Utilities.CommonErrors={_PMTGroupErrors:{PMT_0:{dialog:true,title:$L("Payment Type"),message:$L("You can only pay with a credit card. Update your account information in Preferences & Accounts and try again. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_1:{dialog:true,title:$L("Payment Failed"),message:$L("We cannot process your payment. Contact your financial institution. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_2:{dialog:true,title:$L("Payment Failed"),message:$L("Update the payment information in your account and try again. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_3:{dialog:true,title:$L("Payment Failed"),message:$L("Cybersource refused your payment. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_4:{dialog:true,title:$L("Payment Failed"),message:$L("You are not permitted to purchase items in the App Catalog. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_5:{dialog:true,title:$L("Transaction Error"),message:$L("The credit card you are using may be fraudulent. Enter a different credit card in Preferences & Accounts and try again. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},},};Utilities.Errors={_displayErrorPage:function(a){var b=Weave.System.Activator.getActiveStageController(true);Mojo.Log.error("Errors._displayErrorPage",a);if(a=="invalidtoken"){Weave.Services.AccountServices.notifyAuthenticationFailure(function(){if(!b){return}b.topScene().showAlertDialog({onChoose:function(){},title:$L("No Palm Profile"),message:$L("You need an active Palm profile to use App Catalog."),choices:[{label:$L("OK"),value:true,type:"dismiss"},]})})}else{if(!b){return}b.swapScene("error",a)}},_displayIncompatibleErrorPage:function(a){Mojo.Log.error("Errors._displayNonFatalErrorPage",a);var b=Weave.System.Activator.getActiveStageController(true);if(!b){return}b.swapScene("incompatible",a)},_displayErrorDialog:function(a,c){var b=Weave.System.Activator.getActiveStageController();if(!b){return}b.topScene().showAlertDialog({onChoose:c,title:a.title,message:a.formattedMessage?a.formattedMessage:a.message,choices:a.choices})},displayError:function(f,d,e,b,c,h){if(f=="failure"&&e&&e.indexOf("PMT_")){f=e}Mojo.Log.error("Errors.displayError errorCode %s, interpolateArgs %j, defaultError %s, defaultMessage %s",f,d,e,c);var a=this._dialogErrors[f]||this._dialogErrors[e];if(!a){if(f.toString().indexOf("PMT")>=0){a=this._dialogErrors[PMT_catchAll]}else{a={dialog:true,title:b||$L("Unknown Error"),message:c||f}}}if(a.page){this._displayErrorPage(f)}else{if(a.incompatible_page){this._displayIncompatibleErrorPage(f)}else{if(a.dialog){if(d){var g=a.message;a.formattedMessage=g.interpolate(d)}this._displayErrorDialog(a,h||function(){})}}}},_dialogErrors:{offline:{page:true},invalidtoken:{page:true},failure:{page:true},badformat:{page:true},timeout:{page:true},jsonexception:{page:true},appunavailable:{page:true},DISC0025:{incompatible_page:true},DISC0124:{incompatible_page:true},DISC0125:{incompatible_page:true},DISC0201:{incompatible_page:true},DISC0202:{incompatible_page:true},DISC0203:{incompatible_page:true},PMT_catchAll:{dialog:true,title:$L("Unexpected problem"),message:$L("App Catalog could not complete the last action you performed. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_addCC_default:{dialog:true,title:$L("Couldn't Add Credit Card"),message:$L("A problem occurred when adding your credit card information. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_modifyCC_default:{dialog:true,title:$L("Couldn't Update"),message:$L("The credit card information could not be updated. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_removeCC_default:{dialog:true,title:$L("Couldn't Remove"),message:$L("The credit card was not removed from your account. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_purchase_default:{dialog:true,title:$L("Couldn't Purchase"),message:$L("The item could not be purchased. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02000:{dialog:true,title:$L("Data Entry"),message:$L("A required field does not exist or is empty"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02002:{dialog:true,title:$L("Data Entry"),message:$L("This card type is not supported"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02003:{dialog:true,title:$L("Data Entry"),message:$L("This order type is not supported"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02005:{dialog:true,title:$L("Data Entry"),message:$L("The State code is incorrect. Try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02006:{dialog:true,title:$L("Data Entry"),message:$L("The Country code is incorrect. Try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02008:{dialog:true,title:$L("Data Entry"),message:$L("The Currency code is incorrect. Try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02010:{dialog:true,title:$L("Data Entry"),message:$L("You must enter valid information in every field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02011:{dialog:true,title:$L("Data Entry"),message:$L("You must enter a number in the Credit Card field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02012:{dialog:true,title:$L("Data Entry"),message:$L("You must enter a number in the Payment Info ID field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02013:{dialog:true,title:$L("Data Entry"),message:$L("You must enter a number in the Quantity field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02014:{dialog:true,title:$L("Data Entry"),message:$L("The date in the Expiration Date field must be in the format mmyyyy"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02015:{dialog:true,title:$L("Data Entry"),message:$L("The value in the Item Unit Price field is not valid. Enter a number instead."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02016:{dialog:true,title:$L("Data Entry"),message:$L("The date in the Order Date field must be in the format yyyyMMddHHmmss"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02017:{dialog:true,title:$L("Data Entry"),message:$L("Update the Expiration Date information in your account and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02018:{dialog:true,title:$L("Data Entry"),message:$L("The Zip code is incorrect. Try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT03000:{dialog:true,title:$L("Transaction Error"),message:$L("Update your credit card information in Preferences & Accounts and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT03001:Utilities.CommonErrors._PMTGroupErrors.PMT_0,PMT03002:{dialog:true,title:$L("Payment Failed"),message:$L("We cannot perform financial transactions in your country."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT03003:Utilities.CommonErrors._PMTGroupErrors.PMT_0,PMT03006:{dialog:true,title:$L("Payment Failed"),message:$L("The last transaction failed. Update the payment information in your account and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT03007:{dialog:true,title:$L("Couldn't Update"),message:$L("Credit card information can only be updated after all pending purchases have cleared. Try again after you received receipts for all recent purchases."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04000:{dialog:true,title:$L("Payment Failed"),message:$L("Update the Expiration Date information in your account and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04001:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04002:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04004:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04005:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04006:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04007:{dialog:true,title:$L("Payment Failed"),message:$L("Update the security number and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04008:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04009:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04010:{dialog:true,title:$L("Data Entry"),message:$L("Update the payment information in your account and try again. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04011:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04012:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04013:Utilities.CommonErrors._PMTGroupErrors.PMT_3,PMT04014:Utilities.CommonErrors._PMTGroupErrors.PMT_3,PMT04015:Utilities.CommonErrors._PMTGroupErrors.PMT_4,PMT04016:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04017:{dialog:true,title:$L("Payment Failed"),message:$L("There is no payment information associated with your Palm Profile. Tap Preferences in the App Menu to set it up."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04018:Utilities.CommonErrors._PMTGroupErrors.PMT_5,PMT04019:Utilities.CommonErrors._PMTGroupErrors.PMT_5,PMT04020:Utilities.CommonErrors._PMTGroupErrors.PMT_5,PMT04021:{dialog:true,title:$L("Transaction Error"),message:$L("A transaction problem has occurred. Update your credit card information in Preferences & Accounts and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04200:{dialog:true,title:$L("Payment Failed"),message:$L("Update your credit card address information and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04400:Utilities.CommonErrors._PMTGroupErrors.PMT_3,PMT04401:Utilities.CommonErrors._PMTGroupErrors.PMT_3,PMT04402:Utilities.CommonErrors._PMTGroupErrors.PMT_4,PMT04403:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04404:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04405:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04406:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04407:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04408:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04409:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04410:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04411:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04412:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04413:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04414:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04415:{dialog:true,title:$L("Transaction Error"),message:$L("There is a problem with the credit card. Enter a different credit card in Preferences & Accounts and try again. PMT04415"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04416:{dialog:true,title:$L("Transaction Error"),message:$L("There may be a problem with the credit card. Enter a different credit card in Preferences & Accounts and try again. PMT04416"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04417:{dialog:true,title:$L("Transaction Error"),message:$L("There is a problem with the credit card. Enter a different credit card in Preferences & Accounts and try again. PMT04417"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT51004:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT51005:Utilities.CommonErrors._PMTGroupErrors.PMT_1,LOCL0001:{dialog:true,title:$L("Data Entry"),message:$L("The address is incomplete. Verify that you’ve entered your complete address."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0002:{dialog:true,title:$L("Data Entry"),message:$L("The payment information is incomplete. Verify that you’ve entered your payment information completely."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0003:{dialog:true,title:$L("Data Entry"),message:$L("Please only enter numbers (0-9) in the account number."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0004:{dialog:true,title:$L("Data Entry"),message:$L("Choose a card type."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0005:{dialog:true,title:$L("Data Entry"),message:$L("You must enter a phone number in the Phone Number field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0006:{dialog:true,title:$L("Data Entry"),message:$L("Verify your billing information. It is incomplete."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0007:{dialog:true,title:$L("Data Entry"),message:$L("Verify your account information. It is incomplete or incorrect."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},validate_space_default_single:{dialog:true,title:$L("Can’t Install"),message:$L("This app requires #{installSize}. You must delete some apps or files before you can install it. Click Help for more information."),choices:[{label:$L("Help"),value:"help",type:"primary"},{label:$L("OK"),value:"ok",type:"secondary"}]},validate_space_default_mult:{dialog:true,title:$L("Can’t Install"),message:$L("#{installSize} is required to install everything. You can install apps one at a time, or delete apps or files to make room. Click Help for more information."),choices:[{label:$L("Help"),value:"help",type:"primary"},{label:$L("OK"),value:"ok",type:"secondary"}]},install_default:{dialog:true,title:$L("Couldn’t Install"),message:$L("There was a problem installing the application"),choices:[{label:$L("Try Again"),value:"retry",type:"primary"},{label:$L("Don't Install"),value:"cancel",type:"secondary"}]},FAILED_NOT_ENOUGH_TEMP_SPACE:{dialog:true,title:$L("Couldn’t Install"),message:$L("This app requires #{installSize}. You must delete some apps or files before you can install it. Click Help for more information."),choices:[{label:$L("Help"),value:"help",type:"primary"},{label:$L("OK"),value:"cancel",type:"secondary"}]},FAILED_NOT_ENOUGH_INSTALL_SPACE:{dialog:true,title:$L("Couldn’t Install"),message:$L("This app requires #{installSize}. You must delete some apps or files before you can install it. Click Help for more information."),choices:[{label:$L("Help"),value:"help",type:"primary"},{label:$L("OK"),value:"cancel",type:"secondary"}]},download_default:{dialog:true,title:$L("Download Error"),message:$L("There was a problem downloading the application."),choices:[{label:$L("Try Again"),value:"retry",type:"primary"},{label:$L("Don't Download"),value:"cancel",type:"secondary"}]},"-3":{dialog:true,title:$L("Download Error"),message:$L("The download file is missing or damaged."),choices:[{label:$L("Try Again"),value:"retry",type:"primary"},{label:$L("Don't Download"),value:"cancel",type:"secondary"}]},"-2":{dialog:true,title:$L("Download Error"),message:$L("The download file is missing or damaged."),choices:[{label:$L("Try Again"),value:"retry",type:"primary"},{label:$L("Don't Download"),value:"cancel",type:"secondary"}]},},};var Utilities=Utilities||{};Utilities.UTCDate=new (Class.create({parse:function(a){var b=new Date();b.setUTCFullYear(a.substring(0,4)-0,a.substring(5,7)-1,a.substring(8,10)-0);b.setUTCHours(a.substring(11,13));b.setUTCMinutes(a.substring(14,16));return b},shortDate:function(a){return""+a.getUTCFullYear()+(a.getUTCMonth()+1).toPaddedString(2)+a.getUTCDate().toPaddedString(2)+a.getUTCHours().toPaddedString(2)+a.getUTCMinutes().toPaddedString(2)+a.getUTCSeconds().toPaddedString(2)},}))();var Utilities=Utilities||{};Utilities.VersionCheck={compare:function(h,g){if(h==null&&g==null){return 0}else{if(h==null){return -1}else{if(g==null){return 1}}}var c=(""+h).split(/[^a-zA-Z0-9]+/);var b=(""+g).split(/[^a-zA-Z0-9]+/);var f=Math.min(c.length,b.length);for(var i=0;i<=f;i++){if(i==c.length){return(i==b.length?0:-1)}else{if(i==b.length){return 1}}var e=this._parseInt(c[i]);var d=this._parseInt(b[i]);if(e!=d){var a=e-d;return a<0?-1:a>0?1:0}e=c[i].toLowerCase();d=b[i].toLowerCase();if(e<d){return -1}else{if(e>d){return 1}}}return 0},_parseInt:function(a){if(a.search(/[^\D]/)){return null}else{return parseInt(a,10)}}};var LazyLoadImage=Class.create({initialize:function(b,c){var a=document.createElement("img");a.onload=function(){this.onload=undefined;c.style.backgroundImage="url("+this.src+")"};a.src=b}});var Utilities=Utilities||{};Utilities.Common={handleCommand:function(b,d){if(b.type==Mojo.Event.command&&b.command=="email"){var a=this._generateAppURL(d);if(a){var c={summary:$L("Check out this webOS app"),text:this._generateEmailMessageText(d,a)};Weave.Services.ApplicationManager.launchApplication("com.palm.app.email",c)}}else{if(b.type==Mojo.Event.command&&b.command=="text"){var a=this._generateAppURL(d);if(a){var c={messageText:this._generateSMSMessageText(d,a),};Weave.Services.ApplicationManager.launchApplication("com.palm.app.messaging",c)}}}},_generateAppURL:function(b){var a=b.getDetails();if(a&&a.publicApplicationId&&a.id){return"http://developer.palm.com/appredirect/?packageid="+a.publicApplicationId+"&applicationid="+a.id}else{return null}},_generateEmailMessageText:function(d,a){var b=d.getDetails();var c={appURL:a};if(b&&b.title){c.title=b.title}else{c.title=a}return Mojo.View.render({object:c,template:"comments/share-template"})},_generateSMSMessageText:function(d,a){var c=a;var b=d.getDetails();if(b&&b.title){c=b.title}return $L("Check out #{title}: #{url}").interpolate({title:c,url:a})},};if(window==window.top){var Weave=Weave||{};(function(){function a(b){for(var c in b){if(c){Weave[c.charAt(0).toUpperCase()+c.substring(1)]={}}}}a({system:["activator"],services:["services","accountservices","applicationinstaller","applicationmanager","catalogserver","applicationserver","browser","connectionmanager","deviceprofile","appinstallservice","systemmanager","systemproperties","paymentserver"],utilities:["regexp","appmenu"],download:["downloadstates","appdetails","appdownload","appdownloadmanager"],})})()}Weave.System.Activator={_inames:{},addInterface:function(a,b){this._inames[a]=b},run:function(c){var b=this;for(var a in c){iface=this._inames[a];if(iface){iface.init(c[a])}}},open:function(d,c,e){Mojo.Log.info("Activator.open stage ",d,c);if(d==null){e&&e(null)}else{var b=Mojo.Controller.appController.getStageController(d);if(b){e&&e(b.assistant);b.activate()}else{var a=this;Mojo.Controller.appController.createStageWithCallback({lightweight:true,name:d,assistantName:c,},function(f){Mojo.Log.info("Activator.open stageAssistant: %s callback ",f.assistant.stageName);e&&e(f.assistant)})}}},close:function(a){Mojo.Controller.appController.closeStage(a)},getActiveStageController:function(b){var a=Mojo.Controller.appController.getActiveStageController();if(!a&&b){a=Mojo.Controller.appController.getStageController("default")}return a}};Object.extend(Weave.Services,{_pending:{},_next:1,request:function(c,b,e,a){var f=this._next++;var d=this._pending;b.onSuccess=function(g){delete d[f];e&&e(g)};b.onFailure=function(g){delete d[f];a&&a(g)};d[f]=new Mojo.Service.Request(c,b);return d[f]},subscriptionRequest:function(c,b,e,a){var f=this._next++;var d=this._pending;b.onSuccess=function(g){e&&e(g)};b.onFailure=function(g){a&&a(g)};b.parameters=Object.extend(b.parameters||{},{subscribe:true});d[f]=new Mojo.Service.Request(c,b);return d[f]},cleanup:function(){}});Weave.Services.AccountServices={_target:"palm://com.palm.accountservices",getServerUrl:function(a){Weave.Services.request(this._target,{method:"getServerUrl",parameters:{},},function(b){a(true,b.serverUrl)},function(){a(false)})},getPaymentServerUrl:function(a){Weave.Services.request(this._target,{method:"getPreferences",parameters:{appName:"PAYMENT",},},function(b){a(true,b.parameterInfos.value)},function(){a(false)})},getAccountToken:function(a){Mojo.Log.info("**** Trying to get Account Token");Weave.Services.request(this._target,{method:"getAccountToken",parameters:{},},function(b){Mojo.Log.info("**** Got account token");a(true,b.token,b.accountAlias,b.accountState)},function(){a(false)})},notifyAuthenticationFailure:function(a){Weave.Services.request(this._target,{method:"notifyAuthenticationFailure",parameters:{trustedApp:true,},});a(true)},notifyUninstalledApplication:function(b,a,c){Weave.Services.request(this._target,{method:"notifyUninstalledApplication",parameters:{name:b,version:a,},},function(){c(true)},function(){c(false)})},getAccountInfo:function(a){Mojo.Log.info("** Getting account info");Weave.Services.request(this._target,{method:"getAccountInfo",parameters:{}},function(b){a(true,b)},function(){a(false)})},updateAccountInfo:function(a,b){Weave.Services.request(this._target,{method:"updateAccountInfo",parameters:{firstName:a.firstName,lastName:a.lastName,password:a.password,email:a.email,languageCode:a.languageCode,countryCode:a.countryCode}},function(c){b(true,c)},function(){b(false)})},isUserValid:function(b,a,c,d){Weave.Services.request(this._target,{method:"isUserValid",parameters:{email:b,password:a,deviceId:c}},function(e){d(true,e)},function(){d(false)})},getLocale:function(a){Weave.Services.request("palm://com.palm.systemservice",{method:"getPreferences",parameters:{keys:["locale"]},},function(b){a(true,b)},function(){a(false)})},getAllSecurityQuestions:function(a,b){Weave.Services.request(this._target,{method:"getAllSecurityQuestions",parameters:{subscribe:false,locale:a}},function(c){b(true,c)},function(){b(false)})},getAccountSecurityQuestions:function(b,a,c){Weave.Services.request(this._target,{method:"getAccountSecurityQuestion",parameters:{email:b,locale:a}},function(d){c(true,d)},function(){c(false)})},resendVerificationEmail:function(a){Weave.Services.request(this._target,{method:"requestResendVerificationEmail",parameters:{}},function(b){a(true,b)},function(){a(false)})},requestPasswordResetEmail:function(a,b){Weave.Services.request(this._target,{method:"requestPasswordResetEmail",parameters:{email:a,subscribe:false}},function(c){b(true,c)},function(){b(false)})},authenticateAccountFromSecurityQuestion:function(c,a,b,d){Weave.Services.request(this._target,{method:"authenticateAccountFromSecurityQuestion",parameters:{email:c,questionId:a,response:b}},function(e){d(true,e)},function(){d(false)})},changeEmail:function(a,b){Weave.Services.request(this._target,{method:"changeEmail",parameters:{email:a}},function(c){b(true,c)},function(){b(false)})},changePassword:function(d,a,c,f,b,e){Weave.Services.request(this._target,{method:"changePassword",parameters:{newPassword:d,questionId:a,answer:c,idToken:f,isResetPassword:b}},function(g){e(true,g)},function(){e(false)})},authenticateAccount:function(b,a,c){Weave.Services.request(this._target,{method:"authenticateAccount",parameters:{email:b,password:a,application:"ASClient"}},function(d){c(true,d)},function(){c(false)})},isEmailAvailable:function(a,b){Weave.Services.request(this._target,{method:"isEmailAvailable",parameters:{email:a}},function(c){Mojo.Log.info("response:"+Object.toJSON(c));b(true,c)})}};Weave.Services.ApplicationInstaller={_target:"palm://com.palm.appinstaller",validateInstall:function(c,b,e,d){e=(e&&e!=0)?Math.ceil(e/1024):undefined;b=Math.ceil(b/1024);Mojo.Log.info("Weave.Services.ApplicationInstaller.validateInstall appid %s, size %s, uncomprSize %d",c,b,e);var a=this;this._pendingreq=Weave.Services.request(a._target,{method:"queryInstallCapacity",parameters:{appId:c,size:b,uncompressedSize:e,},},function(f){if(f.result==0||f.result==4||PalmSystem.version.match("desktop")){d(true)}else{Mojo.Log.error("Weave.Services.ApplicationInstaller.validateInstall failed %j",f);d(false,f)}},function(f){Mojo.Log.error("Weave.Services.ApplicationInstaller.validateInstall failed %j",f);d(false)})},};Weave.Services.ApplicationManager={_target:"palm://com.palm.applicationManager",getInstalledApplications:function(a){Weave.Services.request(this._target,{method:"listApps",parameters:{},},function(b){var c=b.apps;a(true,!c?[]:Object.isArray(c)?c:[c])},function(){a(false)})},openApplication:function(a,b){Weave.Services.request(this._target,{method:"open",parameters:{id:a,params:b}})},launchApplication:function(a,b){Weave.Services.request(this._target,{method:"launch",parameters:{id:a,params:b}})},launchPointChanges:function(a){Weave.Services.subscriptionRequest(this._target,{method:"launchPointChanges",},function(b){a(true,b)},function(){a(false)})},};Weave.Services.CatalogServer=Class.create({_defaultRetries:3,_defaultCallTimeout:20,$whenReadyServerUrl:function(b){if(this._serverUrl){b()}else{var a=this;Weave.Services.AccountServices.getServerUrl(function(c,d){a._serverUrl=c?d:"error:///";b()})}},$whenReadyServerUrlCarrier:function(b){if(this._serverUrl&&this._carrier){b()}else{var a=this;this.$whenReadyServerUrl(function(){a._carrier&&b()});this._carrier||Weave.Services.Preferences.SystemProperties.getCarrier(function(c,d){a._carrier=c?d:"ROW";a._serverUrl&&b()})}},_whenReadySecurityToken:function(c){var a=this;function b(){return(a._token!=undefined&&a._deviceid!=undefined&&a._email!=undefined&&a._carrier!=undefined)?true:false}if(b()){c()}else{this._token||Weave.Services.AccountServices.getAccountToken(function(d,f,e){Mojo.Log.info("Token:",d,f);a._token=d?f:"ERROR";a._email=d?e:"ERROR";b()&&c()});this._token||Weave.Services.DeviceProfile.getDeviceId(function(d,e){Mojo.Log.info("DeviceId:",e);a._deviceid=d?e:"ERROR";b()&&c()});this._carrier||Weave.Services.Preferences.SystemProperties.getCarrier(function(d,e){Mojo.Log.info("Carrier:",e);a._carrier=d?e:"ROW";b()&&c()})}},getSecurityToken:function(b){var a=this;this._whenReadySecurityToken(function(){b({token:a._token,deviceId:a._deviceid,email:a._email,carrier:a._carrier,})})},invalidateSecurityToken:function(){delete this._token},_callServer:function(d,a,e,b){b=(b==undefined?this._defaultRetries:b);var c=this;this.$whenReadyServerUrl(function(){Mojo.Log.info("ServerURL ready");var f=0;var g=Weave.Services.ConnectionManager.waitForOffline(function(){if(!f++){Mojo.Log.info("Offline");e(false,"offline")}});if(g){Mojo.Log.info("Ajax.Request");new Ajax.Request(c._serverUrl+d,{method:"POST",contentType:"application/json",postBody:Object.toJSON(a),evalJSON:"force",onSuccess:function(h){if(!f++){h=h.responseJSON;if(!h){e(true)}else{var i=h.JSONException;if(i){Mojo.Log.error("CatalogServer._callServer %j",i);e(false,"jsonexception",i)}else{e(true,h)}}}},onFailure:function(h){if(!f++){Mojo.Log.info("onFailure %j",h);if(b<1){if(h.responseJSON&&h.responseJSON.JSONException){e(false,"jsonexception",h.responseJSON.JSONException)}else{e(false,"failure",h.status)}}else{c._callServer(d,a,e,b-1)}}},on0:function(h){if(!f++){Mojo.Log.info("on0 %j",h);if(b<1){Weave.Services.ConnectionManager.getStatus(function(i){e(false,i?"failure":"offline",h.status)})}else{c._callServer(d,a,e,b-1)}}}});(function(){if(!f++){Mojo.Log.info("Timeout");if(b<1){e(false,"timeout")}else{c._callServer(d,a,e,b-1)}}Weave.Services.ConnectionManager.cancelWait(g)}).delay(c._defaultCallTimeout)}})},});Weave.Services.ApplicationServer=new (Class.create(Weave.Services.CatalogServer,{$whenReadyServerUrl:function(b){if(this._serverUrl){b()}else{var a=this;Weave.Services.AccountServices.getServerUrl(function(c,d){a._serverUrl=c?d:"error:///";b()})}},getFeaturedApplications:function(b){var a=this;this.getSecurityToken(function(c){a.$whenReadyServerUrlCarrier(function(){var d={InGetFeaturedAppsV2:{accountTokenInfo:c,carrier:a._carrier,}};a._callServer("featuredApps_ext2",d,function(e,f){if(e){if(f.FeaturedApps){b(true,f.FeaturedApps.palmFeaturedAppList.appSummary,f.FeaturedApps.carrierFeaturedAppList.appSummary,f.FeaturedApps.releaseStatus)}else{b(false,"badformat")}}else{b.apply(null,arguments)}})})})},getCategories:function(b,c){var a=this;this.$whenReadyServerUrlCarrier(function(){var d={InGetCategoryList:{locale:Mojo.Locale.current,categoryId:b||"",}};a._callServer("categoryList",d,function(e,g){Mojo.Log.info("getCategories",e,g);if(e){if(g.OutGetCategoryList==""||g.OutGetCategoryList.categoryList==""){c(true,[],0)}else{if(g.OutGetCategoryList&&g.OutGetCategoryList.categoryList&&g.OutGetCategoryList.categoryList.categoryItems){var f=g.OutGetCategoryList.categoryList.categoryItems;c(true,!f?[]:Object.isArray(f)?f:[f])}else{c(false,"badformat")}}}else{c(false,g)}})})},getApplicationDetails:function(d,c,a,e){var b=this;this.getSecurityToken(function(g){var f={InGetAppDetailV2:{accountTokenInfo:g,appId:d,packageId:c,locale:a,}};b._callServer("appDetail_ext2",f,function(i,j,h){if(i){if(j.OutGetAppDetailV2){e(true,j.OutGetAppDetailV2.appDetail,j.OutGetAppDetailV2.userRating)}else{e(false,"badformat")}}else{if(j=="jsonexception"&&h.errorCodes=="DISC0120"){e(false,"appunavailable",h.message)}else{if(j=="jsonexception"&&b._isAppIncompatibleError(h.errorCodes)){e(false,h.errorCodes)}else{if(j=="jsonexception"&&b._isInvalidTokenError(h.errorCodes)){e(false,"invalidtoken",h.message)}else{e.apply(null,arguments)}}}}})})},getTags:function(b,a,d){var c={InGetTags:{criterion:(a=="popularity"?"APP_COUNT":"TAG_NAME"),limit:b}};this._callServer("getTags",c,function(e,f){if(e){if(f.OutGetTagList){d(true,f.OutGetTagList.tagList.tagItems)}else{d(false,"badformat")}}else{d.apply(null,arguments)}})},searchForApplications:function(f,d,h,e,c,a,g){Mojo.Log.info("*********************************Entered seach for applications***********************");var b=this;this.getSecurityToken(function(l){var m=[];if(f){var n=f.toLowerCase().split(" ");for(var k=0;k<n.length;k++){m.push(n[k]+"*")}}m=m.join(" && ");Mojo.Log.info("********* token *****"+l);var j={InGetAppListV2:{tagName:"",queryStr:m,categoryid:d,startPosition:h,count:e,sort:c,locale:a,accountTokenInfo:l}};Mojo.Log.info("****************************** app List called with token***"+l);b._callServer("appList_ext2",j,function(i,o){if(i){if(o.OutGetAppList){var p=o.OutGetAppList.appList.appSummary;g(true,!p?[]:p.constructor!=Array?[p]:p,o.OutGetAppList.appList.totalCount)}else{g(false,"badformat")}}else{g.apply(null,arguments)}})})},getUserComments:function(c,d,b,e){var a={InGetUserRatings:{appId:c,startPosition:d,count:b,}};this._callServer("getUserRatings",a,function(f,g){if(f){if(g.UserRatingList){var h=g.UserRatingList.ratings;h=(!h?[]:h.constructor!=Array?[h]:h);e(true,h,h.length)}else{if(g.UserRatingList==""){e(true,[],0)}else{e(false,"badformat")}}}else{e.apply(null,arguments)}})},addUserComment:function(g,d,c,f,b,e,a,h){var i=this;this.getSecurityToken(function(j){var k={InAddUserRating:{userRatingItem:{score:Math.round(c),comment:d,accountId:b||"",locale:f,isAnonymous:e,isInappropriate:a,appId:g,},appEntryId:g,accountTokenInfo:j,}};i._callServer("addUserRating",k,function(m,n,l){h.apply(null,arguments)})})},getMyComment:function(b,c){var a=this;this.getSecurityToken(function(d){var e={InGetMyRating:{accountTokenInfo:d,appEntryId:b}};a._callServer("getMyRating",e,function(g,h,f){if(g){if(h&&h.UserRating){c(true,h.UserRating)}else{c(true,null)}}else{if(h=="jsonexception"&&a._isInvalidTokenError(f.errorCodes)){c(false,"invalidtoken",f.message)}else{c.apply(null,arguments)}}})})},getAppListForUpdates:function(a,c){Mojo.Log.info("Weave.Services.ApplicationServer.getAppListForUpdates sending %s",a);var b={InGetUpdatableApps:{packageIds:a}};this._callServer("getListOfUpdatableApps",b,function(e,f,d){if(e){Mojo.Log.info("%j",f);if(f.OutUpdateInfoList==""){c(true,[])}else{if(f.OutUpdateInfoList){var g=f.OutUpdateInfoList.appSummaryForUpdates;c(true,!g?[]:Object.isArray(g)?g:[g])}else{c(false,"badformat")}}}else{c.apply(null,arguments)}})},_isInvalidTokenError:function(a){if(a=="DISC0049"||a=="DISC0050"||a=="DISC0051"){Mojo.Log.error("ApplicationServer._isInvalidTokenError TRUE, error:%s",a);return true}return false},_isAppIncompatibleError:function(a){if(a=="DISC0025"||a=="DISC0124"||a=="DISC0125"||a=="DISC0201"||a=="DISC0202"||a=="DISC0203"){Mojo.Log.error("ApplicationServer.isAppIncompatibleError TRUE, error:%s",a);return true}return false},}));Weave.Services.ApplicationManager.Browser={openPage:function(a){Weave.Services.ApplicationManager.openApplication("com.palm.app.browser",{target:a})},};Weave.Services.ConnectionManager={_target:"palm://com.palm.connectionmanager",_online:undefined,_1x:undefined,_waiting:[],_started:false,_startup:function(b){this._started=true;if(PalmSystem.version.match("desktop")){this._stateChanged(true);b&&b(this._online);b=null}else{var a=this;this._MSMrequest=Weave.Services.request("palm://com.palm.bus/signal",{method:"addmatch",parameters:{category:"/storaged",method:"MSMProgress",subscribe:true}},function(c){a._MSMnotification(c)},function(c){Mojo.Log.error("ConnectionManager._startup MSM subscription request failed %j",c);a._MSMnotification(c)});this._getstatusreq=Weave.Services.request(this._target,{method:"getstatus",parameters:{subscribe:true},},function(c){Mojo.Log.info("ConnectionManager.connectionStatusNotification %j",c);a._1x=c.wan.network=="1x"&&c.wifi.state!="connected";a._stateChanged((c.isInternetConnectionAvailable==true?true:false));b&&b(a._online)},function(){a._stateChanged(false);b&&b(a._online)})}},_MSMnotification:function(a){if(!a){return}Mojo.Log.info("ConnectionManager._MSMnotification %j",a);if(a.stage=="attempting"){Mojo.Log.info("ConnectionManager._MSMnotification: in MSM");this._MSMmodeActive=true;ConnectionWidget.cancel()}},_stateChanged:function(a){if(this._online!=a){this._online=a;var d=this._waiting;this._waiting=[];for(var b=0;b<d.length;b++){var c=d[b];if(c.online===undefined||c.online===a){d[b].callback(a)}else{this._waiting.push(c)}}}if(a==false){this.showConnectionError()}else{this._MSMmodeActive=false;ConnectionWidget.cancel()}},monitor:function(){if(!this._started){this._startup()}},getStatus:function(a){if(this._online===undefined){if(!this._started){this._startup(a)}else{this._waiting.push({online:undefined,callback:a})}}else{a(this._online)}},isOnline:function(){if(this._online===undefined){throw new Error("ConnectionManager is not monitoring status")}else{return this._online}},isOn1x:function(){return this._1x},waitForOnline:function(b){if(this._online===true){b();return undefined}else{var a={online:true,callback:b};this._waiting.push(a);return a}},waitForOffline:function(b){if(this._online===false){b();return undefined}else{var a={online:false,callback:b};this._waiting.push(a);return a}},cancelWait:function(b){var c=this._waiting;for(var a=0;a<c.length;a++){if(c[a]==b){c.splice(a,1);break}}},showConnectionError:function(){if(this._MSMmodeActive){return}var a=Weave.System.Activator.getActiveStageController();if(!a){return}if(!a.isActiveAndHasScenes()){return}Mojo.Log.info("ConnectionManager.showConnectionError");var b={type:"data",onSuccess:function(c){}};ConnectionWidget.connect(b,a)},cleanup:function(){ConnectionWidget.cancel();delete this._MSMrequest;delete this._getstatusreq}};Weave.Services.DeviceProfile={_target:"palm://com.palm.deviceprofile",getDeviceId:function(a){Weave.Services.request(this._target,{method:"getDeviceId",parameters:{},},function(b){a(true,b.deviceId)},function(){a(false)})},getCarrierIdentification:function(a){Weave.Services.request("palm://com.palm.data.carriernetworksettings/",{method:"getCurrentCarrierIdentification",parameters:{},},function(b){a(true,b)},function(){a(false)})}};Weave.Services.AppInstallService={_target:"palm://com.palm.appInstallService",install:function(a,b){Weave.Services.AccountServices.getAccountToken(function(c,d){Weave.Services.DeviceProfile.getDeviceId(function(e,h){var g={catalogId:a.id,id:a.publicApplicationId,title:a.title,version:a.serverVersion,vendor:a.vendor,vendorUrl:a.vendorUrl,iconUrl:a.iconUrl,ipkUrl:a.packageUrl,authToken:d||0,deviceId:h||0,};Mojo.Log.info("Weave.Services.AppInstallService.install payload %j",g);var f=Weave.Services.subscriptionRequest(Weave.Services.AppInstallService._target,{method:"install",parameters:g},function(i){b(true)},function(i){Mojo.Log.error("Weave.Services.AppInstallService.install failed %s, %j",a.publicApplicationId,i);b(false,i)})})})},status:function(c){Mojo.Log.info("Weave.Services.AppInstallService.status");var a=this;var b=Weave.Services.subscriptionRequest(this._target,{method:"status",parameters:{},},function(d){Mojo.Log.info("Weave.Services.AppInstallService.status response %j",d);if(d.status&&d.status.apps){c(true,false,d.status.apps)}else{if(d.id){c(true,true,[d])}}},function(d){Mojo.Log.error("Weave.Services.AppInstallService.status failed %j",d)})},pause:function(b,d){var a=this;var c=Weave.Services.request(this._target,{method:"pause",parameters:{id:b},},function(e){d(true)},function(e){Mojo.Log.error("Weave.Services.AppInstallService.pause failed %s, %j",b,e);d(false,e)})},resume:function(b,d){var a=this;var c=Weave.Services.request(this._target,{method:"resume",parameters:{id:b},},function(e){d(true)},function(e){Mojo.Log.error("Weave.Services.AppInstallService.resume failed %s, %j",b,e);d(false,e)})},cancel:function(b,d){var a=this;var c=Weave.Services.request(this._target,{method:"cancel",parameters:{id:b},},function(e){d(true)},function(e){Mojo.Log.error("Weave.Services.AppInstallService.cancel failed %s, %j",b,e);d(false,e)})},remove:function(b,d){var a=this;var c=Weave.Services.request(this._target,{method:"remove",parameters:{id:b},},function(e){d(true)},function(e){d(false,e);Mojo.Log.error("Weave.Services.AppInstallService.remove failed %s, %j",b,e)})},};Weave.Services.SystemManager={_target:"palm://com.palm.systemmanager",_unlockcount:0,_startup:function(){if(PalmSystem.version.match("desktop")){}else{var a=this;var b=true;this._getstatusreq=Weave.Services.request(this._target,{method:"getLockStatus",parameters:{subscribe:true},},function(c){if(!b){a._unlockcount++}b=false})}},hasScreenLocked:function(a,b){if(!this._getstatusreq){this._startup(undefined,false)}if(a._count==undefined||a._count==this._unlockcount){a.locked=false}else{a.locked=true}a._count=this._unlockcount;b(true,a)},};Weave.Services.Preferences=Weave.Services.Preferences||{};Weave.Services.Preferences.SystemProperties={_target:"palm://com.palm.preferences/systemProperties",getCarrier:function(a){Weave.Services.request(this._target,{method:"Get",parameters:{key:"com.palm.properties.DMCARRIER"},},function(b){a(true,b["com.palm.properties.DMCARRIER"])},function(){a(false)})}};Weave.Services.PaymentServer=new (Class.create(Weave.Services.CatalogServer,{$whenReadyServerUrl:function(b){if(this._serverUrl){b()}else{var a=this;Weave.Services.AccountServices.getPaymentServerUrl(function(c,d){a._serverUrl=c?d:"error:///";b()})}},getCCTypes:function(b){var a=this;this.getSecurityToken(function(d){var c={InGetCCTypes:{authToken:d.token,accountAlias:d.email,deviceId:d.deviceId}};a._callServer("getCCTypes",c,function(f,g,e){if(f){b(true,g)}else{if(g=="jsonexception"){b(false,e)}else{b(false,{errorCode:g})}}})})},verifyPaymentSetup:function(b){var a=this;this.getSecurityToken(function(c){var d={InGetCCPaymentInfos:{authToken:c.token,accountAlias:c.email,deviceId:c.deviceId}};a._callServer("getCCPaymentInfos",d,function(f,g,e){if(f){b(true,g)}else{if(g=="jsonexception"){b(false,e)}else{b(false,{errorCode:g})}}})})},addAccount:function(a,c,d){var b=this;this.getSecurityToken(function(e){c.email=e.email;var f={InAddCCPaymentInfo:{authToken:e.token,accountAlias:e.email,deviceId:e.deviceId,billTo:a,creditCard:c}};b._callServer("addCCPaymentInfo",f,function(h,i,g){if(h){if(i.OutAddCCPaymentInfo){d(true,i)}else{d(false,"badresponse")}}else{if(i=="jsonexception"){d(false,g)}else{d(false,{errorCode:i})}}})})},updateAccount:function(a,c,d){var b=this;this.getSecurityToken(function(e){c.email=e.email;var f={InUpdateCCPaymentInfo:{authToken:e.token,accountAlias:e.email,deviceId:e.deviceId,paymentInfoId:c.paymentInfoId,billTo:a,creditCard:c}};b._callServer("updateCCPaymentInfo",f,function(h,i,g){if(h){if(i.OutUpdateCCPaymentInfo){d(true,i)}else{d(false,"badresponse")}}else{if(i=="jsonexception"){d(false,g)}else{d(false,{errorCode:i})}}})})},removeAccount:function(b,c){var a=this;this.getSecurityToken(function(d){b.email=d.email;var e={InRemoveCCPaymentInfo:{authToken:d.token,accountAlias:d.email,deviceId:d.deviceId,paymentInfoId:b.paymentInfoId}};a._callServer("removeCCPaymentInfo",e,function(g,h,f){if(g){if(h.OutRemoveCCPaymentInfo){c(true,h)}else{c(false,"badresponse")}}else{if(h=="jsonexception"){c(false,f)}else{c(false,{errorCode:h})}}})})},capturePayment:function(c,b){var a=this;this.getSecurityToken(function(d){var e={InCapturePayment:{authToken:d.token,accountAlias:d.email,deviceId:d.deviceId,order:c}};a._callServer("capturePayment",e,function(g,h,f){if(g){if(h.OutCapturePayment){b(true,h)}else{b(false,"badresponse")}}else{if(h=="jsonexception"){b(false,f)}else{b(false,{errorCode:h})}}})})},}));Weave.Utilities.RegExp={escape:function(a){return a.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,"\\$&")}};Weave.Utilities.AppMenu=Class.create({initialize:function(b,a){this._scene=b;this._items=a?a._items:[];if(b){this._oldHandleCommand=b.handleCommand;b.handleCommand=this._handleCommand.bind(this);if(b.controller.setupWidget){b.controller.setupWidget(Mojo.Menu.appMenu,{omitDefaultItems:true,},{items:this._items})}}},addItem:function(b,c,a){this._items.push({label:b,command:"cmd"+this._items.length+1,checkEnabled:(a?true:false),_callback:c,_enabled:a});return this},addEdit:function(){this._items.push(Mojo.Menu.editItem);return this},addHelp:function(b,a){if(b){this._items.push(Object.extend({_callback:function(){Weave.Services.ConnectionManager.getStatus(function(c){Weave.Services.ApplicationManager.openApplication("com.palm.app.help",{target:c?b:"no-network"})})},_enabled:a?a:function(c){c.stopPropagation();return true}},Mojo.Menu.helpItem))}else{this._items.push(Mojo.Menu.helpItem)}return this},addPreferences:function(b,a){if(b){this._items.push(Object.extend({_callback:b,_enabled:a?a:function(c){c.stopPropagation();return true}},Mojo.Menu.prefsItem))}else{this._items.push(Mojo.menu.prefsItem)}return this},_handleCommand:function(b){if(b.type==Mojo.Event.commandEnable){for(var a=0;a<this._items.length;a++){if(this._items[a].command==b.command){if(this._items[a]._enabled&&!this._items[a]._enabled(b)){b.stopPropagation();b.preventDefault()}break}}}else{if(b.type==Mojo.Event.command){for(var a=0;a<this._items.length;a++){if(this._items[a].command==b.command){this._items[a]._callback&&this._items[a]._callback(b);break}}}}this._oldHandleCommand&&this._oldHandleCommand.call(this._scene,b)},});Object.extend(Weave.Utilities.AppMenu,{setDefault:function(a){Weave.Utilities.AppMenu.defaultMenu=a},useDefault:function(a){new Weave.Utilities.AppMenu(a,Weave.Utilities.AppMenu.defaultMenu)}});var Catalog=Catalog||{};Catalog.appStates=Catalog.appStates||new Array();Catalog.appStatesCommon={_1xCarrierDialog:{sprint:{title:$L("No 3G Data Network"),message:$L("You will be unable to receive phone calls while the application is downloading."),choices:[{label:$L("Cancel"),value:"cancel",type:"secondary"},{label:$L("Download"),value:"download",type:"primary"}]},"default":{title:$L("No 3G Data Network"),message:$L("Because no high speed network connection is available, it will take much longer to download this application. You can download the application later for free."),choices:[{label:$L("Download Later"),value:"cancel",type:"secondary"},{label:$L("Download Now"),value:"download",type:"primary"}]},},_verifyPaymentSetup:function(a){if(myProfile.validCC!==undefined){a(true,myProfile.validCC)}else{Weave.Services.PaymentServer.verifyPaymentSetup(function(b,c){if(b){myProfile.validCC=c}a(b,c)})}},_makePurchase:function(c,a,d){if(!Weave.Services.ConnectionManager.isOnline()){d(false);return}var b=Weave.System.Activator.getActiveStageController();if(b&&b.topScene()){b.topScene().showAlertDialog({allowHTMLMessage:true,message:$L("Purchase #{title}?<br/><br/>Your credit card will be charged.").interpolate({title:c.title}),choices:[{label:$L("Purchase"),value:"ok",type:"affirmative"},{label:$L("Cancel"),value:"cancel",type:"dismiss"}],onChoose:function(e){if(e=="ok"){Mojo.Log.info("Catalog.appStatesCommon._makePurchase: purchasing %s, %s",c.title,c.id);var f=c;var g={orderDate:Utilities.UTCDate.shortDate(new Date()),paymentInfoId:a.OutGetCCPaymentInfos.ccPaymentInfos[0].paymentInfoId,currency:f.currency,items:[{type:f.priceType,unitPrice:f.price,quantity:"1",sku:f.sku,skuTitle:f.title,commodityCode:f.paymentCategory,vendorId:f.vendorid,vendorCity:f.vendorCity,vendorRegion:f.vendorRegion,vendorCountry:f.vendorCountry,}],};c.setState("purchasing");Mojo.Log.info("Order Object: %j",g.items[0]);Weave.Services.PaymentServer.capturePayment(g,function(h,i){if(h){Mojo.Log.info("Catalog.appStatesCommon._makePurchase: purchased");c.setState("purchased",{version:c.serverVersion,transitional:true});d(true)}else{Mojo.Log.error("Catalog.appStatesCommon._makePurchase: purchase failed %j",i);var j=i.errorCode?i.errorCode:i;c.setState("purchase_failed",{errorCode:j})}})}else{d(false)}},})}else{d(false)}},_handleVerifyPayment:function(b,a,c){Catalog.appStatesCommon._verifyPaymentSetup(function(d,e){if(d){if(e.OutGetCCPaymentInfos.ccPaymentInfos.length>0){if(!a){var f=Weave.System.Activator.getActiveStageController();if(f&&f.topScene()){f.topScene().showDialog({template:"payment-setup/password-dialog",assistant:new PasswordAssistant(f.topScene().assistant,{appid:b.id,onComplete:function(g){Mojo.Log.info("Catalog.appStatesCommon._handleVerifyPayment password valid: ",g.passwordValid);if(g.passwordValid){Catalog.appStatesCommon._makePurchase(b,e,c)}else{c(false)}}})})}else{c(false)}}else{Catalog.appStatesCommon._makePurchase(b,e,c)}}else{Mojo.Log.info("Catalog.appStatesCommon._handleVerifyPayment no payment set up");var f=Weave.System.Activator.getActiveStageController();if(f){f.pushScene("payment-setup",b.id,function(g){Mojo.Log.info("Catalog.appStatesCommon._handleVerifyPayment payment setup callback ret %j",g);if(g.accountValid){Catalog.appStatesCommon._handleVerifyPayment(b,true,c)}else{c(false)}})}else{c(false)}}}else{c(false);Mojo.Log.error("Error retrieving payment setup");Utilities.Errors.displayError(e.errorCode,{errCode:e.errorCode},"PMT_catchAll_default")}})},_validateRegion:function(b){Mojo.Log.info("Catalog.appStatesCommon._validateRegion uscarrier: ",myProfile.uscarrier);if(b.price>0&&!myProfile.uscarrier){var a=Weave.System.Activator.getActiveStageController();if(a&&a.topScene()){a.topScene().showAlertDialog({title:$L("Sorry, Application Unavailable"),message:$L("This application is not available in your region."),choices:[{label:$L("OK"),value:true,type:"primary"},]})}return false}return true},_handleLocationServices:function(b,c){Mojo.Log.info("Catalog.appStatesCommon._handleLocationServices app.islocationbased",b.islocationbased);if(b.islocationbased){var a=Weave.System.Activator.getActiveStageController();if(a&&a.topScene()){a.topScene().showAlertDialog({onChoose:function(d){if(d=="continue"){c(true)}else{c(false)}},title:$L("Location Services"),message:$L("This application will request your current location for some functions."),choices:[{label:$L("Don't Download"),value:"cancel",type:"dismiss"},{label:$L("Continue"),value:"continue",type:"affirmative"}]})}else{c(false)}}else{c(true)}},validateInstallSpace:function(b,a,c){Mojo.Log.info("Catalog.appStatesCommon.validateInstallSpace");Weave.Services.ApplicationInstaller.validateInstall(b.publicApplicationId,b.packageSize,b.installSize,function(d,e){if(d==true){c(true)}else{Mojo.assert(e&&e.spaceNeededInKB,"Catalog.appStatesCommon.validateInstallSpace validateInstall failed but spaceNeededInKB is not defined");var f;if(e&&e.spaceNeededInKB){f=parseInt(e.spaceNeededInKB);f=f>=1024?Math.ceil((f/1024)*100)/100+"M":f+"K"}else{f=$L("unknown MB")}Utilities.Errors.displayError("dummy",{installSize:f},a,null,null,function(g){if(g=="help"){Weave.Services.ConnectionManager.getStatus(function(h){Weave.Services.ApplicationManager.openApplication("com.palm.app.help",{target:h?"http://help.palm.com/basics/manage_applications/basics_delete_app_from_launcher.html":"no-network"})})}});c(false)}})},validateDownloadConnection:function(c){if(Weave.Services.ConnectionManager.isOn1x()){Mojo.Log.info("Catalog.appStatesCommon.validateDownloadConnection connection is 1x");if(Catalog.AppDownloadMngr.canAllow1xDownload()){Mojo.Log.info("Catalog.appStatesCommon.validateDownloadConnection canAllow1xDownload == true");c(true)}else{Mojo.Log.info("Catalog.appStatesCommon.validateDownloadConnection prompt user for 1x permission");var a=Weave.System.Activator.getActiveStageController();if(a&&a.topScene()){var b=Catalog.appStatesCommon._1xCarrierDialog[myProfile.carrierName];if(!b){b=Catalog.appStatesCommon._1xCarrierDialog["default"]}a.topScene().showAlertDialog({onChoose:function(d){if(d=="cancel"){c(false)}else{if(d=="download"){Catalog.AppDownloadMngr.allow1xDownload(true,function(e){Mojo.Log.info("Catalog.appStatesCommon.validateDownloadConnection allow1xDownload returned status %s",e);c(e)})}}},title:b.title,message:b.message,choices:b.choices})}else{c(false)}}}else{if(Weave.Services.ConnectionManager.isOnline()){c(true)}else{c(false)}}},_install:function(a){Catalog.appStatesCommon.validateDownloadConnection(function(b){var c=a.stateToString();if(b){a.setState("fake progress");Mojo.Log.info("Catalog.appStatesCommon._install: ",a.publicApplicationId);Weave.Services.AppInstallService.install(a,function(d,e){if(!d){Mojo.Log.error("Catalog.appStatesCommon._install failed %s: %j, returing to state %s",a.publicApplicationId,e,c);if(a.stateToString()=="fake progress"){a.setState(c)}}})}})},_pause:function(b){var a=b.stateToString();b.setState("pausing");Mojo.Log.info("Catalog.appStatesCommon._pause: ",b.publicApplicationId);Weave.Services.AppInstallService.pause(b.publicApplicationId,function(c,d){if(!c){Mojo.Log.error("Catalog.appStatesCommon._pause failed %s, %j, returing to state %s",b.publicApplicationId,d,a);if(b.stateToString()=="pausing"){b.setState(a)}}})},_resume:function(a){Catalog.appStatesCommon.validateDownloadConnection(function(b){if(b){var c=a.stateToString();a.setState("resuming");Mojo.Log.info("Catalog.appStatesCommon._resume: ",a.publicApplicationId);Weave.Services.AppInstallService.resume(a.publicApplicationId,function(d,e){if(!d){Mojo.Log.error("Catalog.appStatesCommon._resume failed %s, %j, returing to state %s",a.publicApplicationId,e,c);if(a.stateToString()=="resuming"){a.setState(c)}}})}})},_cancel:function(b){var a=b.stateToString();b.setState("canceling");Mojo.Log.info("Catalog.appStatesCommon._cancel: ",b.publicApplicationId);Weave.Services.AppInstallService.cancel(b.publicApplicationId,function(c,d){if(!c){Mojo.Log.error("Catalog.appStatesCommon._cancel failed %s, %j, returing to state %s",b.publicApplicationId,d,a);if(b.stateToString()=="canceling"){b.setState(a)}}})},_uninstall:function(b){var a=b.stateToString();b.setState("removing");Mojo.Log.info("Catalog.appStatesCommon._uninstall: ",b.publicApplicationId);Weave.Services.AppInstallService.remove(b.publicApplicationId,function(c,d){if(!c){Mojo.Log.error("Catalog.appStatesCommon._uninstall failed %s, %j, returing to state %s",b.publicApplicationId,d,a);if(b.stateToString()=="removing"){b.setState(a)}}})},_reset:function(a){if(a.installedVersion){if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}}else{if(a.price&&a.price>0){a.setState("purchased")}else{a.setState("download")}}},_remove:function(a){a.installedVersion=null;a.icon=null;if(a.price&&a.price>0){a.setState("purchased")}else{a.setState("download")}},};Catalog.appStates.dummy={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="none";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Getting data...");b.disabledClass=null;b.updateClass=null;b.activeClass=null;b.resumeClass=null;b.pauseClass=null;b.warningClass=null},updateFromServer:function(a){this._update(a)},updateFromInstalledAppsList:function(a){this._update(a)},_update:function(b){var a="download";if(b.purchasedVersion){a="purchased"}if(b.installedVersion){a="installed";if(b.serverVersion&&Utilities.VersionCheck.compare(b.installedVersion,b.serverVersion)==-1){a="installed update available"}}b.setState(a)},toString:function(){return"dummy"}};Catalog.appStates["fake progress"]={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="action-icon";a._progressPillModel.image="images/download-icon.png";a._progressPillModel.title=$L("Downloading...");a._progressPillModel.value=0;a.disabledClass="disabled";a.updateClass=null;a.activeClass="active";a.resumeClass=null;a.pauseClass=null;a.warningClass=null},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"fake progress"}};Catalog.appStates.pausing={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="none";a._progressPillModel.image=undefined;a._progressPillModel.title=$L("Pausing...");a.disabledClass="disabled"},_allowTransition:function(a){if(a=="download progress"){return false}return true},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"pausing"}};Catalog.appStates.resuming={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="none";a._progressPillModel.image=undefined;a._progressPillModel.title=$L("Resuming...");a.disabledClass="disabled"},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"resuming"}};Catalog.appStates.removing={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="none";a._progressPillModel.image=undefined;a._progressPillModel.title=$L("Deleting...");a._progressPillModel.value=1;a.disabledClass="disabled";a.updateClass=null;a.activeClass=null;a.resumeClass=null;a.pauseClass=null;a.warningClass=null},_allowTransition:function(a){if(a=="download progress"){return false}return true},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"removing"}};Catalog.appStates.canceling={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="none";a._progressPillModel.image=undefined;a._progressPillModel.title=$L("Canceling...");a.disabledClass="disabled"},_allowTransition:function(a){if(a=="download progress"){return false}return true},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"canceling"}};Catalog.appStates.download={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="download-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Download for #{price}").interpolate({price:b.getFormattedPrice()});b.progress=0;b.disabledClass=null;b.updateClass=null;b.activeClass=null;b.resumeClass=null;b.pauseClass=null;b.warningClass=null},updateFromInstalledAppsList:function(a){if(a.installedVersion){if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}}},updateFromServer:function(b){var a="download";if(b.purchasedVersion){a="purchased"}if(b.installedVersion){a="installed";if(Utilities.VersionCheck.compare(b.installedVersion,b.serverVersion)==-1){a="installed update available"}}b.setState(a)},removeFromMyApps:function(){return true},defaultAction:function(a){a.install()},install:function(a){if(Catalog.appStatesCommon._validateRegion(a)){Catalog.appStatesCommon._handleLocationServices(a,function(b){if(b){Catalog.appStatesCommon.validateInstallSpace(a,"validate_space_default_single",function(c){if(c){Catalog.appStatesCommon.validateDownloadConnection(function(d){if(d){if(a.price>0){Catalog.appStatesCommon._handleVerifyPayment(a,!Preferences.isLoginTimedOut(),function(e){Mojo.Log.info("Catalog.appStates[download].download _handleVerifyPayment returned");if(e){Mojo.Log.info("Catalog.appStates[download].download _handleVerifyPayment status=true download app");Catalog.appStatesCommon._install(a)}else{a.setState("download")}})}else{Catalog.appStatesCommon._install(a)}}else{a.setState("download")}})}else{a.setState("download")}})}else{a.setState("download")}})}else{a.setState("download")}},toString:function(){return"download"}};Catalog.appStates["download progress"]={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="action-icon";b._progressPillModel.image="images/download-icon.png";b._progressPillModel.title=$L("Downloading...");b._progressPillModel.value=b.progress/100;b.disabledClass=null;b.updateClass=null;b.activeClass="active";b.resumeClass=null;b.pauseClass="show";b.warningClass=null},updateFromServer:function(a){a.setState("download progress")},updateFromInstalledAppsList:function(a){a.setState("download progress")},defaultAction:function(a){this.pauseDownload(a)},myAppsDefaultAction:function(a){this.pauseDownload(a)},pauseDownload:function(a){Catalog.appStatesCommon._pause(a)},cancelDownload:function(a){Catalog.appStatesCommon._cancel(a)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"download progress"}};Catalog.appStates.paused={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="none";b._progressPillModel.value=b.progress/100;b._progressPillModel.image=undefined;b._progressPillModel.title=$L("Download paused");b.disabledClass=null;b.updateClass=null;b.activeClass="active";b.resumeClass="show";b.pauseClass=null;b.warningClass=null},updateFromServer:function(a){a.setState("paused")},updateFromInstalledAppsList:function(a){a.setState("paused")},myAppsDefaultAction:function(a){a.resumeDownload()},defaultAction:function(a){a.resumeDownload()},resumeDownload:function(a){Catalog.appStatesCommon._resume(a)},cancelPausedDownload:function(a){Mojo.Log.info("Catalog.appStates.paused.cancelPausedDownload");Catalog.appStatesCommon._cancel(a)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"paused"}};Catalog.appStates["download failed"]={init:function(a){Mojo.Log.error("Catalog.download failed.init error: ",a.errorCode);a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="failed-app-icon";a._progressPillModel.image=undefined;a._progressPillModel.value=undefined;a._progressPillModel.title=$L("Download failed");a.progress=0;a.disabledClass=null;a.updateClass=null;a.activeClass="warning";a.resumeClass=null;a.pauseClass=null;a.warningClass="show"},updateFromServer:function(a){a.setState("download failed")},updateFromInstalledAppsList:function(a){a.setState("download failed")},defaultAction:function(a){this._defaultAction(a)},myAppsDefaultAction:function(a){this._defaultAction(a)},_defaultAction:function(a){Utilities.Errors.displayError(a.errorCode,{errCode:a.errorCode},"download_default",null,null,function(b){if(b=="retry"){a.install()}else{if(b=="cancel"){Catalog.appStatesCommon._cancel(a)}}})},cancelDownload:function(a){Catalog.appStatesCommon._cancel(a)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},install:function(b){var a=b.stateToString();b.setState("fake progress");Weave.Services.ApplicationServer.getApplicationDetails(b.id,b.publicApplicationId,Mojo.Locale.getCurrentLocale(),function(c,d){if(c){Mojo.Log.info("DownloadStates.download failed.getDetailsFromServer details %j",d);b.updateFromServer(d);Catalog.appStatesCommon.validateInstallSpace(b,"validate_space_default_single",function(e){if(e){Catalog.appStatesCommon.validateDownloadConnection(function(f){if(f){Mojo.Log.info("DownloadStates.download failed install: ",b.publicApplicationId);Weave.Services.AppInstallService.install(b,function(g,h){if(!g){Mojo.Log.error("DownloadStates.download failed: install failed %s: %j",b.publicApplicationId,h);if(b.stateToString()=="fake progress"){b.setState(a)}}})}else{b.setState(a)}})}else{b.setState(a)}})}else{Mojo.Log.error("DownloadStates.download failed.getDetailsFromServer failed to get details from the server error: ",d);b.setState(a);Utilities.Errors.displayError(d)}})},saveToMyApps:function(){return true},toString:function(){return"download failed"}};Catalog.appStates.purchasing={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="none";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Purchasing...")},toString:function(){return"purchasing"}};Catalog.appStates.purchased={init:function(b,a){if(!a||(a&&!a.transitional)){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="download-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Download for free")}b.progress=0;if(a&&a.version){b.purchasedVersion=a.version}},updateFromServer:function(a){},updateFromInstalledAppsList:function(a){if(a.installedVersion){if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}}},removeFromMyApps:function(){return true},defaultAction:function(a){a.install()},install:function(a){Catalog.appStatesCommon.validateInstallSpace(a,"validate_space_default_single",function(b){if(b){Catalog.appStatesCommon._install(a)}})},toString:function(){return"purchased"}};Catalog.appStates.purchase_failed={init:function(b,a){Mojo.Log.error("Catalog.purchase_failed.init %j",a);b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="failed-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Purchase failed");if(a){b.errorCode=a.errorCode.toString();Mojo.Log.error("Catalog.appStates[purchase_failed].init error: %s",b.errorCode)}},updateFromServer:function(a){},defaultAction:function(b){var a=this;Utilities.Errors.displayError(b.errorCode,{errCode:b.errorCode},"PMT_purchase_default",null,null,function(c){if(c){a._reset(b)}})},_reset:function(a){a.setState("download")},_remove:function(a){a.setState("download")},toString:function(){return"purchase_failed"}};Catalog.appStates.installing={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="none";b._progressPillModel.image=undefined;b._progressPillModel.value=1;b._progressPillModel.title=$L("Installing...");b.progress=100;b.disabledClass=null;b.updateClass=null;b.activeClass="active";b.resumeClass=null;b.pauseClass=null;b.warningClass=null},updateFromInstalledAppsList:function(a){a.setState("installing")},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"installing"}};Catalog.appStates.installed={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="launch-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Tap to launch");Mojo.Log.info("Catalog.appStates[installed].init installedVersion=%s",b.installedVersion);b.disabledClass=null;b.updateClass=null;b.activeClass=null;b.resumeClass=null;b.pauseClass=null;b.warningClass=null},updateFromServer:function(a){this._update(a)},updateFromServerUpdatesList:function(a){this._update(a)},_update:function(a){Mojo.assert(a.installedVersion,"ERROR: app.installedVersion undefined when app is in installed state");if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}},saveToMyApps:function(){return true},defaultAction:function(a){a.launch()},launch:function(a){Weave.Services.ApplicationManager.openApplication(a.publicApplicationId)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},toString:function(){return"installed"}};Catalog.appStates["installed update available"]={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="update-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Update Available");b.disabledClass=null;b.updateClass="update";b.activeClass=null;b.resumeClass=null;b.pauseClass=null;b.warningClass=null},saveToMyApps:function(){return true},defaultAction:function(a){a.install()},myAppsDefaultAction:function(a){a.install()},install:function(a){Catalog.appStatesCommon.validateInstallSpace(a,"validate_space_default_single",function(b){if(b){Catalog.appStatesCommon._install(a)}else{a.setState("installed update available")}})},installUpdate:function(b){var a=b.stateToString();b.setState("fake progress");Mojo.Log.info("Catalog.installed update available.installUpdate: ",b.publicApplicationId);Weave.Services.AppInstallService.install(b,function(c,d){if(!c){Mojo.Log.error("Catalog.installed update available.installUpdate failed %s: %j, returing to state %s",b.publicApplicationId,d,a);if(b.stateToString()=="fake progress"){b.setState(a)}}})},updateFromInstalledAppsList:function(a){this._update(a)},updateFromServerUpdatesList:function(a){this._update(a)},_update:function(a){Mojo.assert(a.installedVersion,"ERROR: app.installedVersion undefined when app is in installed state");if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},toString:function(){return"installed update available"}};Catalog.appStates["install failed"]={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="failed-app-icon";a._progressPillModel.image=undefined;a._progressPillModel.value=undefined;a._progressPillModel.title=$L("Install failed");Mojo.Log.error("Catalog.appStates[install failed].init error: %s",a.errorCode);a.disabledClass=null;a.updateClass=null;a.activeClass="warning";a.resumeClass=null;a.pauseClass=null;a.warningClass="show"},updateFromServer:function(a){},updateFromInstalledAppsList:function(a){a.setState("install failed")},defaultAction:function(a){this._defaultAction(a)},myAppsDefaultAction:function(a){this._defaultAction(a)},_defaultAction:function(b){var a;if(b.installSize){a=(b.installSize/(1024*1024))+1;a=(Math.ceil(a*100)/100)+"M"}else{a=$L("unknown MB")}Utilities.Errors.displayError(b.errorCode,{installSize:a},"install_default",null,null,function(c){if(c=="retry"){b.install()}else{if(c=="cancel"){Catalog.appStatesCommon._cancel(b)}else{if(c=="help"){Weave.Services.ConnectionManager.getStatus(function(d){Weave.Services.ApplicationManager.openApplication("com.palm.app.help",{target:d?"http://help.palm.com/basics/manage_applications/basics_delete_app_from_launcher.html":"no-network"})})}}}})},cancelDownload:function(a){Catalog.appStatesCommon._cancel(a)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},install:function(b){var a=b.stateToString();b.setState("fake progress");Weave.Services.ApplicationServer.getApplicationDetails(b.id,b.publicApplicationId,Mojo.Locale.getCurrentLocale(),function(c,d){if(c){Mojo.Log.info("DownloadStates.install failed.getDetailsFromServer details %j",d);b.updateFromServer(d);Catalog.appStatesCommon.validateInstallSpace(b,"validate_space_default_single",function(e){if(e){Catalog.appStatesCommon.validateDownloadConnection(function(f){if(f){Mojo.Log.info("DownloadStates.install failed install: ",b.publicApplicationId);Weave.Services.AppInstallService.install(b,function(g,h){if(!g){Mojo.Log.error("DownloadStates.install failed: install failed %s: %j",b.publicApplicationId,h);if(b.stateToString()=="fake progress"){b.setState(a)}}})}else{b.setState(a)}})}else{b.setState(a)}})}else{Mojo.Log.error("DownloadStates.install failed.getDetailsFromServer failed to get details from the server error: ",d);b.setState(a);Utilities.Errors.displayError(d)}})},saveToMyApps:function(){return true},toString:function(){return"install failed"}};var AppDetails=Class.create({initialize:function(b,a){this._observers=new Array();this._appid=b;this._packageid=a;this._details=null;this._error=null;this._myRating=null},getDetailsFromServer:function(){var a=this;Weave.Services.ApplicationServer.getApplicationDetails(this._appid,this._packageid,Mojo.Locale.getCurrentLocale(),function(b,c,d){if(b){Mojo.Log.info("AppDetails.getDetailsFromServer details %j, myrating %j",c,d);a._setError(null);a._setDetails(c);a.getMyCommentFromServer()}else{Mojo.Log.error("AppDetails.getDetailsFromServer failed to get details from the server error: ",c);a._setError(c);a._setMyRating(null);a._setDetails(null);Utilities.Errors.displayError(c)}})},getMyCommentFromServer:function(){if(!this._details){return}var a=this;Weave.Services.ApplicationServer.getMyComment(this._details.id,function(c,b){if(c&&b){a._setMyRating(b)}})},_setDetails:function(b){if(b){this._appid=b.id;this._packageid=b.publicApplicationId}this._details=b;for(var a=0;a<this._observers.length;a++){if(this._observers[a].updateDetails){this._observers[a].updateDetails(this)}}},getDetails:function(){return this._details},_setMyRating:function(b){this._myRating=b?b:null;for(var a=0;a<this._observers.length;a++){if(this._observers[a].updateMyRating){this._observers[a].updateMyRating()}}},getMyRating:function(){return this._myRating},_setError:function(a){this._error=a},getError:function(){return this._error},getProgramType:function(){return this._details!=null?this._details.programType:null},attach:function(a){this._observers.push(a)},detach:function(a){for(var b=0;b<this._observers.length;b++){if(this._observers[b]===a){this._observers.splice(b,1)}}},});var AppDownload=Class.create({_defaultState:"dummy",initialize:function(){this._observers=new Array();this._progressPillModel={};this._setState(this._defaultState)},updateFromServer:function(b){var a={id:b.id,publicApplicationId:b.publicApplicationId,title:b.title,iconUrl:b.appIcon,purchasedVersion:b.purchasedVersion,serverVersion:b.version,packageSize:b.appSize,installSize:b.installSize,currency:b.currency,priceType:b.priceType,price:b.price,sku:b.sku,paymentCategory:b.paymentCategory,vendor:b.creator,vendorid:b.vendorid,vendorUrl:b.homeURL,vendorCity:b.vendorCity,vendorRegion:b.vendorRegion,vendorCountry:b.vendorCountry,islocationbased:b.islocationbased,packageUrl:b.appLocation,};Object.extend(this,a);Mojo.Log.info("AppDownload.updateFromServer updated: details %j",a);if(this._state.updateFromServer){this._state.updateFromServer(this)}},updateFromInstalledAppsList:function(b){var a={publicApplicationId:b.id,title:b.title,installedVersion:b.version,icon:b.icon?b.icon:this.icon,};Object.extend(this,a);Mojo.Log.info("AppDownload.updateFromInstalledAppsList updated: %s",this.toString());if(this._state.updateFromInstalledAppsList){this._state.updateFromInstalledAppsList(this)}},updateFromServerUpdatesList:function(b){var a={id:b.id,serverVersion:b.appVersion,packageUrl:b.packageUrl,vendor:b.vendor,vendorUrl:b.homeURL,iconUrl:b.appIcon,packageSize:b.appSize,installSize:b.installSize,};Object.extend(this,a);Mojo.Log.info("AppDownload.updateFromServerUpdatesList updated %s, from details: %j",this.toString(),a);if(this._state.updateFromServerUpdatesList){this._state.updateFromServerUpdatesList(this)}},updateFromInstallNotification:function(b){if(b.change=="added"||(b.change=="updated"&&b.version&&this.installedVersion!=b.version)){var a={installedVersion:b.version,icon:b.icon};Object.extend(this,a);this.setState("installed");Mojo.Log.info("AppDownload.updateFromInstallNotification changeDetails: %j, app: %s",b,this.toString())}else{if(b.change=="removed"){if(this._state._remove){this._state._remove(this)}Mojo.Log.info("AppDownload.updateFromInstallNotification removed: %s",this.toString())}}},updateFromStatus:function(d,b){var c=b.state;Mojo.Log.info("AppDownload.updateFromStatus newState: %s",c);if(c=="removing"||c=="unknown"||c=="removed"||c=="installed"){return}if(c=="icon download complete"||c=="icon download current"){b.progress=0;c="download progress"}if(c=="ipk download complete"){b.progress=100}if(c=="ipk download current"||c=="ipk download complete"){c="download progress"}else{if(c=="icon download paused"||c=="ipk download paused"){c="paused"}}if(c=="install failed"){this.errorCode=b.reason}else{if(c=="download failed"){this.errorCode=b.errorCode.toString()}else{this.errorCode=b.errorCode}}var a={publicApplicationId:d,title:b.title,progress:b.progress,serverVersion:b.version,vendor:b.vendor,vendorUrl:b.vendorUrl,icon:this.icon?this.icon:b.icon,};Object.extend(this,a);Mojo.Log.info("AppDownload.updateFromStatus updated: %s, from details %j",this.toString(),a);if(c=="canceled"||c=="remove failed"){if(this._state._reset){this._state._reset(this)}}else{if(this._state._allowTransition&&!this._state._allowTransition(c)){Mojo.Log.info("AppDownload.updateFromStatus disallow transition from %s to %s",this.stateToString(),c);return}Mojo.Log.info("AppDownload.updateFromStatus setting to state: %s",c);this.setState(c)}},setState:function(c,a){Mojo.Log.info("AppDownload.setState %s",c);this._setState(c,a);for(var b=0;b<this._observers.length;b++){if(this._observers[b].updateDownloadState){this._observers[b].updateDownloadState(this)}}},_setState:function(b,a){this._state=Catalog.appStates[b];this._state.init(this,a)},getProgressPillModel:function(){Mojo.Log.info("AppDownload.getProgressPillModel %j",this._progressPillModel);return this._progressPillModel},getFormattedPrice:function(){return parseFloat(this.price)!=this.price?this.price:this.price===0?$L("free"):Mojo.Format.formatCurrency(this.price,{fractionDigits:2})},attach:function(a){this._observers.push(a)},detach:function(a){Mojo.Log.info("AppDownload.detach");for(var b=0;b<this._observers.length;b++){if(this._observers[b]===a){this._observers.splice(b,1);Mojo.Log.info("AppDownload.detach removed observer, left %d",this._observers.length)}}},install:function(){if(this._state.install){this._state.install(this)}},installUpdate:function(){Mojo.Log.info("AppDownload.installUpdate ",this.publicApplicationId);if(this._state.installUpdate){this._state.installUpdate(this)}},canInstallUpdate:function(){if(this._state.installUpdate){return true}else{return false}},cancelDownload:function(){if(this._state.cancelDownload){this._state.cancelDownload(this)}},pauseDownload:function(){if(this._state.pauseDownload){this._state.pauseDownload(this)}},cancelPausedDownload:function(){if(this._state.cancelPausedDownload){this._state.cancelPausedDownload(this)}},resumeDownload:function(){if(this._state.resumeDownload){this._state.resumeDownload(this)}},launch:function(){if(this._state.launch){this._state.launch(this)}},uninstall:function(){if(this._state.uninstall){this._state.uninstall(this)}},defaultAction:function(){if(this._state.defaultAction){this._state.defaultAction(this)}},myAppsDefaultAction:function(){if(this._state.myAppsDefaultAction){this._state.myAppsDefaultAction(this)}},isInstalled:function(){var a=Catalog.AppDownloadMngr.getInstalledApp(this.publicApplicationId);if(a){return true}return false},stateToString:function(){return this._state.toString()},toString:function(){return"id:"+this.id+", publicApplicationId:"+this.publicApplicationId+", state:"+this.stateToString()+", title:"+this.title+", serverVersion:"+this.serverVersion+", installedVersion:"+this.installedVersion+", purchasedVersion:"+this.purchasedVersion+", errorCode:"+this.errorCode+", icon:"+this.icon+", updateClass:"+this.updateClass+", activeClass:"+this.activeClass+", resumeClass:"+this.resumeClass+", pauseClass:"+this.pauseClass+" warningClass:"+this.warningClass+", packageSize:"+this.packageSize+" installSize: "+this.installSize},saveToMyApps:function(){if(this._state.saveToMyApps){return this._state.saveToMyApps()}return false},removeFromMyApps:function(){Mojo.Log.info("AppDownload.removeFromMyApps");if(this._state.removeFromMyApps){return this._state.removeFromMyApps()}return false},});var AppDownloadManager=Class.create({APP_ADDED:0,APP_DELETED:1,APP_UPDATED:2,MYAPPS_ALL:3,initialize:function(){this._myApps=new Object();this._activeQueue=new Object();this._observers=new Array();this._allow1xDownload=false;this._myAppsListIsReady=2;this._appInstallerService=new Mojo.Service.Request("palm://com.palm.bus/signal",{method:"registerServerStatus",parameters:{serviceName:"com.palm.appInstallService"},onSuccess:this._appInstallerServiceSignalCB.bind(this)});this._appManagerService=new Mojo.Service.Request("palm://com.palm.bus/signal",{method:"registerServerStatus",parameters:{serviceName:"com.palm.applicationManager"},onSuccess:this._appManagerServiceSignalCB.bind(this)});this._downloadManagerService=new Mojo.Service.Request("palm://com.palm.bus/signal",{method:"registerServerStatus",parameters:{serviceName:"com.palm.downloadmanager"},onSuccess:this._appDownloadServiceSignalCB.bind(this)})},start:function(){Mojo.Log.info("AppDownloadManager.start");this._myApps=new Object();this._myAppsListIsReady=2;this._getInstalledApps();Weave.Services.AppInstallService.status(this._appInstallServiceStatusCB.bind(this))},_appInstallerServiceSignalCB:function(a){if(a.connected==true){Mojo.Log.info("AppDownloadManager._appInstallerServiceSignal is back on the bus, starting");this.start()}else{if(a.connected==false){Mojo.Log.error("AppDownloadManager._appInstallerServiceSignal is gone from the bus")}}},_appManagerServiceSignalCB:function(c){if(c.connected==true){var b=this;var a=function(d,e){Mojo.Log.info("AppDownloadManager.launchPointChanges callback %j",e);b._updateInstalledQueue(e)};Weave.Services.ApplicationManager.launchPointChanges(a)}else{if(c.connected==false){Mojo.Log.error("AppDownloadManager._appManagerServiceSignalCB is gone from the bus")}}},_appDownloadServiceSignalCB:function(a){if(a.connected==true){if(this._allow1xDownload){this.allow1xDownload(true)}}else{if(a.connected==false){Mojo.Log.error("AppDownloadManager._appDownloadServiceSignalCB is gone from the bus")}}},_getInstalledApps:function(){var a=this;Weave.Services.ApplicationManager.getInstalledApplications(function(b,d){var d=b?d:[];for(var c=0;c<d.length;c++){if(d[c].userInstalled){Mojo.Log.info("AppDownloadManager._getInstalledApps installed app: %j",d[c]);var e=a.getAppDownload(d[c].id);e.updateFromInstalledAppsList(d[c])}}a._sendMyAppsListIsReady();Mojo.Log.info("AppDownloadManager._getInstalledApps sending updateInstalledApps");for(var c=0;c<a._observers.length;c++){if(a._observers[c].updateInstalledApps){a._observers[c].updateInstalledApps()}}})},myAppsListIsReady:function(){return(this._myAppsListIsReady==0)},_sendMyAppsListIsReady:function(){this._myAppsListIsReady--;if(this._myAppsListIsReady==0){for(var a=0;a<this._observers.length;a++){if(this._observers[a].updateMyApps){this._observers[a].updateMyApps(null,this.MYAPPS_ALL)}}}},getAppDownload:function(b,a){var c=this._myApps[b];if(!c){c=this._activeQueue[b]}if(!c){Mojo.Log.info("AppDownloadManager.getAppDownload creating new with id %s",b);c=new AppDownload();c.attach(this);this._activeQueue[b]=c}if(a){c.attach(a)}return c},releaseAppDownload:function(b,a){var c=this._myApps[b];if(!c){c=this._activeQueue[b]}c.detach(a);if(c==this._activeQueue[b]&&c._observers.length==1){Mojo.Log.info("AppDownloadManager.releaseAppDownload deleting from activeQueue %s",b);delete this._activeQueue[b]}},_updateInstalledQueue:function(c){Mojo.Log.info("AppDownloadManager._updateInstalledQueue updateReason: %j",c);if(c&&(c.change=="added"||c.change=="removed"||c.change=="updated")){var d=this._myApps[c.id];if(d){d.updateFromInstallNotification(c);var a=this;var b=function(){Mojo.Log.info("AppDownloadManager._updateInstalledQueue sending updateInstalledApps");for(var e=0;e<a._observers.length;e++){if(a._observers[e].updateInstalledApps){a._observers[e].updateInstalledApps()}}};b.delay(2)}}},getInstalledApp:function(b){var a=this._myApps[b];if(a&&a.installedVersion){return a}return null},getMyApps:function(){return this._myApps},attach:function(a){this._observers.push(a)},detach:function(a){Mojo.Log.info("AppDownloadManager.detach");for(var b=0;b<this._observers.length;b++){if(this._observers[b]===a){this._observers.splice(b,1);Mojo.Log.info("AppDownloadManager.detach removed observer, left %d",this._observers.length)}}},updateDownloadState:function(c){Mojo.Log.info("AppDownloadManager.updateDownloadState ",c.publicApplicationId,c.stateToString());Mojo.Log.info("AppDownloadManager.updateDownloadState this._myApps[%s]: %s",c.publicApplicationId,this._myApps[c.publicApplicationId]);var a=null;if(c.saveToMyApps()&&!this._myApps[c.publicApplicationId]){Mojo.Log.info("AppDownloadManager.updateDownloadState APP_ADDED ",c.publicApplicationId,c.stateToString());this._myApps[c.publicApplicationId]=c;a=this.APP_ADDED;Mojo.assert(this._activeQueue[c.publicApplicationId],"AppDownloadManager.updateDownloadState added to MyApps but app wasn't in the activeQ");delete this._activeQueue[c.publicApplicationId]}else{if(c.removeFromMyApps()&&this._myApps[c.publicApplicationId]){Mojo.Log.info("AppDownloadManager.updateDownloadState APP_DELETED ",c.publicApplicationId,c.stateToString());delete this._myApps[c.publicApplicationId];a=this.APP_DELETED;if(c._observers.length>1){this._activeQueue[c.publicApplicationId]=c}}else{if(this._myApps[c.publicApplicationId]){Mojo.Log.info("AppDownloadManager.updateDownloadState APP_UPDATED ",c.publicApplicationId,c.stateToString());a=this.APP_UPDATED}}}if(a!=null){for(var b=0;b<this._observers.length;b++){if(this._observers[b].updateMyApps){this._observers[b].updateMyApps(c,a)}}}},_appInstallServiceStatusCB:function(a,c,d){Mojo.Log.info("AppDownloadManager._appInstallServiceStatusCB singleUpdate:%s, apps: %j",c,d);if(!a){return}for(var b=0;b<d.length;b++){var e=this.getAppDownload(d[b].id);e.updateFromStatus(d[b].id,d[b].details)}if(!c){this._sendMyAppsListIsReady()}},allow1xDownload:function(b,c){var a=this;Weave.Services.request("palm://com.palm.downloadmanager",{method:"allow1x",parameters:{value:b},},function(d){a._allow1xDownload=b;c&&c(true)},function(d){Mojo.Log.info("AppDownloadManager.allow1xDownload failed %j",d);c&&c(false)})},canAllow1xDownload:function(){return this._allow1xDownload},cleanup:function(){Mojo.Log.info("AppDownloadManager.cleanup");if(this._allow1xDownload){this.allow1xDownload(false)}},});var Catalog=Catalog||{};Catalog.AppDownloadMngr=Catalog.AppDownloadMngr||new AppDownloadManager;
33\ No newline at end of file
34+var AppAssistant=Class.create({_name:"findapps",initialize:function(){Mojo.Log.info("AppAssistant::initialize");Weave.Services.ConnectionManager.monitor()},setup:function(){Mojo.Log.info("AppAssistant::setup");var a=this;Weave.System.Activator.addInterface("main",{_defaultStage:"default",init:function(c){var b=this;Weave.System.Activator.open(this._defaultStage,"DefaultStageAssistant",function(d){b.start(d,b._defaultStage)})},start:function(b,c){Mojo.Log.info("AppAssistant(main) start");if(!TermsOfUse.isAccepted()){b.controller.pushScene("terms",function(d){if(d){b._gotoMain()}else{Weave.System.Activator.close(c)}})}else{b._gotoMain()}},});Weave.System.Activator.addInterface("myapps",{_defaultStage:"default",init:function(c){var b=this;Weave.System.Activator.open(this._defaultStage,"DefaultStageAssistant",function(d){b.start(d,b._defaultStage)})},start:function(b,c){Mojo.Log.info("AppAssistant(myapps) start");var d=b.controller.topScene();if(!d||d.sceneName!="myapps"){b.controller.pushScene("myapps")}},});Weave.System.Activator.addInterface("target",{_defaultStage:"default",_webDistributedStage:"webDistributed",init:function(d){Mojo.Log.info("AppAssistant(target).init target %s",d);var b=a._findAppAndPackageId(d);var c=new AppDetails(b.applicationId,b.packageId);c.attach(this);c.getDetailsFromServer()},updateDetails:function(f){var e=this._defaultStage;var d="DefaultStageAssistant";var b=f.getProgramType();Mojo.Log.info("AppAssistant(target).updateDetails programType %s",b);if(b&&(b=="W"||b=="B")){e=this._webDistributedStage+(new Date()).getTime();d="WebDistributedStageAssistant"}var c=this;Weave.System.Activator.open(e,d,function(g){c.target(f,g,e)})},target:function(d,b,c){Mojo.Log.info("AppAssistant(target).target id:%j",d._packageid);d.detach(this);if(!TermsOfUse.isAccepted()){b.controller.pushScene("terms",function(e){if(e){b.controller.swapScene("details",null,null,d)}else{Weave.System.Activator.close(c)}})}else{b.controller.pushScene("details",null,null,d)}}})},cleanup:function(){Mojo.Log.info("AppAssistant.cleanup");if(Catalog&&Catalog.AppDownloadMngr){Catalog.AppDownloadMngr.cleanup()}Weave.Services.ConnectionManager.cleanup()},handleLaunch:function(a){Mojo.Log.info("AppAssistant::handleLaunch params *%j*",a);if(!a||a==""){a={main:""}}Weave.System.Activator.run(a)},_findAppAndPackageId:function(b){Mojo.Log.info("AppAssistant::_findAppAndPackageId target",b);var a=/[?&]packageid=([^&]*)(?:&applicationid=(\d*)){0,1}/.exec(b);return a?{packageId:a[1],applicationId:a[2]}:{}},});var DefaultStageAssistant=Class.create({setup:function(){var a=this;var b=new Weave.Utilities.AppMenu().addEdit().addItem($L("Hide App Vendors"),function(){a.controller.pushScene("hide")}).addItem($L("Preferences & Accounts"),function(){a.controller.pushScene("prefs")},function(){return myProfile.uscarrier}).addHelp("http://help.palm.com/app_catalog/index.html");Weave.Utilities.AppMenu.setDefault(b);Weave.Services.DeviceProfile.getCarrierIdentification(function(c,d){if(c&&((d.mcc>=310&&d.mcc<=316)||PalmSystem.version.match("desktop"))){myProfile.uscarrier=true;myProfile.carrierName=d.shortName}else{b._items.splice(1,1)}})},_gotoMain:function(){var b=false;var c=this.controller.getScenes();if(c){for(var a=c.size()-1;a>=0;a--){var e=c[a];if(e.sceneName=="main"){b=true;break}}}var d=this.controller.topScene();if(d&&d.sceneName!="main"){this.controller.popScenesTo("main")}if(!b){this.controller.pushScene("main")}}});var WebDistributedStageAssistant=Class.create({setup:function(){var a=this;var b=new Weave.Utilities.AppMenu().addEdit().addItem($L("Hide App Vendors"),function(){a.controller.pushScene("hide")}).addItem($L("Preferences & Accounts"),function(){a.controller.pushScene("prefs")},function(){return myProfile.uscarrier}).addHelp("http://help.palm.com/app_catalog/index.html");Weave.Utilities.AppMenu.setDefault(b);Weave.Services.DeviceProfile.getCarrierIdentification(function(c,d){if(c&&((d.mcc>=310&&d.mcc<=316)||PalmSystem.version.match("desktop"))){myProfile.uscarrier=true;myProfile.carrierName=d.shortName}else{b._items.splice(1,1)}})},});var MainAssistant=Class.create({initialize:function(){Mojo.Log.info("MainAssistant.initialize")},setup:function(){Mojo.Log.info("MainAssistant.setup");this._gotoApp=this._gotoApp.bindAsEventListener(this);this._gotoTag=this._gotoTag.bindAsEventListener(this);this._gotoTagCloud=this._gotoTagCloud.bindAsEventListener(this);this._gotoTopRated=this._gotoTopRated.bindAsEventListener(this);this._gotoMostRecent=this._gotoMostRecent.bindAsEventListener(this);this._gotoFreeApps=this._gotoFreeApps.bindAsEventListener(this);this._gotoSearch=this._gotoSearch.bindAsEventListener(this);this._searchKey=this._searchKey.bindAsEventListener(this);this._gotoExploreTags=this._gotoExploreTags.bindAsEventListener(this);this._focusSearch=this._focusSearch.bindAsEventListener(this);this._searchModel={value:""};this.controller.setupWidget("in-fa-ma-search-text",{hintText:$L("Search..."),focus:false,enterSubmits:true,multiline:false,modifierState:Mojo.Widget.sentenceCase,focusMode:Mojo.Widget.focusInsertMode,requiresEnterKey:true,changeOnKeyPress:true,},this._searchModel);this.controller.setupWidget("dv-fa-ma-popularappslist",{itemTemplate:"main/main-app",itemsCallback:this._featuredItemsCallback.bind(this),formatters:{dummy:this._formatFeaturedItem.bind(this),},onItemRendered:this._renderFeaturedItem.bind(this),},{});this.controller.setupWidget("dv-fa-ma-popularappslist-scroller",{},{mode:"horizontal"});this.controller.setupWidget(Mojo.Menu.commandMenu,{menuClass:"no-fade",},{items:[{},{},{label:$L("My Apps"),command:"myapps",icon:"bag"},],});Catalog.AppDownloadMngr.attach(this);Weave.Utilities.AppMenu.useDefault(this)},ready:function(){if(myProfile.validCC===undefined){Weave.Services.PaymentServer.verifyPaymentSetup(function(a,b){if(a&&b.OutGetCCPaymentInfos.ccPaymentInfos.length>0){myProfile.validCC=b}})}},cleanup:function(){Catalog.AppDownloadMngr.detach(this);Mojo.Log.info("MainAssistant.cleanup")},activate:function(){Mojo.Log.info("MainAssistant.activate");this.controller.get("in-fa-ma-search-text").addEventListener(Mojo.Event.propertyChange,this._searchKey);this.controller.get("dv-fa-ma-popularappslist").addEventListener(Mojo.Event.listTap,this._gotoApp);this.controller.get("dv-fa-ma-tag-explore").addEventListener(Mojo.Event.tap,this._gotoExploreTags);this.controller.get("dv-fa-ma-tag-mostrecent").addEventListener(Mojo.Event.tap,this._gotoMostRecent);this.controller.get("dv-fa-ma-tag-toprated").addEventListener(Mojo.Event.tap,this._gotoTopRated);this.controller.get("search-button").addEventListener(Mojo.Event.tap,this._gotoSearch);this._searchModel.value="";this.controller.modelChanged(this._searchModel);this.controller.get("search-button").style.visibility="hidden";this.controller.document.addEventListener(Mojo.Event.tap,this._focusSearch);this.controller.get("in-fa-ma-search-text").mojo.focus()},deactivate:function(){Mojo.Log.info("MainAssistant.deactivate");this.controller.get("in-fa-ma-search-text").removeEventListener(Mojo.Event.propertyChange,this._gotoSearch);this.controller.get("dv-fa-ma-popularappslist").removeEventListener(Mojo.Event.listTap,this._gotoApp);this.controller.get("dv-fa-ma-tag-explore").removeEventListener(Mojo.Event.tap,this._gotoExploreTags);this.controller.get("dv-fa-ma-tag-mostrecent").removeEventListener(Mojo.Event.tap,this._gotoMostRecent);this.controller.get("dv-fa-ma-tag-toprated").removeEventListener(Mojo.Event.tap,this._gotoTopRated);this.controller.get("search-button").removeEventListener("mouseup",this._gotoSearch);this.controller.document.removeEventListener(Mojo.Event.tap,this._focusSearch)},_featuredItemsCallback:function(c,d,b){var a=this;Weave.Services.ApplicationServer.getFeaturedApplications(function(e,h,i,g){a.controller.get("popularapps-loader").style.display="none";a.controller.get("dv-fa-ma-popularappslist-scroller").style.display="block";if(e){var f=a.controller.get("palm-disclaimer");if(g=="final"&&f.hasClassName("beta")){f.removeClassName("beta")}else{if(g=="beta"&&!f.hasClassName("beta")){f.addClassName("beta")}}a.controller.get("dv-fa-ma-popularappslist").mojo.noticeUpdatedItems(0,i)}else{Utilities.Errors.displayError(h)}})},_formatFeaturedItem:function(b,a){a.formattedAverageRating=(""+(Math.round(a.averageRating*2)/2)).replace(/\./,"");if(this._getApplicationInstalledState(a)=="update"){a.formattedUpdateAvailable="has-update"}else{a.formattedUpdateAvailable=""}},_renderFeaturedItem:function(c,a,b){new LazyLoadImage(a.appIcon,b.querySelector(".app-picture"))},_gotoApp:function(a){this.controller.stageController.pushScene("details",a.item.id,a.item.publicApplicationId)},_gotoExploreTags:function(a){this.controller.stageController.pushScene("browse",undefined,false)},_gotoTag:function(a){this.controller.stageController.pushScene("search","tag",a.item.name)},_gotoTagCloud:function(a){this.controller.stageController.pushScene("tagcloud")},_gotoTopRated:function(a){this.controller.stageController.pushScene("search","sort","by_rating")},_gotoMostRecent:function(a){this.controller.stageController.pushScene("search","sort","by_date")},_gotoFreeApps:function(a){this.controller.stageController.pushScene("search","sort","PRICE_DESC")},_gotoSearch:function(a){this.controller.stageController.pushScene("search","query",this.controller.get("in-fa-ma-search-text").mojo.getValue())},_searchKey:function(a){if(a.originalEvent.type=="keyup"&&a.originalEvent.keyCode==Mojo.Char.enter){this.controller.stageController.pushScene("search","query",a.value)}else{if(a.value==""){this.controller.get("search-button").style.visibility="hidden"}else{this.controller.get("search-button").style.visibility="visible"}}},updateInstalledApps:function(){Mojo.Log.info("MainAssistant.updateInstalledApps");var a=this.controller.get("dv-fa-ma-popularappslist").mojo;if(a){var b=a.getLoadedItemRange();a.noticeUpdatedItems(b.offset,a.getItems(b.offset,b.limit))}},_getApplicationInstalledState:function(a){var b=Catalog.AppDownloadMngr.getInstalledApp(a.publicApplicationId);if(b){Mojo.Log.info("versions: installed %s download %s",b.installedVersion,a.appVersion);if(Utilities.VersionCheck.compare(b.installedVersion,a.appVersion)!=-1){return"installed"}else{return"update"}}return"notinstalled"},handleCommand:function(a){if(a.type==Mojo.Event.command&&a.command=="myapps"){this.controller.stageController.pushScene("myapps")}},_focusSearch:function(a){this.controller.get("in-fa-ma-search-text").mojo.focus.defer()}});var PasswordAssistant=Class.create({initialize:function(a,b){this.sceneAssistant=a;this.controller=a.controller;this._loginAttemptCount=0;this._params=b;this._params.sceneAssistant=a;this._custserviceurl=$L("http://www.palm.com/us/support/mobile/webos/contact.html")},setup:function(a){this.widget=a;this.acctPasswordAttr={hintText:$L("enter password"),modelProperty:"original",autoFocus:true,maxLength:20,changeOnKeyPress:true,requiresEnterKey:true,focusMode:Mojo.Widget.focusSelectMode};this.acctPasswordModel={original:""};this.controller.setupWidget("acctPassword",this.acctPasswordAttr,this.acctPasswordModel);this.controller.get("acctPassword").observe(Mojo.Event.propertyChange,this._passwordChanged.bind(this));this.buttonAttr={disabledProperty:"disabled"};this.buttonModel={disabled:true,buttonLabel:$L("Continue"),buttonClass:"palm-button"};this.controller.setupWidget("submitPassword",this.buttonAttr,this.buttonModel);Mojo.listen(this.controller.get("submitPassword"),Mojo.Event.tap,this._isUserValid.bindAsEventListener(this));this.forgotButtonAttr={disabledProperty:"disabled"};this.forgotButtonModel={disabled:false,buttonLabel:$L("Forgot password"),buttonClass:"palm-button"};this.controller.setupWidget("forgotPasswordButton",this.forgotButtonAttr,this.forgotButtonModel);this.controller.listen("forgotPasswordButton",Mojo.Event.tap,this._forgotPassword.bindAsEventListener(this));this._getAccountToken();this.passwordField=this.controller.get("acctPassword")},activate:function(){this.passwordField.mojo.focus()},_passwordChanged:function(a){if(this.acctPasswordModel.original.length>0){this.buttonModel.disabled=false}else{this.buttonModel.disabled=true}this.controller.modelChanged(this.buttonModel);if(Mojo.Char.isEnterKey(a.originalEvent.keyCode)){if(this.buttonModel.disabled==false){this.passwordField.mojo.blur();this._isUserValid();Event.stop(a)}else{this.passwordField.mojo.focus()}}},_getAccountToken:function(){Mojo.Log.info("------------------- Get account token ------------------");Weave.Services.AccountServices.getAccountToken(function(a,c,b,d){if(a){if(b!=undefined){myProfile.email=b;myProfile.state=d}else{Mojo.Log.error("PasswordAssistant._getAccountToken: accountAlias == undefined: No account token")}}else{Mojo.Log.error("No account token")}})},_displayErrors:function(a,b){this.controller.get("passwordLengthError").style.display=(a?null:"none");this.controller.get("passwordError").style.display=(b?null:"none")},_isUserValid:function(){this._loginAttemptCount++;myProfile.password=this.acctPasswordModel.original;if((myProfile.password.length<6)||(myProfile.password.length>20)){this._displayErrors(true,false);this.passwordField.mojo.focus.defer()}else{if(!Weave.Services.ConnectionManager.isOnline()){this._displayErrors(false,false)}else{this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel);var a=this;Weave.Services.DeviceProfile.getDeviceId(function(c,b){if(c&&b){Weave.Services.AccountServices.isUserValid(myProfile.email,myProfile.password.replace(/ /g,""),b,function(d,e){if(d){Mojo.Log.info("Login attempt: "+a._loginAttemptCount);if(e.isValid==true){a._displayErrors(false,false);myProfile.idToken=e.idToken;a.widget.mojo.close();if(e.passwordResetFlag){a.controller.showDialog({template:"payment-setup/reset-password-dialog",assistant:new ResetPasswordAssistant(a,a._params)})}else{Preferences.setLoginTime();a._params.onComplete({passwordValid:true})}}else{if(myProfile.questionId==-2){Weave.Services.AccountServices.getAccountSecurityQuestions(myProfile.email,Mojo.Locale.current,function(f,g){if(f){if(g.id!==undefined){Mojo.Log.info("Got security question",g.id);myProfile.questionId=g.id;myProfile.questionText=g.question}else{myProfile.questionId=-1}}else{Mojo.Log.error("Error in getting account security question = %o",$H(g));myProfile.questionId=-1}a._loginError()})}else{a._loginError()}}}else{if(e.errorCode&&e.errorCode==="CONNECTION_ERROR"){this.widget.mojo.close()}}})}else{Mojo.Log.error("Could not get device id %o",$H(response))}})}}},_loginError:function(){if(this._loginAttemptCount>=3){if(myProfile.questionId>=0){this._forgotPassword()}else{Mojo.Log.info("sending password reset");var a=this;Weave.Services.AccountServices.requestPasswordResetEmail(myProfile.email,function(b,c){if(b){Mojo.Log.info("------------ resetEmailSuccess -----------------%o",$H(c));a.controller.showAlertDialog({onChoose:function(d){a.widget.mojo.close();a._params.onComplete({})},title:$L("Password reset"),message:$L('Follow the instructions we sent to <b>#{email}</b> to reset your password or <a href="#{url}">contact customer service.</a>').interpolate({email:myProfile.email,url:a._custserviceurl}),allowHTMLMessage:true,choices:[{label:$L("Done"),value:"done",type:"color"}]})}else{Mojo.Log.error("could not send password reset email %o",$H(c))}})}}else{Mojo.Log.info("Login attempt: ",this._loginAttemptCount);if(myProfile.questionId>=0){this.controller.get("forgotPassword").show()}this._displayErrors(false,true);this.passwordField.mojo.focus()}},_forgotPassword:function(){this.widget.mojo.close();this.controller.showDialog({template:"payment-setup/security-question-dialog",assistant:new ForgotPasswordAssistant(this,this._params)})},});var ForgotPasswordAssistant=Class.create({initialize:function(a,b){this.sceneAssistant=a;this.controller=a.controller;this.attemptCount=1;this._params=b},setup:function(a){this.widget=a;this._clearErrorMessages();this.controller.get("questionText").update(myProfile.questionText);this.responseAttributes={modelProperty:"response",multiline:false,maxLength:50,textReplacement:false,focusMode:Mojo.Widget.focusInsertMode,changeOnKeyPress:true,requiresEnterKey:true};this.responseModel={response:"",disabled:false};this.controller.setupWidget("response",this.responseAttributes,this.responseModel);this.controller.get("response").observe(Mojo.Event.propertyChange,this.responseTextChanged.bind(this));this.buttonAttr={disabledProperty:"disabled"};this.buttonModel={disabled:true,buttonLabel:$L("Done"),buttonClass:"palm-button"};this.controller.setupWidget("submitAnswer",this.buttonAttr,this.buttonModel);this.controller.listen("submitAnswer",Mojo.Event.tap,this.submitAnswer.bindAsEventListener(this))},activate:function(){this.controller.get("response").mojo.focus()},toggleDisabled:function(){if(this.responseModel.response.length>0){this.buttonModel.disabled=false;this.controller.modelChanged(this.buttonModel)}else{this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel)}},responseTextChanged:function(a){this.responseModel.response=a.value;this.controller.modelChanged(this.responseModel,this);this.toggleDisabled();if(a&&Mojo.Char.isEnterKey(a.originalEvent.keyCode)){if(this.buttonModel.disabled==false){this.submitAnswer();Event.stop(a)}}},_clearErrorMessages:function(){this.controller.get("noResponseMessage").hide();this.controller.get("wrongResponse").hide()},submitAnswer:function(){this.response=this.responseModel.response;this._clearErrorMessages();if(this.response==""||this.response==undefined){this.controller.get("noResponseMessage").show();return}if(Weave.Services.ConnectionManager.isOnline()===false){return}this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel);this.attemptCount++;var a=this;Weave.Services.AccountServices.authenticateAccountFromSecurityQuestion(myProfile.email,myProfile.questionId,this.response,function(b,c){if(b){Mojo.Log.info("authenticate successful: %o",$H(c));if(c.returnValue==true){myProfile.idToken=c.idToken;a.widget.mojo.close();a.controller.showDialog({template:"payment-setup/reset-password-dialog",assistant:new ResetPasswordAssistant(a,a._params)})}}else{a._clearErrorMessages();Mojo.Log.error("changePassword error = %o",$H(c));if(a.attemptCount<=3){a.controller.get("wrongResponse").show();a.controller.get("response").mojo.focus()}else{Weave.Services.AccountServices.requestPasswordResetEmail(myProfile.email,function(d,e){if(d){a.widget.mojo.close();a.controller.showDialog({template:"payment-setup/reset-email-dialog",assistant:new ResetEmailAssistant(a)})}else{a.widget.mojo.close();Mojo.Controller.errorDialog($L("We could not send an email to reset your password. Visit palm.com/support for more help."))}})}}})},});var ResetPasswordAssistant=Class.create({initialize:function(a,b){this.sceneAssistant=a;this.controller=a.controller;this._params=b},setup:function(a){this.widget=a;this.clearErrorMessages();this.acctPasswordAttr={hintText:$L("enter password"),modelProperty:"original",autoFocus:true,maxLength:20,enterSubmits:true,focusMode:Mojo.Widget.focusSelectMode};this.acctPasswordModel={original:""};this.controller.setupWidget("newPassword",this.acctPasswordAttr,this.acctPasswordModel);this.verifyPasswordAttr={hintText:$L("confirm password"),modelProperty:"verify",autoFocus:false,maxLength:20,className:" ",changeOnKeyPress:true,requiresEnterKey:true,focusMode:Mojo.Widget.focusSelectMode};this.verifyPasswordModel={verify:""};this.controller.setupWidget("confirmPassword",this.verifyPasswordAttr,this.verifyPasswordModel);this.controller.get("newPassword").observe(Mojo.Event.propertyChange,this.passwordChanged.bind(this));this.controller.get("confirmPassword").observe(Mojo.Event.propertyChange,this.verifyPasswordChanged.bind(this));this.buttonAttr={disabledProperty:"disabled"};this.buttonModel={disabled:true,buttonLabel:$L("Done"),buttonClass:"palm-button"};this.controller.setupWidget("submitResetPassword",this.buttonAttr,this.buttonModel);this.controller.listen("submitResetPassword",Mojo.Event.tap,this.resetPassword.bindAsEventListener(this))},clearErrorMessages:function(){this.controller.get("mismatchMessage").hide();this.controller.get("noPasswordMessage").hide();this.controller.get("noConfirmMessage").hide();this.controller.get("systemErrorMessage").hide();this.controller.get("passwordLengthError").hide()},toggleDisabled:function(){if(this.acctPasswordModel.original.length>0&&this.verifyPasswordModel.verify.length>0){this.buttonModel.disabled=false;this.controller.modelChanged(this.buttonModel)}else{this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel)}},passwordChanged:function(a){this.toggleDisabled()},verifyPasswordChanged:function(a){this.toggleDisabled();if(a&&Mojo.Char.isEnterKey(a.originalEvent.keyCode)){if(this.buttonModel.disabled==false){if(this.resetPassword()===true){this.controller.get("newPassword").mojo.focus.defer()}Event.stop(a)}}},resetPassword:function(){this.newPassword=this.acctPasswordModel.original;this.confirmPassword=this.verifyPasswordModel.verify;this.clearErrorMessages();this.controller.get("newPassword").mojo.focus.defer();if(this.newPassword==""||this.newPassword==undefined){this.controller.get("noPasswordMessage").show();return true}else{if((this.newPassword.length<6)||(this.newPassword.length>20)){this.controller.get("passwordLengthError").show();return true}else{if(this.confirmPassword==""||this.confirmPassword==undefined){this.controller.get("noConfirmMessage").show();return true}else{if(this.newPassword!=this.confirmPassword){this.controller.get("mismatchMessage").show();return true}else{if(Weave.Services.ConnectionManager.isOnline()===false){}else{Mojo.Log.info("AUTHING ACCOUNT",myProfile.email,myProfile.password,this.newPassword);this.buttonModel.disabled=true;this.controller.modelChanged(this.buttonModel);var a=this;Weave.Services.AccountServices.changePassword(this.newPassword.replace(/ /g,""),myProfile.questionId,undefined,myProfile.idToken,true,function(b,c){if(b&&c.returnValue){Mojo.Log.info("changePassword successful: %o",$H(c));myProfile.password=a.newPassword;Preferences.setLoginTime();a._params.onComplete({passwordValid:true,passwordChanged:true,})}else{Mojo.Log.error("changePassword error = %o",$H(c));if(Weave.Services.ConnectionManager.isOnline()===false||c.errorText==="No response"){Mojo.Log.info("show connection error ---------------");a.widget.mojo.close()}else{a.controller.get("systemErrorMessage").show()}}})}}}}}},});var ResetEmailAssistant=Class.create({initialize:function(a){this.sceneAssistant=a;this.controller=a.controller},setup:function(a){this.widget=a;this.controller.get("emailAddress").update(myProfile.email);this.controller.listen("doneResetEmail",Mojo.Event.tap,this.doneResetEmail.bindAsEventListener(this))},doneResetEmail:function(a){this.widget.mojo.close()}});var myProfile={email:"",password:"",firstName:"",lastName:"",questionId:-2,response:"",securityQuestions:[],};var Preferences={_timeout:4*60*60*1000,getPaymentLogin:function(){var a=(new Mojo.Model.Cookie("com.palm.app.findapps.paymentPref")).get()||{};Mojo.Log.info("getPaymentLogin %j",a);return a.paymentPref||"timeout"},setPaymentLogin:function(c){var a=new Mojo.Model.Cookie("com.palm.app.findapps.paymentPref");var b=a.get()||{};Mojo.Log.info("setPaymentLogin %j %s",b,c);b.paymentPref=c;a.put(b)},setLoginTime:function(){var a=new Mojo.Model.Cookie("com.palm.app.findapps.paymentPref");var b=a.get()||{};Mojo.Log.info("setLoginTime %j",b);b.loginTime=new Date().getTime();a.put(b)},isLoginTimedOut:function(){var b=(new Mojo.Model.Cookie("com.palm.app.findapps.paymentPref")).get()||{loginTime:0};var a=new Date().getTime();Mojo.Log.info("now %d then %d timeout %d diff %d",a,b.loginTime,this._timeout,a-b.loginTime);if(a-b.loginTime>this._timeout||b.paymentPref=="every"){return true}else{return false}},};var TermsOfUse={_TOSDate:"7th Aug 2009",isAccepted:function(){var a=(new Mojo.Model.Cookie("com.palm.app.findapps.terms")).get()||{};return a.termsOfUseAccepted==this._TOSDate},setAccepted:function(){var a=new Mojo.Model.Cookie("com.palm.app.findapps.terms");var b=a.get()||{};b.termsOfUseAccepted=this._TOSDate;a.put(b)},};var Spinner=Class.create({initialize:function(c,e,d,b,a){this._controller=c.controller;this._model={spinning:false};this._controller.setupWidget(e,{spinnerSize:b?b:"small"},this._model);this._scrim=this._controller.get(a?a:e+"Cont");this._state="stopped";if(d){this.start()}},start:function(){if(this._scrim){this._scrim.show()}this._fire("start")},stop:function(){this._fire("stop")},_fire:function(b){Mojo.Log.info("Spinner event",b,"state",this._state);var a=this;switch(this._state){case"stopped":switch(b){case"start":this._state="starting";this._timer=setTimeout(function(){a._fire("starting2sec")},2000);break;case"stop":case"starting1sec":case"running1sec":break}break;case"starting":switch(b){case"starting2sec":this._state="runningquick";this._model.spinning=true;this._controller.modelChanged(a._model);this._timer=setTimeout(function(){a._fire("running1sec")},1000);break;case"stop":clearTimeout(this._timer);this._state="stopped";if(this._scrim){this._scrim.hide()}break;case"start":case"running1sec":break}break;case"runningquick":switch(b){case"running1sec":this._state="running";break;case"stop":this._state="stopping";break;case"start":case"starting2sec":break}break;case"running":switch(b){case"stop":this._state="stopped";this._model.spinning=false;this._controller.modelChanged(this._model);if(this._scrim){this._scrim.hide()}break;case"start":case"starting2sec":case"running1sec":break}break;case"stopping":switch(b){case"running1sec":this._state="stopped";this._model.spinning=false;this._controller.modelChanged(this._model);if(this._scrim){this._scrim.hide()}break;case"start":this._state="running";break;case"stop":case"starting2sec":break}break}},});var Utilities=Utilities||{};Utilities.CommonErrors={_PMTGroupErrors:{PMT_0:{dialog:true,title:$L("Payment Type"),message:$L("You can only pay with a credit card. Update your account information in Preferences & Accounts and try again. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_1:{dialog:true,title:$L("Payment Failed"),message:$L("We cannot process your payment. Contact your financial institution. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_2:{dialog:true,title:$L("Payment Failed"),message:$L("Update the payment information in your account and try again. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_3:{dialog:true,title:$L("Payment Failed"),message:$L("Cybersource refused your payment. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_4:{dialog:true,title:$L("Payment Failed"),message:$L("You are not permitted to purchase items in the App Catalog. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_5:{dialog:true,title:$L("Transaction Error"),message:$L("The credit card you are using may be fraudulent. Enter a different credit card in Preferences & Accounts and try again. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},},};Utilities.Errors={_displayErrorPage:function(a){var b=Weave.System.Activator.getActiveStageController(true);Mojo.Log.error("Errors._displayErrorPage",a);if(a=="invalidtoken"){Weave.Services.AccountServices.notifyAuthenticationFailure(function(){if(!b){return}b.topScene().showAlertDialog({onChoose:function(){},title:$L("No Palm Profile"),message:$L("You need an active Palm profile to use App Catalog."),choices:[{label:$L("OK"),value:true,type:"dismiss"},]})})}else{if(!b){return}b.swapScene("error",a)}},_displayIncompatibleErrorPage:function(a){Mojo.Log.error("Errors._displayNonFatalErrorPage",a);var b=Weave.System.Activator.getActiveStageController(true);if(!b){return}b.swapScene("incompatible",a)},_displayErrorDialog:function(a,c){var b=Weave.System.Activator.getActiveStageController();if(!b){return}b.topScene().showAlertDialog({onChoose:c,title:a.title,message:a.formattedMessage?a.formattedMessage:a.message,choices:a.choices})},displayError:function(f,d,e,b,c,h){if(f=="failure"&&e&&e.indexOf("PMT_")){f=e}Mojo.Log.error("Errors.displayError errorCode %s, interpolateArgs %j, defaultError %s, defaultMessage %s",f,d,e,c);var a=this._dialogErrors[f]||this._dialogErrors[e];if(!a){if(f.toString().indexOf("PMT")>=0){a=this._dialogErrors[PMT_catchAll]}else{a={dialog:true,title:b||$L("Unknown Error"),message:c||f}}}if(a.page){this._displayErrorPage(f)}else{if(a.incompatible_page){this._displayIncompatibleErrorPage(f)}else{if(a.dialog){if(d){var g=a.message;a.formattedMessage=g.interpolate(d)}this._displayErrorDialog(a,h||function(){})}}}},_dialogErrors:{offline:{page:true},invalidtoken:{page:true},failure:{page:true},badformat:{page:true},timeout:{page:true},jsonexception:{page:true},appunavailable:{page:true},DISC0025:{incompatible_page:true},DISC0124:{incompatible_page:true},DISC0125:{incompatible_page:true},DISC0201:{incompatible_page:true},DISC0202:{incompatible_page:true},DISC0203:{incompatible_page:true},PMT_catchAll:{dialog:true,title:$L("Unexpected problem"),message:$L("App Catalog could not complete the last action you performed. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_addCC_default:{dialog:true,title:$L("Couldn't Add Credit Card"),message:$L("A problem occurred when adding your credit card information. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_modifyCC_default:{dialog:true,title:$L("Couldn't Update"),message:$L("The credit card information could not be updated. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_removeCC_default:{dialog:true,title:$L("Couldn't Remove"),message:$L("The credit card was not removed from your account. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT_purchase_default:{dialog:true,title:$L("Couldn't Purchase"),message:$L("The item could not be purchased. Try again later. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02000:{dialog:true,title:$L("Data Entry"),message:$L("A required field does not exist or is empty"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02002:{dialog:true,title:$L("Data Entry"),message:$L("This card type is not supported"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02003:{dialog:true,title:$L("Data Entry"),message:$L("This order type is not supported"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02005:{dialog:true,title:$L("Data Entry"),message:$L("The State code is incorrect. Try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02006:{dialog:true,title:$L("Data Entry"),message:$L("The Country code is incorrect. Try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02008:{dialog:true,title:$L("Data Entry"),message:$L("The Currency code is incorrect. Try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02010:{dialog:true,title:$L("Data Entry"),message:$L("You must enter valid information in every field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02011:{dialog:true,title:$L("Data Entry"),message:$L("You must enter a number in the Credit Card field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02012:{dialog:true,title:$L("Data Entry"),message:$L("You must enter a number in the Payment Info ID field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02013:{dialog:true,title:$L("Data Entry"),message:$L("You must enter a number in the Quantity field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02014:{dialog:true,title:$L("Data Entry"),message:$L("The date in the Expiration Date field must be in the format mmyyyy"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02015:{dialog:true,title:$L("Data Entry"),message:$L("The value in the Item Unit Price field is not valid. Enter a number instead."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02016:{dialog:true,title:$L("Data Entry"),message:$L("The date in the Order Date field must be in the format yyyyMMddHHmmss"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02017:{dialog:true,title:$L("Data Entry"),message:$L("Update the Expiration Date information in your account and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT02018:{dialog:true,title:$L("Data Entry"),message:$L("The Zip code is incorrect. Try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT03000:{dialog:true,title:$L("Transaction Error"),message:$L("Update your credit card information in Preferences & Accounts and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT03001:Utilities.CommonErrors._PMTGroupErrors.PMT_0,PMT03002:{dialog:true,title:$L("Payment Failed"),message:$L("We cannot perform financial transactions in your country."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT03003:Utilities.CommonErrors._PMTGroupErrors.PMT_0,PMT03006:{dialog:true,title:$L("Payment Failed"),message:$L("The last transaction failed. Update the payment information in your account and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT03007:{dialog:true,title:$L("Couldn't Update"),message:$L("Credit card information can only be updated after all pending purchases have cleared. Try again after you received receipts for all recent purchases."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04000:{dialog:true,title:$L("Payment Failed"),message:$L("Update the Expiration Date information in your account and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04001:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04002:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04004:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04005:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04006:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04007:{dialog:true,title:$L("Payment Failed"),message:$L("Update the security number and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04008:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04009:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04010:{dialog:true,title:$L("Data Entry"),message:$L("Update the payment information in your account and try again. #{errCode}"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04011:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04012:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04013:Utilities.CommonErrors._PMTGroupErrors.PMT_3,PMT04014:Utilities.CommonErrors._PMTGroupErrors.PMT_3,PMT04015:Utilities.CommonErrors._PMTGroupErrors.PMT_4,PMT04016:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04017:{dialog:true,title:$L("Payment Failed"),message:$L("There is no payment information associated with your Palm Profile. Tap Preferences in the App Menu to set it up."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04018:Utilities.CommonErrors._PMTGroupErrors.PMT_5,PMT04019:Utilities.CommonErrors._PMTGroupErrors.PMT_5,PMT04020:Utilities.CommonErrors._PMTGroupErrors.PMT_5,PMT04021:{dialog:true,title:$L("Transaction Error"),message:$L("A transaction problem has occurred. Update your credit card information in Preferences & Accounts and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04200:{dialog:true,title:$L("Payment Failed"),message:$L("Update your credit card address information and try again."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04400:Utilities.CommonErrors._PMTGroupErrors.PMT_3,PMT04401:Utilities.CommonErrors._PMTGroupErrors.PMT_3,PMT04402:Utilities.CommonErrors._PMTGroupErrors.PMT_4,PMT04403:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04404:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04405:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04406:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04407:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04408:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04409:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04410:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04411:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04412:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04413:Utilities.CommonErrors._PMTGroupErrors.PMT_2,PMT04414:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT04415:{dialog:true,title:$L("Transaction Error"),message:$L("There is a problem with the credit card. Enter a different credit card in Preferences & Accounts and try again. PMT04415"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04416:{dialog:true,title:$L("Transaction Error"),message:$L("There may be a problem with the credit card. Enter a different credit card in Preferences & Accounts and try again. PMT04416"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT04417:{dialog:true,title:$L("Transaction Error"),message:$L("There is a problem with the credit card. Enter a different credit card in Preferences & Accounts and try again. PMT04417"),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},PMT51004:Utilities.CommonErrors._PMTGroupErrors.PMT_1,PMT51005:Utilities.CommonErrors._PMTGroupErrors.PMT_1,LOCL0001:{dialog:true,title:$L("Data Entry"),message:$L("The address is incomplete. Verify that you’ve entered your complete address."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0002:{dialog:true,title:$L("Data Entry"),message:$L("The payment information is incomplete. Verify that you’ve entered your payment information completely."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0003:{dialog:true,title:$L("Data Entry"),message:$L("Please only enter numbers (0-9) in the account number."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0004:{dialog:true,title:$L("Data Entry"),message:$L("Choose a card type."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0005:{dialog:true,title:$L("Data Entry"),message:$L("You must enter a phone number in the Phone Number field."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0006:{dialog:true,title:$L("Data Entry"),message:$L("Verify your billing information. It is incomplete."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},LOCL0007:{dialog:true,title:$L("Data Entry"),message:$L("Verify your account information. It is incomplete or incorrect."),choices:[{label:$L("OK"),value:true,type:"dismiss"}]},validate_space_default_single:{dialog:true,title:$L("Can’t Install"),message:$L("This app requires #{installSize}. You must delete some apps or files before you can install it. Click Help for more information."),choices:[{label:$L("Help"),value:"help",type:"primary"},{label:$L("OK"),value:"ok",type:"secondary"}]},validate_space_default_mult:{dialog:true,title:$L("Can’t Install"),message:$L("#{installSize} is required to install everything. You can install apps one at a time, or delete apps or files to make room. Click Help for more information."),choices:[{label:$L("Help"),value:"help",type:"primary"},{label:$L("OK"),value:"ok",type:"secondary"}]},install_default:{dialog:true,title:$L("Couldn’t Install"),message:$L("There was a problem installing the application"),choices:[{label:$L("Try Again"),value:"retry",type:"primary"},{label:$L("Don't Install"),value:"cancel",type:"secondary"}]},FAILED_NOT_ENOUGH_TEMP_SPACE:{dialog:true,title:$L("Couldn’t Install"),message:$L("This app requires #{installSize}. You must delete some apps or files before you can install it. Click Help for more information."),choices:[{label:$L("Help"),value:"help",type:"primary"},{label:$L("OK"),value:"cancel",type:"secondary"}]},FAILED_NOT_ENOUGH_INSTALL_SPACE:{dialog:true,title:$L("Couldn’t Install"),message:$L("This app requires #{installSize}. You must delete some apps or files before you can install it. Click Help for more information."),choices:[{label:$L("Help"),value:"help",type:"primary"},{label:$L("OK"),value:"cancel",type:"secondary"}]},download_default:{dialog:true,title:$L("Download Error"),message:$L("There was a problem downloading the application."),choices:[{label:$L("Try Again"),value:"retry",type:"primary"},{label:$L("Don't Download"),value:"cancel",type:"secondary"}]},"-3":{dialog:true,title:$L("Download Error"),message:$L("The download file is missing or damaged."),choices:[{label:$L("Try Again"),value:"retry",type:"primary"},{label:$L("Don't Download"),value:"cancel",type:"secondary"}]},"-2":{dialog:true,title:$L("Download Error"),message:$L("The download file is missing or damaged."),choices:[{label:$L("Try Again"),value:"retry",type:"primary"},{label:$L("Don't Download"),value:"cancel",type:"secondary"}]},},};var Utilities=Utilities||{};Utilities.UTCDate=new (Class.create({parse:function(a){var b=new Date();b.setUTCFullYear(a.substring(0,4)-0,a.substring(5,7)-1,a.substring(8,10)-0);b.setUTCHours(a.substring(11,13));b.setUTCMinutes(a.substring(14,16));return b},shortDate:function(a){return""+a.getUTCFullYear()+(a.getUTCMonth()+1).toPaddedString(2)+a.getUTCDate().toPaddedString(2)+a.getUTCHours().toPaddedString(2)+a.getUTCMinutes().toPaddedString(2)+a.getUTCSeconds().toPaddedString(2)},}))();var Utilities=Utilities||{};Utilities.VersionCheck={compare:function(h,g){if(h==null&&g==null){return 0}else{if(h==null){return -1}else{if(g==null){return 1}}}var c=(""+h).split(/[^a-zA-Z0-9]+/);var b=(""+g).split(/[^a-zA-Z0-9]+/);var f=Math.min(c.length,b.length);for(var i=0;i<=f;i++){if(i==c.length){return(i==b.length?0:-1)}else{if(i==b.length){return 1}}var e=this._parseInt(c[i]);var d=this._parseInt(b[i]);if(e!=d){var a=e-d;return a<0?-1:a>0?1:0}e=c[i].toLowerCase();d=b[i].toLowerCase();if(e<d){return -1}else{if(e>d){return 1}}}return 0},_parseInt:function(a){if(a.search(/[^\D]/)){return null}else{return parseInt(a,10)}}};var LazyLoadImage=Class.create({initialize:function(b,c){var a=document.createElement("img");a.onload=function(){this.onload=undefined;c.style.backgroundImage="url("+this.src+")"};a.src=b}});var Utilities=Utilities||{};Utilities.Common={handleCommand:function(b,d){if(b.type==Mojo.Event.command&&b.command=="email"){var a=this._generateAppURL(d);if(a){var c={summary:$L("Check out this webOS app"),text:this._generateEmailMessageText(d,a)};Weave.Services.ApplicationManager.launchApplication("com.palm.app.email",c)}}else{if(b.type==Mojo.Event.command&&b.command=="text"){var a=this._generateAppURL(d);if(a){var c={messageText:this._generateSMSMessageText(d,a),};Weave.Services.ApplicationManager.launchApplication("com.palm.app.messaging",c)}}}},_generateAppURL:function(b){var a=b.getDetails();if(a&&a.publicApplicationId&&a.id){return"http://developer.palm.com/appredirect/?packageid="+a.publicApplicationId+"&applicationid="+a.id}else{return null}},_generateEmailMessageText:function(d,a){var b=d.getDetails();var c={appURL:a};if(b&&b.title){c.title=b.title}else{c.title=a}return Mojo.View.render({object:c,template:"comments/share-template"})},_generateSMSMessageText:function(d,a){var c=a;var b=d.getDetails();if(b&&b.title){c=b.title}return $L("Check out #{title}: #{url}").interpolate({title:c,url:a})},};if(window==window.top){var Weave=Weave||{};(function(){function a(b){for(var c in b){if(c){Weave[c.charAt(0).toUpperCase()+c.substring(1)]={}}}}a({system:["activator"],services:["services","accountservices","applicationinstaller","applicationmanager","catalogserver","applicationserver","browser","connectionmanager","deviceprofile","appinstallservice","systemmanager","systemproperties","paymentserver"],utilities:["regexp","appmenu"],download:["downloadstates","appdetails","appdownload","appdownloadmanager"],})})()}Weave.System.Activator={_inames:{},addInterface:function(a,b){this._inames[a]=b},run:function(c){var b=this;for(var a in c){iface=this._inames[a];if(iface){iface.init(c[a])}}},open:function(d,c,e){Mojo.Log.info("Activator.open stage ",d,c);if(d==null){e&&e(null)}else{var b=Mojo.Controller.appController.getStageController(d);if(b){e&&e(b.assistant);b.activate()}else{var a=this;Mojo.Controller.appController.createStageWithCallback({lightweight:true,name:d,assistantName:c,},function(f){Mojo.Log.info("Activator.open stageAssistant: %s callback ",f.assistant.stageName);e&&e(f.assistant)})}}},close:function(a){Mojo.Controller.appController.closeStage(a)},getActiveStageController:function(b){var a=Mojo.Controller.appController.getActiveStageController();if(!a&&b){a=Mojo.Controller.appController.getStageController("default")}return a}};Object.extend(Weave.Services,{_pending:{},_next:1,request:function(c,b,e,a){var f=this._next++;var d=this._pending;b.onSuccess=function(g){delete d[f];e&&e(g)};b.onFailure=function(g){delete d[f];a&&a(g)};d[f]=new Mojo.Service.Request(c,b);return d[f]},subscriptionRequest:function(c,b,e,a){var f=this._next++;var d=this._pending;b.onSuccess=function(g){e&&e(g)};b.onFailure=function(g){a&&a(g)};b.parameters=Object.extend(b.parameters||{},{subscribe:true});d[f]=new Mojo.Service.Request(c,b);return d[f]},cleanup:function(){}});Weave.Services.AccountServices={_target:"palm://com.palm.accountservices",getServerUrl:function(a){Weave.Services.request(this._target,{method:"getServerUrl",parameters:{},},function(b){a(true,b.serverUrl)},function(){a(false)})},getPaymentServerUrl:function(a){Weave.Services.request(this._target,{method:"getPreferences",parameters:{appName:"PAYMENT",},},function(b){a(true,b.parameterInfos.value)},function(){a(false)})},getAccountToken:function(a){Mojo.Log.info("**** Trying to get Account Token");Weave.Services.request(this._target,{method:"getAccountToken",parameters:{},},function(b){Mojo.Log.info("**** Got account token");a(true,b.token,b.accountAlias,b.accountState)},function(){a(false)})},notifyAuthenticationFailure:function(a){Weave.Services.request(this._target,{method:"notifyAuthenticationFailure",parameters:{trustedApp:true,},});a(true)},notifyUninstalledApplication:function(b,a,c){Weave.Services.request(this._target,{method:"notifyUninstalledApplication",parameters:{name:b,version:a,},},function(){c(true)},function(){c(false)})},getAccountInfo:function(a){Mojo.Log.info("** Getting account info");Weave.Services.request(this._target,{method:"getAccountInfo",parameters:{}},function(b){a(true,b)},function(){a(false)})},updateAccountInfo:function(a,b){Weave.Services.request(this._target,{method:"updateAccountInfo",parameters:{firstName:a.firstName,lastName:a.lastName,password:a.password,email:a.email,languageCode:a.languageCode,countryCode:a.countryCode}},function(c){b(true,c)},function(){b(false)})},isUserValid:function(b,a,c,d){Weave.Services.request(this._target,{method:"isUserValid",parameters:{email:b,password:a,deviceId:c}},function(e){d(true,e)},function(){d(false)})},getLocale:function(a){Weave.Services.request("palm://com.palm.systemservice",{method:"getPreferences",parameters:{keys:["locale"]},},function(b){a(true,b)},function(){a(false)})},getAllSecurityQuestions:function(a,b){Weave.Services.request(this._target,{method:"getAllSecurityQuestions",parameters:{subscribe:false,locale:a}},function(c){b(true,c)},function(){b(false)})},getAccountSecurityQuestions:function(b,a,c){Weave.Services.request(this._target,{method:"getAccountSecurityQuestion",parameters:{email:b,locale:a}},function(d){c(true,d)},function(){c(false)})},resendVerificationEmail:function(a){Weave.Services.request(this._target,{method:"requestResendVerificationEmail",parameters:{}},function(b){a(true,b)},function(){a(false)})},requestPasswordResetEmail:function(a,b){Weave.Services.request(this._target,{method:"requestPasswordResetEmail",parameters:{email:a,subscribe:false}},function(c){b(true,c)},function(){b(false)})},authenticateAccountFromSecurityQuestion:function(c,a,b,d){Weave.Services.request(this._target,{method:"authenticateAccountFromSecurityQuestion",parameters:{email:c,questionId:a,response:b}},function(e){d(true,e)},function(){d(false)})},changeEmail:function(a,b){Weave.Services.request(this._target,{method:"changeEmail",parameters:{email:a}},function(c){b(true,c)},function(){b(false)})},changePassword:function(d,a,c,f,b,e){Weave.Services.request(this._target,{method:"changePassword",parameters:{newPassword:d,questionId:a,answer:c,idToken:f,isResetPassword:b}},function(g){e(true,g)},function(){e(false)})},authenticateAccount:function(b,a,c){Weave.Services.request(this._target,{method:"authenticateAccount",parameters:{email:b,password:a,application:"ASClient"}},function(d){c(true,d)},function(){c(false)})},isEmailAvailable:function(a,b){Weave.Services.request(this._target,{method:"isEmailAvailable",parameters:{email:a}},function(c){Mojo.Log.info("response:"+Object.toJSON(c));b(true,c)})}};Weave.Services.ApplicationInstaller={_target:"palm://com.palm.appinstaller",validateInstall:function(c,b,e,d){e=(e&&e!=0)?Math.ceil(e/1024):undefined;b=Math.ceil(b/1024);Mojo.Log.info("Weave.Services.ApplicationInstaller.validateInstall appid %s, size %s, uncomprSize %d",c,b,e);var a=this;this._pendingreq=Weave.Services.request(a._target,{method:"queryInstallCapacity",parameters:{appId:c,size:b,uncompressedSize:e,},},function(f){if(f.result==0||f.result==4||PalmSystem.version.match("desktop")){d(true)}else{Mojo.Log.error("Weave.Services.ApplicationInstaller.validateInstall failed %j",f);d(false,f)}},function(f){Mojo.Log.error("Weave.Services.ApplicationInstaller.validateInstall failed %j",f);d(false)})},};Weave.Services.ApplicationManager={_target:"palm://com.palm.applicationManager",getInstalledApplications:function(a){Weave.Services.request(this._target,{method:"listApps",parameters:{},},function(b){var c=b.apps;a(true,!c?[]:Object.isArray(c)?c:[c])},function(){a(false)})},openApplication:function(a,b){Weave.Services.request(this._target,{method:"open",parameters:{id:a,params:b}})},launchApplication:function(a,b){Weave.Services.request(this._target,{method:"launch",parameters:{id:a,params:b}})},launchPointChanges:function(a){Weave.Services.subscriptionRequest(this._target,{method:"launchPointChanges",},function(b){a(true,b)},function(){a(false)})},};Weave.Services.CatalogServer=Class.create({_defaultRetries:3,_defaultCallTimeout:20,$whenReadyServerUrl:function(b){if(this._serverUrl){b()}else{var a=this;Weave.Services.AccountServices.getServerUrl(function(c,d){a._serverUrl=c?d:"error:///";b()})}},$whenReadyServerUrlCarrier:function(b){if(this._serverUrl&&this._carrier){b()}else{var a=this;this.$whenReadyServerUrl(function(){a._carrier&&b()});this._carrier||Weave.Services.Preferences.SystemProperties.getCarrier(function(c,d){a._carrier=c?d:"ROW";a._serverUrl&&b()})}},_whenReadySecurityToken:function(c){var a=this;function b(){return(a._token!=undefined&&a._deviceid!=undefined&&a._email!=undefined&&a._carrier!=undefined)?true:false}if(b()){c()}else{this._token||Weave.Services.AccountServices.getAccountToken(function(d,f,e){Mojo.Log.info("Token:",d,f);a._token=d?f:"ERROR";a._email=d?e:"ERROR";b()&&c()});this._token||Weave.Services.DeviceProfile.getDeviceId(function(d,e){Mojo.Log.info("DeviceId:",e);a._deviceid=d?e:"ERROR";b()&&c()});this._carrier||Weave.Services.Preferences.SystemProperties.getCarrier(function(d,e){Mojo.Log.info("Carrier:",e);a._carrier=d?e:"ROW";b()&&c()})}},getSecurityToken:function(b){var a=this;this._whenReadySecurityToken(function(){b({token:a._token,deviceId:a._deviceid,email:a._email,carrier:a._carrier,})})},invalidateSecurityToken:function(){delete this._token},_callServer:function(d,a,e,b){b=(b==undefined?this._defaultRetries:b);var c=this;this.$whenReadyServerUrl(function(){Mojo.Log.info("ServerURL ready");var f=0;var g=Weave.Services.ConnectionManager.waitForOffline(function(){if(!f++){Mojo.Log.info("Offline");e(false,"offline")}});if(g){Mojo.Log.info("Ajax.Request");new Ajax.Request(c._serverUrl+d,{method:"POST",contentType:"application/json",postBody:Object.toJSON(a),evalJSON:"force",onSuccess:function(h){if(!f++){h=h.responseJSON;if(!h){e(true)}else{var i=h.JSONException;if(i){Mojo.Log.error("CatalogServer._callServer %j",i);e(false,"jsonexception",i)}else{e(true,h)}}}},onFailure:function(h){if(!f++){Mojo.Log.info("onFailure %j",h);if(b<1){if(h.responseJSON&&h.responseJSON.JSONException){e(false,"jsonexception",h.responseJSON.JSONException)}else{e(false,"failure",h.status)}}else{c._callServer(d,a,e,b-1)}}},on0:function(h){if(!f++){Mojo.Log.info("on0 %j",h);if(b<1){Weave.Services.ConnectionManager.getStatus(function(i){e(false,i?"failure":"offline",h.status)})}else{c._callServer(d,a,e,b-1)}}}});(function(){if(!f++){Mojo.Log.info("Timeout");if(b<1){e(false,"timeout")}else{c._callServer(d,a,e,b-1)}}Weave.Services.ConnectionManager.cancelWait(g)}).delay(c._defaultCallTimeout)}})},});Weave.Services.ApplicationServer=new (Class.create(Weave.Services.CatalogServer,{$whenReadyServerUrl:function(b){if(this._serverUrl){b()}else{var a=this;Weave.Services.AccountServices.getServerUrl(function(c,d){a._serverUrl=c?d:"error:///";b()})}},getFeaturedApplications:function(b){var a=this;this.getSecurityToken(function(c){a.$whenReadyServerUrlCarrier(function(){var d={InGetFeaturedAppsV2:{accountTokenInfo:c,carrier:a._carrier,}};a._callServer("featuredApps_ext2",d,function(e,f){if(e){if(f.FeaturedApps){b(true,f.FeaturedApps.palmFeaturedAppList.appSummary,f.FeaturedApps.carrierFeaturedAppList.appSummary,f.FeaturedApps.releaseStatus)}else{b(false,"badformat")}}else{b.apply(null,arguments)}})})})},getCategories:function(b,c){var a=this;this.$whenReadyServerUrlCarrier(function(){var d={InGetCategoryList:{locale:Mojo.Locale.current,categoryId:b||"",}};a._callServer("categoryList",d,function(e,g){Mojo.Log.info("getCategories",e,g);if(e){if(g.OutGetCategoryList==""||g.OutGetCategoryList.categoryList==""){c(true,[],0)}else{if(g.OutGetCategoryList&&g.OutGetCategoryList.categoryList&&g.OutGetCategoryList.categoryList.categoryItems){var f=g.OutGetCategoryList.categoryList.categoryItems;c(true,!f?[]:Object.isArray(f)?f:[f])}else{c(false,"badformat")}}}else{c(false,g)}})})},getApplicationDetails:function(d,c,a,e){var b=this;this.getSecurityToken(function(g){var f={InGetAppDetailV2:{accountTokenInfo:g,appId:d,packageId:c,locale:a,}};b._callServer("appDetail_ext2",f,function(i,j,h){if(i){if(j.OutGetAppDetailV2){e(true,j.OutGetAppDetailV2.appDetail,j.OutGetAppDetailV2.userRating)}else{e(false,"badformat")}}else{if(j=="jsonexception"&&h.errorCodes=="DISC0120"){e(false,"appunavailable",h.message)}else{if(j=="jsonexception"&&b._isAppIncompatibleError(h.errorCodes)){e(false,h.errorCodes)}else{if(j=="jsonexception"&&b._isInvalidTokenError(h.errorCodes)){e(false,"invalidtoken",h.message)}else{e.apply(null,arguments)}}}}})})},getTags:function(b,a,d){var c={InGetTags:{criterion:(a=="popularity"?"APP_COUNT":"TAG_NAME"),limit:b}};this._callServer("getTags",c,function(e,f){if(e){if(f.OutGetTagList){d(true,f.OutGetTagList.tagList.tagItems)}else{d(false,"badformat")}}else{d.apply(null,arguments)}})},searchForApplications:function(f,d,h,e,c,a,g){Mojo.Log.info("*********************************Entered seach for applications***********************");var b=this;this.getSecurityToken(function(l){var m=[];if(f){var n=f.toLowerCase().split(" ");for(var k=0;k<n.length;k++){m.push(n[k]+"*")}}m=m.join(" && ");Mojo.Log.info("********* token *****"+l);var j={InGetAppListV2:{tagName:"",queryStr:m,categoryid:d,startPosition:h,count:e,sort:c,locale:a,accountTokenInfo:l}};Mojo.Log.info("****************************** app List called with token***"+l);b._callServer("appList_ext2",j,function(i,o){if(i){if(o.OutGetAppList){var p=o.OutGetAppList.appList.appSummary;g(true,!p?[]:p.constructor!=Array?[p]:p,o.OutGetAppList.appList.totalCount)}else{g(false,"badformat")}}else{g.apply(null,arguments)}})})},getUserComments:function(c,d,b,e){var a={InGetUserRatings:{appId:c,startPosition:d,count:b,}};this._callServer("getUserRatings",a,function(f,g){if(f){if(g.UserRatingList){var h=g.UserRatingList.ratings;h=(!h?[]:h.constructor!=Array?[h]:h);e(true,h,h.length)}else{if(g.UserRatingList==""){e(true,[],0)}else{e(false,"badformat")}}}else{e.apply(null,arguments)}})},addUserComment:function(g,d,c,f,b,e,a,h){var i=this;this.getSecurityToken(function(j){var k={InAddUserRating:{userRatingItem:{score:Math.round(c),comment:d,accountId:b||"",locale:f,isAnonymous:e,isInappropriate:a,appId:g,},appEntryId:g,accountTokenInfo:j,}};i._callServer("addUserRating",k,function(m,n,l){h.apply(null,arguments)})})},getMyComment:function(b,c){var a=this;this.getSecurityToken(function(d){var e={InGetMyRating:{accountTokenInfo:d,appEntryId:b}};a._callServer("getMyRating",e,function(g,h,f){if(g){if(h&&h.UserRating){c(true,h.UserRating)}else{c(true,null)}}else{if(h=="jsonexception"&&a._isInvalidTokenError(f.errorCodes)){c(false,"invalidtoken",f.message)}else{c.apply(null,arguments)}}})})},getAppListForUpdates:function(a,c){Mojo.Log.info("Weave.Services.ApplicationServer.getAppListForUpdates sending %s",a);var b={InGetUpdatableApps:{packageIds:a}};this._callServer("getListOfUpdatableApps",b,function(e,f,d){if(e){Mojo.Log.info("%j",f);if(f.OutUpdateInfoList==""){c(true,[])}else{if(f.OutUpdateInfoList){var g=f.OutUpdateInfoList.appSummaryForUpdates;c(true,!g?[]:Object.isArray(g)?g:[g])}else{c(false,"badformat")}}}else{c.apply(null,arguments)}})},_isInvalidTokenError:function(a){if(a=="DISC0049"||a=="DISC0050"||a=="DISC0051"){Mojo.Log.error("ApplicationServer._isInvalidTokenError TRUE, error:%s",a);return true}return false},_isAppIncompatibleError:function(a){if(a=="DISC0025"||a=="DISC0124"||a=="DISC0125"||a=="DISC0201"||a=="DISC0202"||a=="DISC0203"){Mojo.Log.error("ApplicationServer.isAppIncompatibleError TRUE, error:%s",a);return true}return false},}));Weave.Services.ApplicationManager.Browser={openPage:function(a){Weave.Services.ApplicationManager.openApplication("com.palm.app.browser",{target:a})},};Weave.Services.ConnectionManager={_target:"palm://com.palm.connectionmanager",_online:undefined,_1x:undefined,_waiting:[],_started:false,_startup:function(b){this._started=true;if(PalmSystem.version.match("desktop")){this._stateChanged(true);b&&b(this._online);b=null}else{var a=this;this._MSMrequest=Weave.Services.request("palm://com.palm.bus/signal",{method:"addmatch",parameters:{category:"/storaged",method:"MSMProgress",subscribe:true}},function(c){a._MSMnotification(c)},function(c){Mojo.Log.error("ConnectionManager._startup MSM subscription request failed %j",c);a._MSMnotification(c)});this._getstatusreq=Weave.Services.request(this._target,{method:"getstatus",parameters:{subscribe:true},},function(c){Mojo.Log.info("ConnectionManager.connectionStatusNotification %j",c);a._1x=c.wan.network=="1x"&&c.wifi.state!="connected";a._stateChanged((c.isInternetConnectionAvailable==true?true:false));b&&b(a._online)},function(){a._stateChanged(false);b&&b(a._online)})}},_MSMnotification:function(a){if(!a){return}Mojo.Log.info("ConnectionManager._MSMnotification %j",a);if(a.stage=="attempting"){Mojo.Log.info("ConnectionManager._MSMnotification: in MSM");this._MSMmodeActive=true;ConnectionWidget.cancel()}},_stateChanged:function(a){if(this._online!=a){this._online=a;var d=this._waiting;this._waiting=[];for(var b=0;b<d.length;b++){var c=d[b];if(c.online===undefined||c.online===a){d[b].callback(a)}else{this._waiting.push(c)}}}if(a==false){this.showConnectionError()}else{this._MSMmodeActive=false;ConnectionWidget.cancel()}},monitor:function(){if(!this._started){this._startup()}},getStatus:function(a){if(this._online===undefined){if(!this._started){this._startup(a)}else{this._waiting.push({online:undefined,callback:a})}}else{a(this._online)}},isOnline:function(){if(this._online===undefined){throw new Error("ConnectionManager is not monitoring status")}else{return this._online}},isOn1x:function(){return this._1x},waitForOnline:function(b){if(this._online===true){b();return undefined}else{var a={online:true,callback:b};this._waiting.push(a);return a}},waitForOffline:function(b){if(this._online===false){b();return undefined}else{var a={online:false,callback:b};this._waiting.push(a);return a}},cancelWait:function(b){var c=this._waiting;for(var a=0;a<c.length;a++){if(c[a]==b){c.splice(a,1);break}}},showConnectionError:function(){if(this._MSMmodeActive){return}var a=Weave.System.Activator.getActiveStageController();if(!a){return}if(!a.isActiveAndHasScenes()){return}Mojo.Log.info("ConnectionManager.showConnectionError");var b={type:"data",onSuccess:function(c){}};ConnectionWidget.connect(b,a)},cleanup:function(){ConnectionWidget.cancel();delete this._MSMrequest;delete this._getstatusreq}};Weave.Services.DeviceProfile={_target:"palm://com.palm.deviceprofile",getDeviceId:function(a){Weave.Services.request(this._target,{method:"getDeviceId",parameters:{},},function(b){a(true,b.deviceId)},function(){a(false)})},getCarrierIdentification:function(a){Weave.Services.request("palm://com.palm.data.carriernetworksettings/",{method:"getCurrentCarrierIdentification",parameters:{},},function(b){a(true,b)},function(){a(false)})}};Weave.Services.AppInstallService={_target:"palm://com.palm.appInstallService",install:function(a,b){Weave.Services.AccountServices.getAccountToken(function(c,d){Weave.Services.DeviceProfile.getDeviceId(function(e,h){var g={catalogId:a.id,id:a.publicApplicationId,title:a.title,version:a.serverVersion,vendor:a.vendor,vendorUrl:a.vendorUrl,iconUrl:a.iconUrl,ipkUrl:a.packageUrl,authToken:d||0,deviceId:h||0,};Mojo.Log.info("Weave.Services.AppInstallService.install payload %j",g);var f=Weave.Services.subscriptionRequest(Weave.Services.AppInstallService._target,{method:"install",parameters:g},function(i){b(true)},function(i){Mojo.Log.error("Weave.Services.AppInstallService.install failed %s, %j",a.publicApplicationId,i);b(false,i)})})})},status:function(c){Mojo.Log.info("Weave.Services.AppInstallService.status");var a=this;var b=Weave.Services.subscriptionRequest(this._target,{method:"status",parameters:{},},function(d){Mojo.Log.info("Weave.Services.AppInstallService.status response %j",d);if(d.status&&d.status.apps){c(true,false,d.status.apps)}else{if(d.id){c(true,true,[d])}}},function(d){Mojo.Log.error("Weave.Services.AppInstallService.status failed %j",d)})},pause:function(b,d){var a=this;var c=Weave.Services.request(this._target,{method:"pause",parameters:{id:b},},function(e){d(true)},function(e){Mojo.Log.error("Weave.Services.AppInstallService.pause failed %s, %j",b,e);d(false,e)})},resume:function(b,d){var a=this;var c=Weave.Services.request(this._target,{method:"resume",parameters:{id:b},},function(e){d(true)},function(e){Mojo.Log.error("Weave.Services.AppInstallService.resume failed %s, %j",b,e);d(false,e)})},cancel:function(b,d){var a=this;var c=Weave.Services.request(this._target,{method:"cancel",parameters:{id:b},},function(e){d(true)},function(e){Mojo.Log.error("Weave.Services.AppInstallService.cancel failed %s, %j",b,e);d(false,e)})},remove:function(b,d){var a=this;var c=Weave.Services.request(this._target,{method:"remove",parameters:{id:b},},function(e){d(true)},function(e){d(false,e);Mojo.Log.error("Weave.Services.AppInstallService.remove failed %s, %j",b,e)})},};Weave.Services.SystemManager={_target:"palm://com.palm.systemmanager",_unlockcount:0,_startup:function(){if(PalmSystem.version.match("desktop")){}else{var a=this;var b=true;this._getstatusreq=Weave.Services.request(this._target,{method:"getLockStatus",parameters:{subscribe:true},},function(c){if(!b){a._unlockcount++}b=false})}},hasScreenLocked:function(a,b){if(!this._getstatusreq){this._startup(undefined,false)}if(a._count==undefined||a._count==this._unlockcount){a.locked=false}else{a.locked=true}a._count=this._unlockcount;b(true,a)},};Weave.Services.Preferences=Weave.Services.Preferences||{};Weave.Services.Preferences.SystemProperties={_target:"palm://com.palm.preferences/systemProperties",getCarrier:function(a){Weave.Services.request(this._target,{method:"Get",parameters:{key:"com.palm.properties.DMCARRIER"},},function(b){a(true,b["com.palm.properties.DMCARRIER"])},function(){a(false)})}};Weave.Services.PaymentServer=new (Class.create(Weave.Services.CatalogServer,{$whenReadyServerUrl:function(b){if(this._serverUrl){b()}else{var a=this;Weave.Services.AccountServices.getPaymentServerUrl(function(c,d){a._serverUrl=c?d:"error:///";b()})}},getCCTypes:function(b){var a=this;this.getSecurityToken(function(d){var c={InGetCCTypes:{authToken:d.token,accountAlias:d.email,deviceId:d.deviceId}};a._callServer("getCCTypes",c,function(f,g,e){if(f){b(true,g)}else{if(g=="jsonexception"){b(false,e)}else{b(false,{errorCode:g})}}})})},verifyPaymentSetup:function(b){var a=this;this.getSecurityToken(function(c){var d={InGetCCPaymentInfos:{authToken:c.token,accountAlias:c.email,deviceId:c.deviceId}};a._callServer("getCCPaymentInfos",d,function(f,g,e){if(f){b(true,g)}else{if(g=="jsonexception"){b(false,e)}else{b(false,{errorCode:g})}}})})},addAccount:function(a,c,d){var b=this;this.getSecurityToken(function(e){c.email=e.email;var f={InAddCCPaymentInfo:{authToken:e.token,accountAlias:e.email,deviceId:e.deviceId,billTo:a,creditCard:c}};b._callServer("addCCPaymentInfo",f,function(h,i,g){if(h){if(i.OutAddCCPaymentInfo){d(true,i)}else{d(false,"badresponse")}}else{if(i=="jsonexception"){d(false,g)}else{d(false,{errorCode:i})}}})})},updateAccount:function(a,c,d){var b=this;this.getSecurityToken(function(e){c.email=e.email;var f={InUpdateCCPaymentInfo:{authToken:e.token,accountAlias:e.email,deviceId:e.deviceId,paymentInfoId:c.paymentInfoId,billTo:a,creditCard:c}};b._callServer("updateCCPaymentInfo",f,function(h,i,g){if(h){if(i.OutUpdateCCPaymentInfo){d(true,i)}else{d(false,"badresponse")}}else{if(i=="jsonexception"){d(false,g)}else{d(false,{errorCode:i})}}})})},removeAccount:function(b,c){var a=this;this.getSecurityToken(function(d){b.email=d.email;var e={InRemoveCCPaymentInfo:{authToken:d.token,accountAlias:d.email,deviceId:d.deviceId,paymentInfoId:b.paymentInfoId}};a._callServer("removeCCPaymentInfo",e,function(g,h,f){if(g){if(h.OutRemoveCCPaymentInfo){c(true,h)}else{c(false,"badresponse")}}else{if(h=="jsonexception"){c(false,f)}else{c(false,{errorCode:h})}}})})},capturePayment:function(c,b){var a=this;this.getSecurityToken(function(d){var e={InCapturePayment:{authToken:d.token,accountAlias:d.email,deviceId:d.deviceId,order:c}};a._callServer("capturePayment",e,function(g,h,f){if(g){if(h.OutCapturePayment){b(true,h)}else{b(false,"badresponse")}}else{if(h=="jsonexception"){b(false,f)}else{b(false,{errorCode:h})}}})})},}));Weave.Utilities.RegExp={escape:function(a){return a.replace(/[-[\]{}()*+?.\\^$|,#\s]/g,"\\$&")}};Weave.Utilities.AppMenu=Class.create({initialize:function(b,a){this._scene=b;this._items=a?a._items:[];if(b){this._oldHandleCommand=b.handleCommand;b.handleCommand=this._handleCommand.bind(this);if(b.controller.setupWidget){b.controller.setupWidget(Mojo.Menu.appMenu,{omitDefaultItems:true,},{items:this._items})}}},addItem:function(b,c,a){this._items.push({label:b,command:"cmd"+this._items.length+1,checkEnabled:(a?true:false),_callback:c,_enabled:a});return this},addEdit:function(){this._items.push(Mojo.Menu.editItem);return this},addHelp:function(b,a){if(b){this._items.push(Object.extend({_callback:function(){Weave.Services.ConnectionManager.getStatus(function(c){Weave.Services.ApplicationManager.openApplication("com.palm.app.help",{target:c?b:"no-network"})})},_enabled:a?a:function(c){c.stopPropagation();return true}},Mojo.Menu.helpItem))}else{this._items.push(Mojo.Menu.helpItem)}return this},addPreferences:function(b,a){if(b){this._items.push(Object.extend({_callback:b,_enabled:a?a:function(c){c.stopPropagation();return true}},Mojo.Menu.prefsItem))}else{this._items.push(Mojo.menu.prefsItem)}return this},_handleCommand:function(b){if(b.type==Mojo.Event.commandEnable){for(var a=0;a<this._items.length;a++){if(this._items[a].command==b.command){if(this._items[a]._enabled&&!this._items[a]._enabled(b)){b.stopPropagation();b.preventDefault()}break}}}else{if(b.type==Mojo.Event.command){for(var a=0;a<this._items.length;a++){if(this._items[a].command==b.command){this._items[a]._callback&&this._items[a]._callback(b);break}}}}this._oldHandleCommand&&this._oldHandleCommand.call(this._scene,b)},});Object.extend(Weave.Utilities.AppMenu,{setDefault:function(a){Weave.Utilities.AppMenu.defaultMenu=a},useDefault:function(a){new Weave.Utilities.AppMenu(a,Weave.Utilities.AppMenu.defaultMenu)}});var Catalog=Catalog||{};Catalog.appStates=Catalog.appStates||new Array();Catalog.appStatesCommon={_1xCarrierDialog:{sprint:{title:$L("No 3G Data Network"),message:$L("You will be unable to receive phone calls while the application is downloading."),choices:[{label:$L("Cancel"),value:"cancel",type:"secondary"},{label:$L("Download"),value:"download",type:"primary"}]},"default":{title:$L("No 3G Data Network"),message:$L("Because no high speed network connection is available, it will take much longer to download this application. You can download the application later for free."),choices:[{label:$L("Download Later"),value:"cancel",type:"secondary"},{label:$L("Download Now"),value:"download",type:"primary"}]},},_verifyPaymentSetup:function(a){if(myProfile.validCC!==undefined){a(true,myProfile.validCC)}else{Weave.Services.PaymentServer.verifyPaymentSetup(function(b,c){if(b){myProfile.validCC=c}a(b,c)})}},_makePurchase:function(c,a,d){if(!Weave.Services.ConnectionManager.isOnline()){d(false);return}var b=Weave.System.Activator.getActiveStageController();if(b&&b.topScene()){b.topScene().showAlertDialog({allowHTMLMessage:true,message:$L("Purchase #{title}?<br/><br/>Your credit card will be charged.").interpolate({title:c.title}),choices:[{label:$L("Purchase"),value:"ok",type:"affirmative"},{label:$L("Cancel"),value:"cancel",type:"dismiss"}],onChoose:function(e){if(e=="ok"){Mojo.Log.info("Catalog.appStatesCommon._makePurchase: purchasing %s, %s",c.title,c.id);var f=c;var g={orderDate:Utilities.UTCDate.shortDate(new Date()),paymentInfoId:a.OutGetCCPaymentInfos.ccPaymentInfos[0].paymentInfoId,currency:f.currency,items:[{type:f.priceType,unitPrice:f.price,quantity:"1",sku:f.sku,skuTitle:f.title,commodityCode:f.paymentCategory,vendorId:f.vendorid,vendorCity:f.vendorCity,vendorRegion:f.vendorRegion,vendorCountry:f.vendorCountry,}],};c.setState("purchasing");Mojo.Log.info("Order Object: %j",g.items[0]);Weave.Services.PaymentServer.capturePayment(g,function(h,i){if(h){Mojo.Log.info("Catalog.appStatesCommon._makePurchase: purchased");c.setState("purchased",{version:c.serverVersion,transitional:true});d(true)}else{Mojo.Log.error("Catalog.appStatesCommon._makePurchase: purchase failed %j",i);var j=i.errorCode?i.errorCode:i;c.setState("purchase_failed",{errorCode:j})}})}else{d(false)}},})}else{d(false)}},_handleVerifyPayment:function(b,a,c){Catalog.appStatesCommon._verifyPaymentSetup(function(d,e){if(d){if(e.OutGetCCPaymentInfos.ccPaymentInfos.length>0){if(!a){var f=Weave.System.Activator.getActiveStageController();if(f&&f.topScene()){f.topScene().showDialog({template:"payment-setup/password-dialog",assistant:new PasswordAssistant(f.topScene().assistant,{appid:b.id,onComplete:function(g){Mojo.Log.info("Catalog.appStatesCommon._handleVerifyPayment password valid: ",g.passwordValid);if(g.passwordValid){Catalog.appStatesCommon._makePurchase(b,e,c)}else{c(false)}}})})}else{c(false)}}else{Catalog.appStatesCommon._makePurchase(b,e,c)}}else{Mojo.Log.info("Catalog.appStatesCommon._handleVerifyPayment no payment set up");var f=Weave.System.Activator.getActiveStageController();if(f){f.pushScene("payment-setup",b.id,function(g){Mojo.Log.info("Catalog.appStatesCommon._handleVerifyPayment payment setup callback ret %j",g);if(g.accountValid){Catalog.appStatesCommon._handleVerifyPayment(b,true,c)}else{c(false)}})}else{c(false)}}}else{c(false);Mojo.Log.error("Error retrieving payment setup");Utilities.Errors.displayError(e.errorCode,{errCode:e.errorCode},"PMT_catchAll_default")}})},_validateRegion:function(b){Mojo.Log.info("Catalog.appStatesCommon._validateRegion uscarrier: ",myProfile.uscarrier);if(b.price>0&&!myProfile.uscarrier){var a=Weave.System.Activator.getActiveStageController();if(a&&a.topScene()){a.topScene().showAlertDialog({title:$L("Sorry, Application Unavailable"),message:$L("This application is not available in your region."),choices:[{label:$L("OK"),value:true,type:"primary"},]})}return false}return true},_handleLocationServices:function(b,c){Mojo.Log.info("Catalog.appStatesCommon._handleLocationServices app.islocationbased",b.islocationbased);if(b.islocationbased){var a=Weave.System.Activator.getActiveStageController();if(a&&a.topScene()){a.topScene().showAlertDialog({onChoose:function(d){if(d=="continue"){c(true)}else{c(false)}},title:$L("Location Services"),message:$L("This application will request your current location for some functions."),choices:[{label:$L("Don't Download"),value:"cancel",type:"dismiss"},{label:$L("Continue"),value:"continue",type:"affirmative"}]})}else{c(false)}}else{c(true)}},validateInstallSpace:function(b,a,c){Mojo.Log.info("Catalog.appStatesCommon.validateInstallSpace");Weave.Services.ApplicationInstaller.validateInstall(b.publicApplicationId,b.packageSize,b.installSize,function(d,e){if(d==true){c(true)}else{Mojo.assert(e&&e.spaceNeededInKB,"Catalog.appStatesCommon.validateInstallSpace validateInstall failed but spaceNeededInKB is not defined");var f;if(e&&e.spaceNeededInKB){f=parseInt(e.spaceNeededInKB);f=f>=1024?Math.ceil((f/1024)*100)/100+"M":f+"K"}else{f=$L("unknown MB")}Utilities.Errors.displayError("dummy",{installSize:f},a,null,null,function(g){if(g=="help"){Weave.Services.ConnectionManager.getStatus(function(h){Weave.Services.ApplicationManager.openApplication("com.palm.app.help",{target:h?"http://help.palm.com/basics/manage_applications/basics_delete_app_from_launcher.html":"no-network"})})}});c(false)}})},validateDownloadConnection:function(c){if(Weave.Services.ConnectionManager.isOn1x()){Mojo.Log.info("Catalog.appStatesCommon.validateDownloadConnection connection is 1x");if(Catalog.AppDownloadMngr.canAllow1xDownload()){Mojo.Log.info("Catalog.appStatesCommon.validateDownloadConnection canAllow1xDownload == true");c(true)}else{Mojo.Log.info("Catalog.appStatesCommon.validateDownloadConnection prompt user for 1x permission");var a=Weave.System.Activator.getActiveStageController();if(a&&a.topScene()){var b=Catalog.appStatesCommon._1xCarrierDialog[myProfile.carrierName];if(!b){b=Catalog.appStatesCommon._1xCarrierDialog["default"]}a.topScene().showAlertDialog({onChoose:function(d){if(d=="cancel"){c(false)}else{if(d=="download"){Catalog.AppDownloadMngr.allow1xDownload(true,function(e){Mojo.Log.info("Catalog.appStatesCommon.validateDownloadConnection allow1xDownload returned status %s",e);c(e)})}}},title:b.title,message:b.message,choices:b.choices})}else{c(false)}}}else{if(Weave.Services.ConnectionManager.isOnline()){c(true)}else{c(false)}}},_install:function(a){Catalog.appStatesCommon.validateDownloadConnection(function(b){var c=a.stateToString();if(b){a.setState("fake progress");Mojo.Log.info("Catalog.appStatesCommon._install: ",a.publicApplicationId);Weave.Services.AppInstallService.install(a,function(d,e){if(!d){Mojo.Log.error("Catalog.appStatesCommon._install failed %s: %j, returing to state %s",a.publicApplicationId,e,c);if(a.stateToString()=="fake progress"){a.setState(c)}}})}})},_pause:function(b){var a=b.stateToString();b.setState("pausing");Mojo.Log.info("Catalog.appStatesCommon._pause: ",b.publicApplicationId);Weave.Services.AppInstallService.pause(b.publicApplicationId,function(c,d){if(!c){Mojo.Log.error("Catalog.appStatesCommon._pause failed %s, %j, returing to state %s",b.publicApplicationId,d,a);if(b.stateToString()=="pausing"){b.setState(a)}}})},_resume:function(a){Catalog.appStatesCommon.validateDownloadConnection(function(b){if(b){var c=a.stateToString();a.setState("resuming");Mojo.Log.info("Catalog.appStatesCommon._resume: ",a.publicApplicationId);Weave.Services.AppInstallService.resume(a.publicApplicationId,function(d,e){if(!d){Mojo.Log.error("Catalog.appStatesCommon._resume failed %s, %j, returing to state %s",a.publicApplicationId,e,c);if(a.stateToString()=="resuming"){a.setState(c)}}})}})},_cancel:function(b){var a=b.stateToString();b.setState("canceling");Mojo.Log.info("Catalog.appStatesCommon._cancel: ",b.publicApplicationId);Weave.Services.AppInstallService.cancel(b.publicApplicationId,function(c,d){if(!c){Mojo.Log.error("Catalog.appStatesCommon._cancel failed %s, %j, returing to state %s",b.publicApplicationId,d,a);if(b.stateToString()=="canceling"){b.setState(a)}}})},_uninstall:function(b){var a=b.stateToString();b.setState("removing");Mojo.Log.info("Catalog.appStatesCommon._uninstall: ",b.publicApplicationId);Weave.Services.AppInstallService.remove(b.publicApplicationId,function(c,d){if(!c){Mojo.Log.error("Catalog.appStatesCommon._uninstall failed %s, %j, returing to state %s",b.publicApplicationId,d,a);if(b.stateToString()=="removing"){b.setState(a)}}})},_reset:function(a){if(a.installedVersion){if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}}else{if(a.price&&a.price>0){a.setState("purchased")}else{a.setState("download")}}},_remove:function(a){a.installedVersion=null;a.icon=null;if(a.price&&a.price>0){a.setState("purchased")}else{a.setState("download")}},};Catalog.appStates.dummy={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="none";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Getting data...");b.disabledClass=null;b.updateClass=null;b.activeClass=null;b.resumeClass=null;b.pauseClass=null;b.warningClass=null},updateFromServer:function(a){this._update(a)},updateFromInstalledAppsList:function(a){this._update(a)},_update:function(b){var a="download";if(b.purchasedVersion){a="purchased"}if(b.installedVersion){a="installed";if(b.serverVersion&&Utilities.VersionCheck.compare(b.installedVersion,b.serverVersion)==-1){a="installed update available"}}b.setState(a)},toString:function(){return"dummy"}};Catalog.appStates["fake progress"]={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="action-icon";a._progressPillModel.image="images/download-icon.png";a._progressPillModel.title=$L("Downloading...");a._progressPillModel.value=0;a.disabledClass="disabled";a.updateClass=null;a.activeClass="active";a.resumeClass=null;a.pauseClass=null;a.warningClass=null},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"fake progress"}};Catalog.appStates.pausing={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="none";a._progressPillModel.image=undefined;a._progressPillModel.title=$L("Pausing...");a.disabledClass="disabled"},_allowTransition:function(a){if(a=="download progress"){return false}return true},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"pausing"}};Catalog.appStates.resuming={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="none";a._progressPillModel.image=undefined;a._progressPillModel.title=$L("Resuming...");a.disabledClass="disabled"},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"resuming"}};Catalog.appStates.removing={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="none";a._progressPillModel.image=undefined;a._progressPillModel.title=$L("Deleting...");a._progressPillModel.value=1;a.disabledClass="disabled";a.updateClass=null;a.activeClass=null;a.resumeClass=null;a.pauseClass=null;a.warningClass=null},_allowTransition:function(a){if(a=="download progress"){return false}return true},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"removing"}};Catalog.appStates.canceling={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="none";a._progressPillModel.image=undefined;a._progressPillModel.title=$L("Canceling...");a.disabledClass="disabled"},_allowTransition:function(a){if(a=="download progress"){return false}return true},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"canceling"}};Catalog.appStates.download={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="download-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Download for #{price}").interpolate({price:b.getFormattedPrice()});b.progress=0;b.disabledClass=null;b.updateClass=null;b.activeClass=null;b.resumeClass=null;b.pauseClass=null;b.warningClass=null},updateFromInstalledAppsList:function(a){if(a.installedVersion){if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}}},updateFromServer:function(b){var a="download";if(b.purchasedVersion){a="purchased"}if(b.installedVersion){a="installed";if(Utilities.VersionCheck.compare(b.installedVersion,b.serverVersion)==-1){a="installed update available"}}b.setState(a)},removeFromMyApps:function(){return true},defaultAction:function(a){a.install()},install:function(a){if(Catalog.appStatesCommon._validateRegion(a)){Catalog.appStatesCommon._handleLocationServices(a,function(b){if(b){Catalog.appStatesCommon.validateInstallSpace(a,"validate_space_default_single",function(c){if(c){Catalog.appStatesCommon.validateDownloadConnection(function(d){if(d){if(a.price>0){Catalog.appStatesCommon._handleVerifyPayment(a,!Preferences.isLoginTimedOut(),function(e){Mojo.Log.info("Catalog.appStates[download].download _handleVerifyPayment returned");if(e){Mojo.Log.info("Catalog.appStates[download].download _handleVerifyPayment status=true download app");Catalog.appStatesCommon._install(a)}else{a.setState("download")}})}else{Catalog.appStatesCommon._install(a)}}else{a.setState("download")}})}else{a.setState("download")}})}else{a.setState("download")}})}else{a.setState("download")}},toString:function(){return"download"}};Catalog.appStates["download progress"]={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="action-icon";b._progressPillModel.image="images/download-icon.png";b._progressPillModel.title=$L("Downloading...");b._progressPillModel.value=b.progress/100;b.disabledClass=null;b.updateClass=null;b.activeClass="active";b.resumeClass=null;b.pauseClass="show";b.warningClass=null},updateFromServer:function(a){a.setState("download progress")},updateFromInstalledAppsList:function(a){a.setState("download progress")},defaultAction:function(a){this.pauseDownload(a)},myAppsDefaultAction:function(a){this.pauseDownload(a)},pauseDownload:function(a){Catalog.appStatesCommon._pause(a)},cancelDownload:function(a){Catalog.appStatesCommon._cancel(a)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"download progress"}};Catalog.appStates.paused={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="none";b._progressPillModel.value=b.progress/100;b._progressPillModel.image=undefined;b._progressPillModel.title=$L("Download paused");b.disabledClass=null;b.updateClass=null;b.activeClass="active";b.resumeClass="show";b.pauseClass=null;b.warningClass=null},updateFromServer:function(a){a.setState("paused")},updateFromInstalledAppsList:function(a){a.setState("paused")},myAppsDefaultAction:function(a){a.resumeDownload()},defaultAction:function(a){a.resumeDownload()},resumeDownload:function(a){Catalog.appStatesCommon._resume(a)},cancelPausedDownload:function(a){Mojo.Log.info("Catalog.appStates.paused.cancelPausedDownload");Catalog.appStatesCommon._cancel(a)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"paused"}};Catalog.appStates["download failed"]={init:function(a){Mojo.Log.error("Catalog.download failed.init error: ",a.errorCode);a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="failed-app-icon";a._progressPillModel.image=undefined;a._progressPillModel.value=undefined;a._progressPillModel.title=$L("Download failed");a.progress=0;a.disabledClass=null;a.updateClass=null;a.activeClass="warning";a.resumeClass=null;a.pauseClass=null;a.warningClass="show"},updateFromServer:function(a){a.setState("download failed")},updateFromInstalledAppsList:function(a){a.setState("download failed")},defaultAction:function(a){this._defaultAction(a)},myAppsDefaultAction:function(a){this._defaultAction(a)},_defaultAction:function(a){Utilities.Errors.displayError(a.errorCode,{errCode:a.errorCode},"download_default",null,null,function(b){if(b=="retry"){a.install()}else{if(b=="cancel"){Catalog.appStatesCommon._cancel(a)}}})},cancelDownload:function(a){Catalog.appStatesCommon._cancel(a)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},install:function(b){var a=b.stateToString();b.setState("fake progress");Weave.Services.ApplicationServer.getApplicationDetails(b.id,b.publicApplicationId,Mojo.Locale.getCurrentLocale(),function(c,d){if(c){Mojo.Log.info("DownloadStates.download failed.getDetailsFromServer details %j",d);b.updateFromServer(d);Catalog.appStatesCommon.validateInstallSpace(b,"validate_space_default_single",function(e){if(e){Catalog.appStatesCommon.validateDownloadConnection(function(f){if(f){Mojo.Log.info("DownloadStates.download failed install: ",b.publicApplicationId);Weave.Services.AppInstallService.install(b,function(g,h){if(!g){Mojo.Log.error("DownloadStates.download failed: install failed %s: %j",b.publicApplicationId,h);if(b.stateToString()=="fake progress"){b.setState(a)}}})}else{b.setState(a)}})}else{b.setState(a)}})}else{Mojo.Log.error("DownloadStates.download failed.getDetailsFromServer failed to get details from the server error: ",d);b.setState(a);Utilities.Errors.displayError(d)}})},saveToMyApps:function(){return true},toString:function(){return"download failed"}};Catalog.appStates.purchasing={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="none";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Purchasing...")},toString:function(){return"purchasing"}};Catalog.appStates.purchased={init:function(b,a){if(!a||(a&&!a.transitional)){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="download-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Download for free")}b.progress=0;if(a&&a.version){b.purchasedVersion=a.version}},updateFromServer:function(a){},updateFromInstalledAppsList:function(a){if(a.installedVersion){if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}}},removeFromMyApps:function(){return true},defaultAction:function(a){a.install()},install:function(a){Catalog.appStatesCommon.validateInstallSpace(a,"validate_space_default_single",function(b){if(b){Catalog.appStatesCommon._install(a)}})},toString:function(){return"purchased"}};Catalog.appStates.purchase_failed={init:function(b,a){Mojo.Log.error("Catalog.purchase_failed.init %j",a);b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="failed-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Purchase failed");if(a){b.errorCode=a.errorCode.toString();Mojo.Log.error("Catalog.appStates[purchase_failed].init error: %s",b.errorCode)}},updateFromServer:function(a){},defaultAction:function(b){var a=this;Utilities.Errors.displayError(b.errorCode,{errCode:b.errorCode},"PMT_purchase_default",null,null,function(c){if(c){a._reset(b)}})},_reset:function(a){a.setState("download")},_remove:function(a){a.setState("download")},toString:function(){return"purchase_failed"}};Catalog.appStates.installing={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="none";b._progressPillModel.image=undefined;b._progressPillModel.value=1;b._progressPillModel.title=$L("Installing...");b.progress=100;b.disabledClass=null;b.updateClass=null;b.activeClass="active";b.resumeClass=null;b.pauseClass=null;b.warningClass=null},updateFromInstalledAppsList:function(a){a.setState("installing")},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},saveToMyApps:function(){return true},toString:function(){return"installing"}};Catalog.appStates.installed={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="launch-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Tap to launch");Mojo.Log.info("Catalog.appStates[installed].init installedVersion=%s",b.installedVersion);b.disabledClass=null;b.updateClass=null;b.activeClass=null;b.resumeClass=null;b.pauseClass=null;b.warningClass=null},updateFromServer:function(a){this._update(a)},updateFromServerUpdatesList:function(a){this._update(a)},_update:function(a){Mojo.assert(a.installedVersion,"ERROR: app.installedVersion undefined when app is in installed state");if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}},saveToMyApps:function(){return true},defaultAction:function(a){a.launch()},launch:function(a){Weave.Services.ApplicationManager.openApplication(a.publicApplicationId)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},toString:function(){return"installed"}};Catalog.appStates["installed update available"]={init:function(b,a){b._progressPillModel.titleRight=undefined;b._progressPillModel.icon="update-app-icon";b._progressPillModel.image=undefined;b._progressPillModel.value=undefined;b._progressPillModel.title=$L("Update Available");b.disabledClass=null;b.updateClass="update";b.activeClass=null;b.resumeClass=null;b.pauseClass=null;b.warningClass=null},saveToMyApps:function(){return true},defaultAction:function(a){a.install()},myAppsDefaultAction:function(a){a.install()},install:function(a){Catalog.appStatesCommon.validateInstallSpace(a,"validate_space_default_single",function(b){if(b){Catalog.appStatesCommon._install(a)}else{a.setState("installed update available")}})},installUpdate:function(b){var a=b.stateToString();b.setState("fake progress");Mojo.Log.info("Catalog.installed update available.installUpdate: ",b.publicApplicationId);Weave.Services.AppInstallService.install(b,function(c,d){if(!c){Mojo.Log.error("Catalog.installed update available.installUpdate failed %s: %j, returing to state %s",b.publicApplicationId,d,a);if(b.stateToString()=="fake progress"){b.setState(a)}}})},updateFromInstalledAppsList:function(a){this._update(a)},updateFromServerUpdatesList:function(a){this._update(a)},_update:function(a){Mojo.assert(a.installedVersion,"ERROR: app.installedVersion undefined when app is in installed state");if(a.serverVersion&&Utilities.VersionCheck.compare(a.installedVersion,a.serverVersion)==-1){a.setState("installed update available")}else{a.setState("installed")}},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},toString:function(){return"installed update available"}};Catalog.appStates["install failed"]={init:function(a){a._progressPillModel.titleRight=undefined;a._progressPillModel.icon="failed-app-icon";a._progressPillModel.image=undefined;a._progressPillModel.value=undefined;a._progressPillModel.title=$L("Install failed");Mojo.Log.error("Catalog.appStates[install failed].init error: %s",a.errorCode);a.disabledClass=null;a.updateClass=null;a.activeClass="warning";a.resumeClass=null;a.pauseClass=null;a.warningClass="show"},updateFromServer:function(a){},updateFromInstalledAppsList:function(a){a.setState("install failed")},defaultAction:function(a){this._defaultAction(a)},myAppsDefaultAction:function(a){this._defaultAction(a)},_defaultAction:function(b){var a;if(b.installSize){a=(b.installSize/(1024*1024))+1;a=(Math.ceil(a*100)/100)+"M"}else{a=$L("unknown MB")}Utilities.Errors.displayError(b.errorCode,{installSize:a},"install_default",null,null,function(c){if(c=="retry"){b.install()}else{if(c=="cancel"){Catalog.appStatesCommon._cancel(b)}else{if(c=="help"){Weave.Services.ConnectionManager.getStatus(function(d){Weave.Services.ApplicationManager.openApplication("com.palm.app.help",{target:d?"http://help.palm.com/basics/manage_applications/basics_delete_app_from_launcher.html":"no-network"})})}}}})},cancelDownload:function(a){Catalog.appStatesCommon._cancel(a)},uninstall:function(a){Catalog.appStatesCommon._uninstall(a)},_reset:function(a){Catalog.appStatesCommon._reset(a)},_remove:function(a){Catalog.appStatesCommon._remove(a)},install:function(b){var a=b.stateToString();b.setState("fake progress");Weave.Services.ApplicationServer.getApplicationDetails(b.id,b.publicApplicationId,Mojo.Locale.getCurrentLocale(),function(c,d){if(c){Mojo.Log.info("DownloadStates.install failed.getDetailsFromServer details %j",d);b.updateFromServer(d);Catalog.appStatesCommon.validateInstallSpace(b,"validate_space_default_single",function(e){if(e){Catalog.appStatesCommon.validateDownloadConnection(function(f){if(f){Mojo.Log.info("DownloadStates.install failed install: ",b.publicApplicationId);Weave.Services.AppInstallService.install(b,function(g,h){if(!g){Mojo.Log.error("DownloadStates.install failed: install failed %s: %j",b.publicApplicationId,h);if(b.stateToString()=="fake progress"){b.setState(a)}}})}else{b.setState(a)}})}else{b.setState(a)}})}else{Mojo.Log.error("DownloadStates.install failed.getDetailsFromServer failed to get details from the server error: ",d);b.setState(a);Utilities.Errors.displayError(d)}})},saveToMyApps:function(){return true},toString:function(){return"install failed"}};var AppDetails=Class.create({initialize:function(b,a){this._observers=new Array();this._appid=b;this._packageid=a;this._details=null;this._error=null;this._myRating=null},getDetailsFromServer:function(){var a=this;Weave.Services.ApplicationServer.getApplicationDetails(this._appid,this._packageid,Mojo.Locale.getCurrentLocale(),function(b,c,d){if(b){Mojo.Log.info("AppDetails.getDetailsFromServer details %j, myrating %j",c,d);a._setError(null);a._setDetails(c);a.getMyCommentFromServer()}else{Mojo.Log.error("AppDetails.getDetailsFromServer failed to get details from the server error: ",c);a._setError(c);a._setMyRating(null);a._setDetails(null);Utilities.Errors.displayError(c)}})},getMyCommentFromServer:function(){if(!this._details){return}var a=this;Weave.Services.ApplicationServer.getMyComment(this._details.id,function(c,b){if(c&&b){a._setMyRating(b)}})},_setDetails:function(b){if(b){this._appid=b.id;this._packageid=b.publicApplicationId}this._details=b;for(var a=0;a<this._observers.length;a++){if(this._observers[a].updateDetails){this._observers[a].updateDetails(this)}}},getDetails:function(){return this._details},_setMyRating:function(b){this._myRating=b?b:null;for(var a=0;a<this._observers.length;a++){if(this._observers[a].updateMyRating){this._observers[a].updateMyRating()}}},getMyRating:function(){return this._myRating},_setError:function(a){this._error=a},getError:function(){return this._error},getProgramType:function(){return this._details!=null?this._details.programType:null},attach:function(a){this._observers.push(a)},detach:function(a){for(var b=0;b<this._observers.length;b++){if(this._observers[b]===a){this._observers.splice(b,1)}}},});var AppDownload=Class.create({_defaultState:"dummy",initialize:function(){this._observers=new Array();this._progressPillModel={};this._setState(this._defaultState)},updateFromServer:function(b){var a={id:b.id,publicApplicationId:b.publicApplicationId,title:b.title,iconUrl:b.appIcon,purchasedVersion:b.purchasedVersion,serverVersion:b.version,packageSize:b.appSize,installSize:b.installSize,currency:b.currency,priceType:b.priceType,price:b.price,sku:b.sku,paymentCategory:b.paymentCategory,vendor:b.creator,vendorid:b.vendorid,vendorUrl:b.homeURL,vendorCity:b.vendorCity,vendorRegion:b.vendorRegion,vendorCountry:b.vendorCountry,islocationbased:b.islocationbased,packageUrl:b.appLocation,};Object.extend(this,a);Mojo.Log.info("AppDownload.updateFromServer updated: details %j",a);if(this._state.updateFromServer){this._state.updateFromServer(this)}},updateFromInstalledAppsList:function(b){var a={publicApplicationId:b.id,title:b.title,installedVersion:b.version,icon:b.icon?b.icon:this.icon,};Object.extend(this,a);Mojo.Log.info("AppDownload.updateFromInstalledAppsList updated: %s",this.toString());if(this._state.updateFromInstalledAppsList){this._state.updateFromInstalledAppsList(this)}},updateFromServerUpdatesList:function(b){var a={id:b.id,serverVersion:b.appVersion,packageUrl:b.packageUrl,vendor:b.vendor,vendorUrl:b.homeURL,iconUrl:b.appIcon,packageSize:b.appSize,installSize:b.installSize,};Object.extend(this,a);Mojo.Log.info("AppDownload.updateFromServerUpdatesList updated %s, from details: %j",this.toString(),a);if(this._state.updateFromServerUpdatesList){this._state.updateFromServerUpdatesList(this)}},updateFromInstallNotification:function(b){if(b.change=="added"||(b.change=="updated"&&b.version&&this.installedVersion!=b.version)){var a={installedVersion:b.version,icon:b.icon};Object.extend(this,a);this.setState("installed");Mojo.Log.info("AppDownload.updateFromInstallNotification changeDetails: %j, app: %s",b,this.toString())}else{if(b.change=="removed"){if(this._state._remove){this._state._remove(this)}Mojo.Log.info("AppDownload.updateFromInstallNotification removed: %s",this.toString())}}},updateFromStatus:function(d,b){var c=b.state;Mojo.Log.info("AppDownload.updateFromStatus newState: %s",c);if(c=="removing"||c=="unknown"||c=="removed"||c=="installed"){return}if(c=="icon download complete"||c=="icon download current"){b.progress=0;c="download progress"}if(c=="ipk download complete"){b.progress=100}if(c=="ipk download current"||c=="ipk download complete"){c="download progress"}else{if(c=="icon download paused"||c=="ipk download paused"){c="paused"}}if(c=="install failed"){this.errorCode=b.reason}else{if(c=="download failed"){this.errorCode=b.errorCode.toString()}else{this.errorCode=b.errorCode}}var a={publicApplicationId:d,title:b.title,progress:b.progress,serverVersion:b.version,vendor:b.vendor,vendorUrl:b.vendorUrl,icon:this.icon?this.icon:b.icon,};Object.extend(this,a);Mojo.Log.info("AppDownload.updateFromStatus updated: %s, from details %j",this.toString(),a);if(c=="canceled"||c=="remove failed"){if(this._state._reset){this._state._reset(this)}}else{if(this._state._allowTransition&&!this._state._allowTransition(c)){Mojo.Log.info("AppDownload.updateFromStatus disallow transition from %s to %s",this.stateToString(),c);return}Mojo.Log.info("AppDownload.updateFromStatus setting to state: %s",c);this.setState(c)}},setState:function(c,a){Mojo.Log.info("AppDownload.setState %s",c);this._setState(c,a);for(var b=0;b<this._observers.length;b++){if(this._observers[b].updateDownloadState){this._observers[b].updateDownloadState(this)}}},_setState:function(b,a){this._state=Catalog.appStates[b];this._state.init(this,a)},getProgressPillModel:function(){Mojo.Log.info("AppDownload.getProgressPillModel %j",this._progressPillModel);return this._progressPillModel},getFormattedPrice:function(){return parseFloat(this.price)!=this.price?this.price:this.price===0?$L("free"):Mojo.Format.formatCurrency(this.price,{fractionDigits:2})},attach:function(a){this._observers.push(a)},detach:function(a){Mojo.Log.info("AppDownload.detach");for(var b=0;b<this._observers.length;b++){if(this._observers[b]===a){this._observers.splice(b,1);Mojo.Log.info("AppDownload.detach removed observer, left %d",this._observers.length)}}},install:function(){if(this._state.install){this._state.install(this)}},installUpdate:function(){Mojo.Log.info("AppDownload.installUpdate ",this.publicApplicationId);if(this._state.installUpdate){this._state.installUpdate(this)}},canInstallUpdate:function(){if(this._state.installUpdate){return true}else{return false}},cancelDownload:function(){if(this._state.cancelDownload){this._state.cancelDownload(this)}},pauseDownload:function(){if(this._state.pauseDownload){this._state.pauseDownload(this)}},cancelPausedDownload:function(){if(this._state.cancelPausedDownload){this._state.cancelPausedDownload(this)}},resumeDownload:function(){if(this._state.resumeDownload){this._state.resumeDownload(this)}},launch:function(){if(this._state.launch){this._state.launch(this)}},uninstall:function(){if(this._state.uninstall){this._state.uninstall(this)}},defaultAction:function(){if(this._state.defaultAction){this._state.defaultAction(this)}},myAppsDefaultAction:function(){if(this._state.myAppsDefaultAction){this._state.myAppsDefaultAction(this)}},isInstalled:function(){var a=Catalog.AppDownloadMngr.getInstalledApp(this.publicApplicationId);if(a){return true}return false},stateToString:function(){return this._state.toString()},toString:function(){return"id:"+this.id+", publicApplicationId:"+this.publicApplicationId+", state:"+this.stateToString()+", title:"+this.title+", serverVersion:"+this.serverVersion+", installedVersion:"+this.installedVersion+", purchasedVersion:"+this.purchasedVersion+", errorCode:"+this.errorCode+", icon:"+this.icon+", updateClass:"+this.updateClass+", activeClass:"+this.activeClass+", resumeClass:"+this.resumeClass+", pauseClass:"+this.pauseClass+" warningClass:"+this.warningClass+", packageSize:"+this.packageSize+" installSize: "+this.installSize},saveToMyApps:function(){if(this._state.saveToMyApps){return this._state.saveToMyApps()}return false},removeFromMyApps:function(){Mojo.Log.info("AppDownload.removeFromMyApps");if(this._state.removeFromMyApps){return this._state.removeFromMyApps()}return false},});var AppDownloadManager=Class.create({APP_ADDED:0,APP_DELETED:1,APP_UPDATED:2,MYAPPS_ALL:3,initialize:function(){this._myApps=new Object();this._activeQueue=new Object();this._observers=new Array();this._allow1xDownload=false;this._myAppsListIsReady=2;this._appInstallerService=new Mojo.Service.Request("palm://com.palm.bus/signal",{method:"registerServerStatus",parameters:{serviceName:"com.palm.appInstallService"},onSuccess:this._appInstallerServiceSignalCB.bind(this)});this._appManagerService=new Mojo.Service.Request("palm://com.palm.bus/signal",{method:"registerServerStatus",parameters:{serviceName:"com.palm.applicationManager"},onSuccess:this._appManagerServiceSignalCB.bind(this)});this._downloadManagerService=new Mojo.Service.Request("palm://com.palm.bus/signal",{method:"registerServerStatus",parameters:{serviceName:"com.palm.downloadmanager"},onSuccess:this._appDownloadServiceSignalCB.bind(this)})},start:function(){Mojo.Log.info("AppDownloadManager.start");this._myApps=new Object();this._myAppsListIsReady=2;this._getInstalledApps();Weave.Services.AppInstallService.status(this._appInstallServiceStatusCB.bind(this))},_appInstallerServiceSignalCB:function(a){if(a.connected==true){Mojo.Log.info("AppDownloadManager._appInstallerServiceSignal is back on the bus, starting");this.start()}else{if(a.connected==false){Mojo.Log.error("AppDownloadManager._appInstallerServiceSignal is gone from the bus")}}},_appManagerServiceSignalCB:function(c){if(c.connected==true){var b=this;var a=function(d,e){Mojo.Log.info("AppDownloadManager.launchPointChanges callback %j",e);b._updateInstalledQueue(e)};Weave.Services.ApplicationManager.launchPointChanges(a)}else{if(c.connected==false){Mojo.Log.error("AppDownloadManager._appManagerServiceSignalCB is gone from the bus")}}},_appDownloadServiceSignalCB:function(a){if(a.connected==true){if(this._allow1xDownload){this.allow1xDownload(true)}}else{if(a.connected==false){Mojo.Log.error("AppDownloadManager._appDownloadServiceSignalCB is gone from the bus")}}},_getInstalledApps:function(){var a=this;Weave.Services.ApplicationManager.getInstalledApplications(function(b,d){var d=b?d:[];for(var c=0;c<d.length;c++){if(d[c].userInstalled){Mojo.Log.info("AppDownloadManager._getInstalledApps installed app: %j",d[c]);var e=a.getAppDownload(d[c].id);e.updateFromInstalledAppsList(d[c])}}a._sendMyAppsListIsReady();Mojo.Log.info("AppDownloadManager._getInstalledApps sending updateInstalledApps");for(var c=0;c<a._observers.length;c++){if(a._observers[c].updateInstalledApps){a._observers[c].updateInstalledApps()}}})},myAppsListIsReady:function(){return(this._myAppsListIsReady==0)},_sendMyAppsListIsReady:function(){this._myAppsListIsReady--;if(this._myAppsListIsReady==0){for(var a=0;a<this._observers.length;a++){if(this._observers[a].updateMyApps){this._observers[a].updateMyApps(null,this.MYAPPS_ALL)}}}},getAppDownload:function(b,a){var c=this._myApps[b];if(!c){c=this._activeQueue[b]}if(!c){Mojo.Log.info("AppDownloadManager.getAppDownload creating new with id %s",b);c=new AppDownload();c.attach(this);this._activeQueue[b]=c}if(a){c.attach(a)}return c},releaseAppDownload:function(b,a){var c=this._myApps[b];if(!c){c=this._activeQueue[b]}c.detach(a);if(c==this._activeQueue[b]&&c._observers.length==1){Mojo.Log.info("AppDownloadManager.releaseAppDownload deleting from activeQueue %s",b);delete this._activeQueue[b]}},_updateInstalledQueue:function(c){Mojo.Log.info("AppDownloadManager._updateInstalledQueue updateReason: %j",c);if(c&&(c.change=="added"||c.change=="removed"||c.change=="updated")){var d=this._myApps[c.id];if(d){d.updateFromInstallNotification(c);var a=this;var b=function(){Mojo.Log.info("AppDownloadManager._updateInstalledQueue sending updateInstalledApps");for(var e=0;e<a._observers.length;e++){if(a._observers[e].updateInstalledApps){a._observers[e].updateInstalledApps()}}};b.delay(2)}}},getInstalledApp:function(b){var a=this._myApps[b];if(a&&a.installedVersion){return a}return null},getMyApps:function(){return this._myApps},attach:function(a){this._observers.push(a)},detach:function(a){Mojo.Log.info("AppDownloadManager.detach");for(var b=0;b<this._observers.length;b++){if(this._observers[b]===a){this._observers.splice(b,1);Mojo.Log.info("AppDownloadManager.detach removed observer, left %d",this._observers.length)}}},updateDownloadState:function(c){Mojo.Log.info("AppDownloadManager.updateDownloadState ",c.publicApplicationId,c.stateToString());Mojo.Log.info("AppDownloadManager.updateDownloadState this._myApps[%s]: %s",c.publicApplicationId,this._myApps[c.publicApplicationId]);var a=null;if(c.saveToMyApps()&&!this._myApps[c.publicApplicationId]){Mojo.Log.info("AppDownloadManager.updateDownloadState APP_ADDED ",c.publicApplicationId,c.stateToString());this._myApps[c.publicApplicationId]=c;a=this.APP_ADDED;Mojo.assert(this._activeQueue[c.publicApplicationId],"AppDownloadManager.updateDownloadState added to MyApps but app wasn't in the activeQ");delete this._activeQueue[c.publicApplicationId]}else{if(c.removeFromMyApps()&&this._myApps[c.publicApplicationId]){Mojo.Log.info("AppDownloadManager.updateDownloadState APP_DELETED ",c.publicApplicationId,c.stateToString());delete this._myApps[c.publicApplicationId];a=this.APP_DELETED;if(c._observers.length>1){this._activeQueue[c.publicApplicationId]=c}}else{if(this._myApps[c.publicApplicationId]){Mojo.Log.info("AppDownloadManager.updateDownloadState APP_UPDATED ",c.publicApplicationId,c.stateToString());a=this.APP_UPDATED}}}if(a!=null){for(var b=0;b<this._observers.length;b++){if(this._observers[b].updateMyApps){this._observers[b].updateMyApps(c,a)}}}},_appInstallServiceStatusCB:function(a,c,d){Mojo.Log.info("AppDownloadManager._appInstallServiceStatusCB singleUpdate:%s, apps: %j",c,d);if(!a){return}for(var b=0;b<d.length;b++){var e=this.getAppDownload(d[b].id);e.updateFromStatus(d[b].id,d[b].details)}if(!c){this._sendMyAppsListIsReady()}},allow1xDownload:function(b,c){var a=this;Weave.Services.request("palm://com.palm.downloadmanager",{method:"allow1x",parameters:{value:b},},function(d){a._allow1xDownload=b;c&&c(true)},function(d){Mojo.Log.info("AppDownloadManager.allow1xDownload failed %j",d);c&&c(false)})},canAllow1xDownload:function(){return this._allow1xDownload},cleanup:function(){Mojo.Log.info("AppDownloadManager.cleanup");if(this._allow1xDownload){this.allow1xDownload(false)}},});var Catalog=Catalog||{};Catalog.AppDownloadMngr=Catalog.AppDownloadMngr||new AppDownloadManager;
35\ No newline at end of file
136diff --git a/usr/palm/applications/com.palm.app.findapps/app/controllers/app-assistant.js b/usr/palm/applications/com.palm.app.findapps/app/controllers/app-assistant.js
2index 8115472..26aec73 100644
37index 0750d26..7e81c7c 100644
338--- a/usr/palm/applications/com.palm.app.findapps/app/controllers/app-assistant.js
439+++ b/usr/palm/applications/com.palm.app.findapps/app/controllers/app-assistant.js
540@@ -191,6 +191,10 @@ var DefaultStageAssistant = Class.create(
4848 .addItem($L('Preferences & Accounts'),
4949 function()
5050 {
51@@ -256,6 +260,10 @@ var WebDistributedStageAssistant = Class.create(
52 var self = this;
53 var menu = new Weave.Utilities.AppMenu()
54 .addEdit()
55+ .addItem($L("Hide App Vendors"),
56+ function () {
57+ self.controller.pushScene("hide");
58+ })
59 .addItem($L('Preferences & Accounts'),
60 function()
61 {
5162diff --git a/usr/palm/applications/com.palm.app.findapps/app/controllers/hide-assistant.js b/usr/palm/applications/com.palm.app.findapps/app/controllers/hide-assistant.js
5263new file mode 100644
5364index 0000000..0321579
111111+ this.update();
112112+ },
113113+});
114diff --git a/usr/palm/applications/com.palm.app.findapps/app/controllers/myapps-assistant.js b/usr/palm/applications/com.palm.app.findapps/app/controllers/myapps-assistant.js
115index 64d7a06..4152f26 100644
116--- a/usr/palm/applications/com.palm.app.findapps/app/controllers/myapps-assistant.js
117+++ b/usr/palm/applications/com.palm.app.findapps/app/controllers/myapps-assistant.js
118@@ -47,6 +47,10 @@ var MyappsAssistant = Class.create({
119 var self = this;
120 new Weave.Utilities.AppMenu(this)
121 .addEdit()
122+ .addItem($L("Hide App Vendors"),
123+ function () {
124+ self.controller.stageController.pushScene("hide");
125+ })
126 .addItem($L('Preferences & Accounts'),
127 function()
128 {
114129diff --git a/usr/palm/applications/com.palm.app.findapps/app/controllers/search-assistant.js b/usr/palm/applications/com.palm.app.findapps/app/controllers/search-assistant.js
115130index 41fa796..7bda4d3 100644
116131--- a/usr/palm/applications/com.palm.app.findapps/app/controllers/search-assistant.js
306306+
307307+</div>
308308diff --git a/usr/palm/applications/com.palm.app.findapps/app/views/search/search-appsummary.html b/usr/palm/applications/com.palm.app.findapps/app/views/search/search-appsummary.html
309index 07d7a8c..cb73c28 100644
309index 23272a7..c326e6d 100644
310310--- a/usr/palm/applications/com.palm.app.findapps/app/views/search/search-appsummary.html
311311+++ b/usr/palm/applications/com.palm.app.findapps/app/views/search/search-appsummary.html
312312@@ -1,5 +1,5 @@
317317 <div class="icon left search-result-app-icon #{formattedUpdate}">
318318 <div class="loadingicon"></div>
319319 <div class="update-badge"></div>
320diff --git a/usr/palm/applications/com.palm.app.findapps/index-default.html b/usr/palm/applications/com.palm.app.findapps/index-default.html
321index a77c2d7..851999e 100644
322--- a/usr/palm/applications/com.palm.app.findapps/index.html
323+++ b/usr/palm/applications/com.palm.app.findapps/index.html
324@@ -16,6 +16,7 @@
325 <!-- Some library code clones this out of here into the dashboard window ... sigh -->
326 <link href="/usr/lib/luna/luna-network/stylesheets/system-notification.css" rel="stylesheet" type="text/css" />
327 <link href="stylesheets/appcatalog.css" rel="stylesheet" type="text/css" />
328+ <link href="/media/internal/customizations/com.palm.app.findapps/stylesheets/appcatalog.css" rel="stylesheet" type="text/css" />
329
330 <!-- Timing
331 <script type="text/javascript">
332320diff --git a/usr/palm/applications/com.palm.app.findapps/sources.json b/usr/palm/applications/com.palm.app.findapps/sources.json
333index 9aad548..4405991 100644
321index df77f2e..881d391 100644
334322--- a/usr/palm/applications/com.palm.app.findapps/sources.json
335323+++ b/usr/palm/applications/com.palm.app.findapps/sources.json
336@@ -68,7 +68,14 @@
337 "scenes": "change-email-address"
324@@ -44,6 +44,13 @@
325 "scenes": "incompatible"
338326 },
339327 {
340328+ "source": "app\/model\/hide-list.js"
341329+ },
342330+ {
343 "source": "\/usr\/lib\/luna\/luna-network\/ConnectionWidget.js"
344+ },
345+ {
346331+ "source": "app\/controllers\/hide-assistant.js",
347332+ "scenes": "hide"
333+ },
334+ {
335 "source": "app\/controllers\/prefs-assistant.js",
336 "scenes": "prefs"
348337 },
349 {
350 "source": "allscriptscompressed.js"
351338diff --git a/usr/palm/applications/com.palm.app.findapps/stylesheets/appcatalog.css b/usr/palm/applications/com.palm.app.findapps/stylesheets/appcatalog.css
352index 6db1994..9ce7e8d 100644
339index 42189ed..ed8c504 100644
353340--- a/usr/palm/applications/com.palm.app.findapps/stylesheets/appcatalog.css
354341+++ b/usr/palm/applications/com.palm.app.findapps/stylesheets/appcatalog.css
355@@ -1624,4 +1624,38 @@
342@@ -1539,6 +1539,40 @@ a:hover.table-of-contents {color: #1F00F0;}
343 margin-bottom: 50px;
344 }
356345
357 .video-preview.selected .video-play-icon {
358 background: url(../images/play-button.png) bottom center no-repeat;
359-}
360\ No newline at end of file
361+}
362+
363346+.palm-row.unwanted .palm-row-wrapper .title {
364347+ color: #447799; /* shade of blue roughly matching the scrim */
365348+}
376376+.hide-scene .hide-list-text-field {
377377+ background-color: white;
378378+}
379+
380 .active .progress-bar-background {
381 position: absolute;
382 width: 320px;
  
1diff --git a/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js b/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js
2index 8f9b17e..3d0e43d 100644
3--- a/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js
4+++ b/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js
5@@ -84,7 +84,7 @@ var ComposeAssistant = Class.create({
6 this.handleCancelAttachment = this.resetTextBox.bind(this,false);
7 this.handleRecipientsChanged = this.handleRecipientsChanged.bind(this);
8
9- this.monkeyPatchAddressingWidget();
10+ /*this.monkeyPatchAddressingWidget();*/
11 this.saveDraft = true;
12 },
13
14@@ -593,11 +593,11 @@ var ComposeAssistant = Class.create({
15 }.bind(this)
16 });
17 }
18- },
19+ }/*,
20
21 /*******
22 * Monkey patch the addressing widget if the carrier requires limiting recipients
23- *******/
24+ *******
25 monkeyPatchAddressingWidget: function() {
26 if (this.Messaging.carrierSettings && this.Messaging.carrierSettings.smsMaxRecipients > 0) {
27 Mojo.Log.warn("carrierSettings.smsMaxRecipients=%i, monkey patching addRecipients", this.Messaging.carrierSettings.smsMaxRecipients);
28@@ -648,5 +648,5 @@ var ComposeAssistant = Class.create({
29 this.totalRecips++;
30 }
31 }
32- }
33+ }*/
34 });