fix(all): Fix in AS IMAGE generation of single row.
This commit is contained in:
parent
10197566da
commit
ee567681f1
1 changed files with 10 additions and 7 deletions
|
@ -680,32 +680,35 @@ export class WhatsappDirectLine extends GBService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async printMessage(activity, conversationId, from, fromName) {
|
public async printMessage(activity, conversationId, to, toName) {
|
||||||
let output = '';
|
let output = '';
|
||||||
|
|
||||||
if (activity.text) {
|
if (activity.text) {
|
||||||
GBLog.info(`GBWhatsapp: SND ${from}(${fromName}): ${activity.text}`);
|
GBLog.info(`GBWhatsapp: SND ${to}(${toName}): ${activity.text}`);
|
||||||
output = activity.text;
|
output = activity.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activity.attachments) {
|
if (activity.attachments) {
|
||||||
activity.attachments.forEach(attachment => {
|
await CollectionUtil.asyncForEach(activity.attachments, async attachment => {
|
||||||
|
|
||||||
switch (attachment.contentType) {
|
switch (attachment.contentType) {
|
||||||
case 'application/vnd.microsoft.card.hero':
|
case 'application/vnd.microsoft.card.hero':
|
||||||
output += `\n${this.renderHeroCard(attachment)}`;
|
output += `\n${this.renderHeroCard(attachment)}`;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'image/png':
|
case 'image/png':
|
||||||
GBLog.info(`Opening the requested image ${attachment.contentUrl}`);
|
await this.sendFileToDevice(to, attachment.contentUrl,
|
||||||
output += `\n${attachment.contentUrl}`;
|
attachment.name, attachment.name, 0);
|
||||||
break;
|
|
||||||
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
GBLog.info(`Unknown content type: ${attachment.contentType}`);
|
GBLog.info(`Unknown content type: ${attachment.contentType}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.sendToDevice(from, output, conversationId);
|
await this.sendToDevice(to, output, conversationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public renderHeroCard(attachment) {
|
public renderHeroCard(attachment) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue