fix(core.gbapp): Autostart twice fixed.

This commit is contained in:
Rodrigo Rodriguez 2021-08-28 15:45:06 -03:00
parent 5aa5f1ee3a
commit 23048760b6

View file

@ -638,6 +638,7 @@ export class GBMinService {
min.scriptMap = {}; min.scriptMap = {};
min.sandBoxMap = {}; min.sandBoxMap = {};
min["scheduleMap"] = {}; min["scheduleMap"] = {};
min["conversationWelcomed"] = {};
min.packages = sysPackages; min.packages = sysPackages;
min.appPackages = appPackages; min.appPackages = appPackages;
@ -819,7 +820,7 @@ export class GBMinService {
user.subjects = []; user.subjects = [];
user.cb = undefined; user.cb = undefined;
user.welcomed = false; user.welcomed = false;
user.basicOptions = { maxLines: 100, translatorOn: true , wholeWord: true}; user.basicOptions = { maxLines: 100, translatorOn: true, wholeWord: true };
firstTime = true; firstTime = true;
@ -917,17 +918,22 @@ export class GBMinService {
await step.beginDialog('/'); await step.beginDialog('/');
} }
else { else {
user.welcomed = true; if (!min["conversationWelcomed"][step.context.activity.conversation.id]) {
GBLog.info(`Auto start (web) dialog is now being called: ${startDialog} for ${min.instance.instanceId}...`);
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer); min["conversationWelcomed"][step.context.activity.conversation.id] = true;
GBLog.info(`Auto start (web) dialog is now being called: ${startDialog} for ${min.instance.instanceId}...`);
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);
}
} }
} else { } else {
GBLog.info(`Person added to conversation: ${member.name}`); GBLog.info(`Person added to conversation: ${member.name}`);
if (this.userMobile(step) ) { if (this.userMobile(step)) {
if (startDialog && !user.welcomed) { if (startDialog && !min["conversationWelcomed"][step.context.activity.conversation.id]) {
user.welcomed = true; user.welcomed = true;
await min.userProfile.set(step.context, user);
GBLog.info(`Auto start (whatsapp) dialog is now being called: ${startDialog} for ${min.instance.instanceId}...`); GBLog.info(`Auto start (whatsapp) dialog is now being called: ${startDialog} for ${min.instance.instanceId}...`);
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer); await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);
} }
@ -993,7 +999,7 @@ export class GBMinService {
}); });
} else if (context.activity.name === 'startGB') { } else if (context.activity.name === 'startGB') {
const startDialog = min.core.getParam(min.instance, 'Start Dialog', null); const startDialog = min.core.getParam(min.instance, 'Start Dialog', null);
if (startDialog && !user.welcomed) { if (startDialog && !min["conversationWelcomed"][step.context.activity.conversation.id]) {
user.welcomed = true; user.welcomed = true;
GBLog.info(`Auto start (web) dialog is now being called: ${startDialog} for ${min.instance.instanceId}...`); GBLog.info(`Auto start (web) dialog is now being called: ${startDialog} for ${min.instance.instanceId}...`);
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer); await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);