Skip to content

Commit

Permalink
fix(core.gbapp): Refactoring in MD fix in disabling auto-compiling of…
Browse files Browse the repository at this point in the history
… .gbapps.
  • Loading branch information
rodrigorodriguez committed Mar 31, 2020
1 parent ade960a commit d9857b9
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 50 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"botbuilder-ai": "4.7.0",
"botbuilder-dialogs": "4.7.0",
"botframework-connector": "4.7.0",
"botlib": "1.4.2",
"botlib": "1.4.4",
"chai": "4.2.0",
"cli-spinner": "0.2.10",
"csv-parse": "4.8.3",
Expand Down
5 changes: 3 additions & 2 deletions packages/core.gbapp/services/GBConversationalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class GBConversationalService implements IGBConversationalService {
return step.context.activity.locale;
}

public async sendFile(min: GBMinInstance, step: GBDialogStep, url: string): Promise<any> {
public async sendFile(min: GBMinInstance, step: GBDialogStep, url: string, caption: string): Promise<any> {
const mobile = step.context.activity.from.id;
const filename = url.substring(url.lastIndexOf('/') + 1);
await min.whatsAppDirectLine.sendFileToDevice(mobile, url, filename);
Expand Down Expand Up @@ -199,7 +199,8 @@ export class GBConversationalService implements IGBConversationalService {
if (c === ')') {
state = State.InText;
let url = urlJoin(GBServer.globals.publicAddress, currentImage);
await this.sendFile(min, step, url);
let caption = null; // TODO: Parse.
await this.sendFile(min, step, url, caption);
await sleep(5000);
currentImage = '';
}
Expand Down
24 changes: 16 additions & 8 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class GBMinService {
if (process.env.DISABLE_WEB !== 'true') {
let url = GBServer.globals.wwwroot ?
GBServer.globals.wwwroot :
urlJoin(GBDeployer.deployFolder, GBMinService.uiPackage, 'build');
urlJoin(GBDeployer.deployFolder, GBMinService.uiPackage, 'build');

GBServer.globals.server.use('/', express.static(url));
}
Expand Down Expand Up @@ -544,14 +544,17 @@ export class GBMinService {

private async processMessageActivity(context, min: GBMinInstance, step: GBDialogStep) {

// Adds message to the analytics layer.
if (process.env.PRIVACY_STORE_MESSAGES === "true") {

const analytics = new AnalyticsService();
const user = await min.userProfile.get(context, {});
analytics.createMessage(min.instance.instanceId,
user.conversation, user.systemUser,
context.activity.text);
// Adds message to the analytics layer.

const analytics = new AnalyticsService();
const user = await min.userProfile.get(context, {});
analytics.createMessage(min.instance.instanceId,
user.conversation, user.systemUser,
context.activity.text);
}

// Checks for global exit kewywords cancelling any active dialogs.

const globalQuit = (locale, utterance) => {
Expand All @@ -568,7 +571,12 @@ export class GBMinService {
} else if (isVMCall) {
await GBMinService.callVM(context.activity.text, min, step);
} else if (context.activity.text.charAt(0) === '/') {
await step.beginDialog(context.activity.text);
let text = context.activity.text;
let parts = text.split(' ');
let dialogName = parts[0];
parts.splice(0, 1);
let args = parts.join(' ');
await step.beginDialog(dialogName, { args: args });

} else if (globalQuit(step.context.activity.locale, context.activity.text)) {
await step.cancelAllDialogs();
Expand Down
54 changes: 25 additions & 29 deletions packages/default.gbui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions packages/whatsapp.gblib/services/WhatsappDirectLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,16 @@ export class WhatsappDirectLine extends GBService {
return `${attachment.content.title} - ${attachment.content.text}`;
}

public async sendFileToDevice(to, url, filename) {
public async sendFileToDevice(to, url, filename, caption) {
const options = {
method: 'POST',
url: urlJoin(this.whatsappServiceUrl, 'sendFile'),
qs: {
token: this.whatsappServiceKey,
phone: to,
body: url,
filename: filename
filename: filename,
caption: caption
},
headers: {
'cache-control': 'no-cache'
Expand Down

0 comments on commit d9857b9

Please sign in to comment.