* 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.finishedLoading = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MenuModule.prototype.getMenuResult = function() {
|
||||||
|
// nothing in base
|
||||||
|
};
|
||||||
|
|
|
@ -73,6 +73,8 @@ module.exports = class MenuStack {
|
||||||
}
|
}
|
||||||
|
|
||||||
prev(cb) {
|
prev(cb) {
|
||||||
|
const menuResult = this.top().instance.getMenuResult();
|
||||||
|
|
||||||
// :TODO: leave() should really take a cb...
|
// :TODO: leave() should really take a cb...
|
||||||
this.pop().instance.leave(); // leave & remove current
|
this.pop().instance.leave(); // leave & remove current
|
||||||
|
|
||||||
|
@ -80,8 +82,9 @@ module.exports = class MenuStack {
|
||||||
|
|
||||||
if(previousModuleInfo) {
|
if(previousModuleInfo) {
|
||||||
const opts = {
|
const opts = {
|
||||||
extraArgs : previousModuleInfo.extraArgs,
|
extraArgs : previousModuleInfo.extraArgs,
|
||||||
savedState : previousModuleInfo.savedState
|
savedState : previousModuleInfo.savedState,
|
||||||
|
lastMenuResult : menuResult,
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.goto(previousModuleInfo.name, opts, cb);
|
return this.goto(previousModuleInfo.name, opts, cb);
|
||||||
|
@ -112,7 +115,8 @@ module.exports = class MenuStack {
|
||||||
};
|
};
|
||||||
|
|
||||||
if(_.isObject(options)) {
|
if(_.isObject(options)) {
|
||||||
loadOpts.extraArgs = options.extraArgs;
|
loadOpts.extraArgs = options.extraArgs;
|
||||||
|
loadOpts.lastMenuResult = options.lastMenuResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMenu(loadOpts, (err, modInst) => {
|
loadMenu(loadOpts, (err, modInst) => {
|
||||||
|
|
|
@ -90,10 +90,11 @@ function loadMenu(options, cb) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const moduleInstance = new modData.mod.getModule({
|
const moduleInstance = new modData.mod.getModule({
|
||||||
menuName : options.name,
|
menuName : options.name,
|
||||||
menuConfig : modData.config,
|
menuConfig : modData.config,
|
||||||
extraArgs : options.extraArgs,
|
extraArgs : options.extraArgs,
|
||||||
client : options.client,
|
client : options.client,
|
||||||
|
lastMenuResult : options.lastMenuResult,
|
||||||
});
|
});
|
||||||
return callback(null, moduleInstance);
|
return callback(null, moduleInstance);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|
|
@ -37,6 +37,8 @@ function NewScanModule(options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var config = this.menuConfig.config;
|
var config = this.menuConfig.config;
|
||||||
|
|
||||||
|
this.newScanFullExit = _.has(options, 'lastMenuResult.fullExit') ? options.lastMenuResult.fullExit : false;
|
||||||
|
|
||||||
this.currentStep = 'messageConferences';
|
this.currentStep = 'messageConferences';
|
||||||
this.currentScanAux = {};
|
this.currentScanAux = {};
|
||||||
|
|
||||||
|
@ -191,6 +193,12 @@ NewScanModule.prototype.restoreSavedState = function(savedState) {
|
||||||
|
|
||||||
NewScanModule.prototype.mciReady = function(mciData, cb) {
|
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 self = this;
|
||||||
var vc = self.viewControllers.allViews = new ViewController( { client : self.client } );
|
var vc = self.viewControllers.allViews = new ViewController( { client : self.client } );
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,11 @@ function MessageListModule(options) {
|
||||||
} else {
|
} else {
|
||||||
return cb(null);
|
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) {
|
if(savedState) {
|
||||||
this.initialFocusIndex = savedState.initialFocusIndex;
|
this.initialFocusIndex = savedState.initialFocusIndex;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MessageListModule.prototype.getMenuResult = function() {
|
||||||
|
return this.menuResult;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue