* Added ability to pass a "menu result" from a menu when calling prev()/prevMenu()
* Ability to fully quit newscan with X key using new menu result functionality
This commit is contained in:
parent
48aa0fa606
commit
0a3a62edf3
|
@ -317,4 +317,8 @@ MenuModule.prototype.standardMCIReadyHandler = function(mciData, cb) {
|
|||
};
|
||||
|
||||
MenuModule.prototype.finishedLoading = function() {
|
||||
};
|
||||
};
|
||||
|
||||
MenuModule.prototype.getMenuResult = function() {
|
||||
// nothing in base
|
||||
};
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 } );
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
MessageListModule.prototype.getMenuResult = function() {
|
||||
return this.menuResult;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue