diff --git a/submodules/myOffice/myOffice.js b/submodules/myOffice/myOffice.js index 9665cb7..7c18e1e 100644 --- a/submodules/myOffice/myOffice.js +++ b/submodules/myOffice/myOffice.js @@ -10,7 +10,8 @@ define(function(require){ subscribe: { 'voip.myOffice.render': 'myOfficeRender', - 'auth.continueTrial': 'myOfficeWalkthroughRender' + 'auth.continueTrial': 'myOfficeWalkthroughRender', + 'myaccount.closed': 'myOfficeAfterMyaccountClosed' }, chartColors: [ @@ -117,16 +118,37 @@ define(function(require){ .empty() .append(template); - // If it's not a trial, we show the Walkthrough the first time - // If it's a trial, this code will be called by trial handler - if(!monster.apps.auth.currentAccount.hasOwnProperty('trial_time_left')) { - self.myOfficeWalkthroughRender(); - } + self.myOfficeCheckWalkthrough(); callback && callback(); }); }, + // we check if we have to display the walkthrough: + // first make sure it's not a trial, then + // only show it if we've already shown the walkthrough in myaccount + myOfficeCheckWalkthrough: function() { + var self = this; + + if(!monster.apps.auth.currentAccount.hasOwnProperty('trial_time_left')) { + monster.pub('myaccount.hasToShowWalkthrough', function(response) { + if(response === false) { + self.myOfficeWalkthroughRender(); + } + }); + } + }, + + myOfficeAfterMyaccountClosed: function() { + var self = this; + + // If it's not a trial, we show the Walkthrough the first time + // because if it's a trial, myOfficeWalkthroughRender will be called by another event + if(!monster.apps.auth.currentAccount.hasOwnProperty('trial_time_left')) { + self.myOfficeWalkthroughRender(); + } + }, + myOfficeCreateMainVMBoxIfMissing: function(callback) { var self = this;