Fix notification images

This commit is contained in:
Bill 2022-03-15 13:25:24 -04:00
parent 09aabe031b
commit 1c1317eadb
2 changed files with 5 additions and 8 deletions

View File

@ -59,10 +59,9 @@ export class NotificationUtilities
{
let imageUrl = options.get('image');
// eslint-disable-next-line no-template-curly-in-string
if(!imageUrl) imageUrl = ('${image.library.url}notifications/' + type.replace(/\./g, '_') + '.png');
if(!imageUrl) imageUrl = GetConfiguration<string>('image.library.notifications.url', '').replace('%image', type.replace(/\./g, '_'));
return imageUrl;
return LocalizeText(imageUrl);
}
public static showNotification(type: string, options: Map<string, string> = null): void
@ -79,11 +78,9 @@ export class NotificationUtilities
const linkUrl = this.getNotificationPart(options, type, 'linkUrl', false);
const image = this.getNotificationImageUrl(options, type);
console.log(image, LocalizeText(image));
if(options.get('display') === 'BUBBLE')
{
this.showSingleBubble(LocalizeText(message), NotificationBubbleType.INFO, LocalizeText(image), linkUrl);
this.showSingleBubble(LocalizeText(message), NotificationBubbleType.INFO, image, linkUrl);
}
else
{

View File

@ -65,11 +65,11 @@ export const NotificationCenterMessageHandler: FC<{}> = props =>
{
const parser = event.getParser();
if(parser.amountChanged <= 0) return;
if((parser.amountChanged <= 0) || (parser.type !== 5)) return;
const imageUrl = GetConfiguration<string>('currency.asset.icon.url', '').replace('%type%', parser.type.toString());
NotificationUtilities.showSingleBubble(LocalizeText(`notifications.text.activitypoints.${ parser.type }`, [ 'AMOUNT' ], [ parser.amountChanged.toString() ]), NotificationBubbleType.INFO, imageUrl);
NotificationUtilities.showSingleBubble(LocalizeText('notifications.text.loyalty.received', [ 'amount' ], [ parser.amountChanged.toString() ]), NotificationBubbleType.INFO, imageUrl);
}, []);
UseMessageEventHook(ActivityPointNotificationMessageEvent, onActivityPointNotificationMessageEvent);