Skip to content

Commit

Permalink
fix(core.gbapp): Autostart twice fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Aug 28, 2021
1 parent 5aa5f1e commit 2304876
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ export class GBMinService {
min.scriptMap = {};
min.sandBoxMap = {};
min["scheduleMap"] = {};
min["conversationWelcomed"] = {};
min.packages = sysPackages;
min.appPackages = appPackages;

Expand Down Expand Up @@ -819,7 +820,7 @@ export class GBMinService {
user.subjects = [];
user.cb = undefined;
user.welcomed = false;
user.basicOptions = { maxLines: 100, translatorOn: true , wholeWord: true};
user.basicOptions = { maxLines: 100, translatorOn: true, wholeWord: true };

firstTime = true;

Expand Down Expand Up @@ -917,17 +918,22 @@ export class GBMinService {
await step.beginDialog('/');
}
else {
user.welcomed = 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);
if (!min["conversationWelcomed"][step.context.activity.conversation.id]) {

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 {
GBLog.info(`Person added to conversation: ${member.name}`);

if (this.userMobile(step) ) {
if (startDialog && !user.welcomed) {
if (this.userMobile(step)) {
if (startDialog && !min["conversationWelcomed"][step.context.activity.conversation.id]) {
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}...`);
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);
}
Expand Down Expand Up @@ -993,7 +999,7 @@ export class GBMinService {
});
} else if (context.activity.name === 'startGB') {
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;
GBLog.info(`Auto start (web) dialog is now being called: ${startDialog} for ${min.instance.instanceId}...`);
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);
Expand Down

0 comments on commit 2304876

Please sign in to comment.