Skip to content

Commit

Permalink
Added image url to DappMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
Baulore committed Apr 12, 2024
1 parent 5ec9d40 commit adf37c0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/sdk/src/dapp/dapp.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ export interface SmartMessage {
export interface SmartMessageParams {}



export interface SendDappMessageCommandBase {
message: string;

Check failure on line 103 in packages/sdk/src/dapp/dapp.interface.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

An empty interface is equivalent to `{}`
title?: string;
imageUrl?: string;
notificationTypeId?: string;
addressTypes?: AddressType[];
// tags?: string[];
Expand Down
15 changes: 9 additions & 6 deletions packages/sdk/src/dialect-cloud-api/data-service-dapps-api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { TokenProvider } from '../auth/token-provider';
import { createHeaders, withReThrowingDataServiceError } from './data-service-api';
import {
createHeaders,
withReThrowingDataServiceError,
} from './data-service-api';
import axios from 'axios';
import type { BlockchainType } from '../dapp/dapp.interface';

Expand All @@ -23,8 +26,7 @@ export class DataServiceDappsApiClient implements DataServiceDappsApi {
constructor(
private readonly baseUrl: string,
private readonly tokenProvider: TokenProvider,
) {
}
) {}

async create(
command: Omit<CreateDappCommandDto, 'publicKey'>,
Expand Down Expand Up @@ -201,7 +203,9 @@ export class DappMessageLinkAction {
url!: string;
}

export class DappMessageSmartMessageActionDto implements DappMessageActionBaseDto {
export class DappMessageSmartMessageActionDto
implements DappMessageActionBaseDto
{
type!: DappMessageActionTypeDto.SMART_MESSAGE;
smartMessage!: SmartMessageDto;
}
Expand All @@ -212,16 +216,15 @@ export class SmartMessageDto {
}
// end actions


class SendDappMessageCommandDto {
title?: string;
message!: string;
imageUrl?: string;
notificationTypeId?: string;
addressTypes?: AddressTypeDto[];
// tags?: string[];
}


export class UnicastDappMessageCommandDto extends SendDappMessageCommandDto {
recipientPublicKey!: string;
actionsV2?: DappMessageLinksActionDto | DappMessageSmartMessageActionDto;
Expand Down
5 changes: 3 additions & 2 deletions packages/sdk/src/internal/dapp/data-service-dapp-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class DataServiceDappMessages implements DappMessages {
this.api.unicast({
message: command.message,
title: command.title,
imageUrl: command.imageUrl,
notificationTypeId: command.notificationTypeId,
recipientPublicKey: command.recipient.toString(),
addressTypes: command?.addressTypes?.map((addr) =>
Expand Down Expand Up @@ -84,6 +85,7 @@ export class DataServiceDappMessages implements DappMessages {
this.api.multicast({
message: command.message,
title: command.title,
imageUrl: command.imageUrl,
actionsV2: this.getActionsV2DtoForLinks(command.actionsV2),
notificationTypeId: command.notificationTypeId,
recipientPublicKeys: command.recipients.map((it) => it.toString()),
Expand All @@ -99,6 +101,7 @@ export class DataServiceDappMessages implements DappMessages {
this.api.broadcast({
message: command.message,
title: command.title,
imageUrl: command.imageUrl,
actionsV2: this.getActionsV2DtoForLinks(command.actionsV2),
notificationTypeId: command.notificationTypeId,
addressTypes: command?.addressTypes?.map((addr) =>
Expand All @@ -119,7 +122,5 @@ export class DataServiceDappMessages implements DappMessages {
url: link.url,
})),
};

}

}

0 comments on commit adf37c0

Please sign in to comment.