Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app/utils/url.ts): update asset profile url #3242

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class CaptureDetailsWithIonicComponent {
captionOn = true;

readonly detailedCapture$ = new ReplaySubject<DetailedCapture>(1);
readonly detailedCaptureTmpShareToken$ = new ReplaySubject<string>(1);
readonly thumbnailUrl$ = this.detailedCapture$.pipe(
switchMap(capture => capture.proof$),
isNonNullable(),
Expand Down Expand Up @@ -68,11 +67,6 @@ export class CaptureDetailsWithIonicComponent {
if (value) this.detailedCapture$.next(value);
}

@Input()
set detailedCaptureTmpShareToken(value: string | undefined) {
if (value) this.detailedCaptureTmpShareToken$.next(value);
}

constructor(
private readonly translocoService: TranslocoService,
private readonly datePipe: DatePipe,
Expand Down Expand Up @@ -100,16 +94,15 @@ export class CaptureDetailsWithIonicComponent {
}

openCertificate() {
combineLatest([this.detailedCapture$, this.detailedCaptureTmpShareToken$])
combineLatest([this.detailedCapture$])
.pipe(
first(),
concatMap(([detailedCapture, tmpShareToken]) =>
concatMap(([detailedCapture]) =>
defer(() =>
Browser.open({
url: getAssetProfileForNSE(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
detailedCapture.id!,
tmpShareToken
detailedCapture.id!
),
toolbarColor: '#564dfc',
})
Expand Down
7 changes: 2 additions & 5 deletions src/app/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ export function toDataUrl(base64: string, mimeType: MimeType | string) {
return `data:${mimeType};base64,${base64}`;
}

export function getAssetProfileForNSE(id: string, token?: string) {
if (token) {
return `https://verify.numbersprotocol.io/asset-profile?nid=${id}&tmp_token=${token}`;
}
return `https://verify.numbersprotocol.io/asset-profile?nid=${id}`;
export function getAssetProfileForNSE(id: string) {
return `https://verify.numbersprotocol.io/asset-profile/${id}`;
}

export function getAssetProfileForCaptureIframe(cid: string) {
Expand Down