diff --git a/core/menu_module.js b/core/menu_module.js index f8e23113..5477e6d3 100644 --- a/core/menu_module.js +++ b/core/menu_module.js @@ -317,4 +317,8 @@ MenuModule.prototype.standardMCIReadyHandler = function(mciData, cb) { }; MenuModule.prototype.finishedLoading = function() { -}; \ No newline at end of file +}; + +MenuModule.prototype.getMenuResult = function() { + // nothing in base +}; diff --git a/core/menu_stack.js b/core/menu_stack.js index 0dcdf4d8..98a171b9 100644 --- a/core/menu_stack.js +++ b/core/menu_stack.js @@ -73,6 +73,8 @@ module.exports = class MenuStack { } prev(cb) { + const menuResult = this.top().instance.getMenuResult(); + // :TODO: leave() should really take a cb... this.pop().instance.leave(); // leave & remove current @@ -80,8 +82,9 @@ module.exports = class MenuStack { if(previousModuleInfo) { const opts = { - extraArgs : previousModuleInfo.extraArgs, - savedState : previousModuleInfo.savedState + extraArgs : previousModuleInfo.extraArgs, + savedState : previousModuleInfo.savedState, + lastMenuResult : menuResult, }; return this.goto(previousModuleInfo.name, opts, cb); @@ -112,7 +115,8 @@ module.exports = class MenuStack { }; if(_.isObject(options)) { - loadOpts.extraArgs = options.extraArgs; + loadOpts.extraArgs = options.extraArgs; + loadOpts.lastMenuResult = options.lastMenuResult; } loadMenu(loadOpts, (err, modInst) => { diff --git a/core/menu_util.js b/core/menu_util.js index a532899a..bc439a9b 100644 --- a/core/menu_util.js +++ b/core/menu_util.js @@ -90,10 +90,11 @@ function loadMenu(options, cb) { try { const moduleInstance = new modData.mod.getModule({ - menuName : options.name, - menuConfig : modData.config, - extraArgs : options.extraArgs, - client : options.client, + menuName : options.name, + menuConfig : modData.config, + extraArgs : options.extraArgs, + client : options.client, + lastMenuResult : options.lastMenuResult, }); return callback(null, moduleInstance); } catch(e) { diff --git a/core/new_scan.js b/core/new_scan.js index 09985e1f..fe8405af 100644 --- a/core/new_scan.js +++ b/core/new_scan.js @@ -37,6 +37,8 @@ function NewScanModule(options) { var self = this; var config = this.menuConfig.config; + this.newScanFullExit = _.has(options, 'lastMenuResult.fullExit') ? options.lastMenuResult.fullExit : false; + this.currentStep = 'messageConferences'; this.currentScanAux = {}; @@ -191,6 +193,12 @@ NewScanModule.prototype.restoreSavedState = function(savedState) { NewScanModule.prototype.mciReady = function(mciData, cb) { + if(this.newScanFullExit) { + // user has canceled the entire scan @ message list view + return cb(null); + } + + var self = this; var vc = self.viewControllers.allViews = new ViewController( { client : self.client } ); diff --git a/mods/msg_list.js b/mods/msg_list.js index 924f0d92..e397c52c 100644 --- a/mods/msg_list.js +++ b/mods/msg_list.js @@ -103,6 +103,11 @@ function MessageListModule(options) { } else { return cb(null); } + }, + + fullExit : function(formData, extraArgs, cb) { + self.menuResult = { fullExit : true }; + return self.prevMenu(cb); } }; @@ -249,4 +254,8 @@ MessageListModule.prototype.restoreSavedState = function(savedState) { if(savedState) { this.initialFocusIndex = savedState.initialFocusIndex; } -}; \ No newline at end of file +}; + +MessageListModule.prototype.getMenuResult = function() { + return this.menuResult; +};