Skip to content

Commit

Permalink
fix(core.gbapp): Boolean added to BASIC.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Dec 8, 2020
1 parent eb15dd0 commit bf91d74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/core.gbapp/services/GBAPIService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 6 additions & 5 deletions packages/core.gbapp/services/GBVMService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")`;
});
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bf91d74

Please sign in to comment.