fix(core.gbapp): Boolean added to BASIC.

This commit is contained in:
Rodrigo Rodriguez 2020-12-07 23:24:00 -03:00
parent eb15dd083b
commit bf91d74162
2 changed files with 7 additions and 6 deletions

View file

@ -480,7 +480,7 @@ export class DialogClass {
}
}
public async isAffirmative(step, text) {
return text.toLowerCase().match(Messages[step.context.activity.locale].affirmative_sentences);
return text.toLowerCase().match(Messages['pt-BR'].affirmative_sentences); // TODO: Dynamitize.
}
public async exit(step) {
await step.endDialog();

View file

@ -177,6 +177,10 @@ export class GBVMService extends GBService {
return `${$1} = hear("integer")`;
});
code = code.replace(/hear (\w+) as boolean/gi, ($0, $1, $2) => {
return `${$1} = hear("boolean")`;
});
code = code.replace(/hear (\w+) as name/gi, ($0, $1, $2) => {
return `${$1} = hear("name")`;
});
@ -458,17 +462,14 @@ export class GBVMService extends GBService {
let result = step.result;
if (step.activeDialog.state.options['kind'] === "boolean") {
if (isIntentYes(step.context.locale, step.result)) {
if (isIntentYes('pt-BR', step.result)) {
result = true;
}
else {
return await step.replaceDialog('/hear', step.activeDialog.state.options);
result = false;
}
}
else if (step.activeDialog.state.options['kind'] === "email") {
const locale = step.context.activity.locale;
const extractEntity = (text) => {
return text.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi);