Skip to content

Commit dbea6d3

Browse files
committed
feat(features/home): link asset profile to parent
Link the asset profile to the parent asset instead of the child asset.
1 parent 8ecba1c commit dbea6d3

File tree

9 files changed

+19
-18
lines changed

9 files changed

+19
-18
lines changed

src/app/features/home/activities/network-action-order-details/network-action-order-details.page.ts

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component } from '@angular/core';
22
import { MatSnackBar } from '@angular/material/snack-bar';
33
import { ActivatedRoute } from '@angular/router';
4-
import { Plugins } from '@capacitor/core';
4+
import { Clipboard } from '@capacitor/clipboard';
55
import { NavController } from '@ionic/angular';
66
import { TranslocoService } from '@ngneat/transloco';
77
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
@@ -21,9 +21,7 @@ import { ErrorService } from '../../../../shared/error/error.service';
2121
import { BubbleToIonicPostMessage } from '../../../../shared/iframe/iframe';
2222
import { NetworkService } from '../../../../shared/network/network.service';
2323
import { isNonNullable } from '../../../../utils/rx-operators/rx-operators';
24-
import { getAssetProfileForNSE } from '../../../../utils/url';
2524

26-
const { Browser, Clipboard } = Plugins;
2725
@UntilDestroy({ checkProperties: true })
2826
@Component({
2927
selector: 'app-network-action-order-details',
@@ -125,18 +123,6 @@ export class NetworkActionOrderDetailsPage {
125123
.subscribe();
126124
}
127125

128-
// eslint-disable-next-line class-methods-use-this
129-
openResultUrl(url: string) {
130-
if (url) {
131-
Browser.open({ url, toolbarColor: '#000000' });
132-
}
133-
}
134-
135-
// eslint-disable-next-line class-methods-use-this
136-
resultUrlFromAssetId(assetId: string) {
137-
return getAssetProfileForNSE(assetId);
138-
}
139-
140126
async copyToClipboard(value: string) {
141127
await Clipboard.write({ string: value });
142128
this.snackBar.open(

src/app/features/home/details/capture-details-with-ionic/capture-details-with-ionic.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class CaptureDetailsWithIonicComponent {
103103
Browser.open({
104104
url: getAssetProfileForNSE(
105105
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
106-
detailedCapture.id!
106+
detailedCapture.parentAssetCid || detailedCapture.id!
107107
),
108108
toolbarColor: browserToolbarColor,
109109
})

src/app/features/home/details/details.page.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,9 @@ export class DetailsPage {
392392
buttons.push({
393393
text: viewProofText,
394394
handler: async () => {
395-
await this.handleOpenProofAction(diaBackendAsset.id);
395+
await this.handleOpenProofAction(
396+
diaBackendAsset.parent_asset_cid || diaBackendAsset.id
397+
);
396398
resolve();
397399
},
398400
});

src/app/features/home/details/information/session/information-session.service.ts

+5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ export class DetailedCapture {
4545
? getOldProof(this.proofOrDiaBackendAsset).hash
4646
: this.proofOrDiaBackendAsset.proof_hash;
4747

48+
readonly parentAssetCid =
49+
this.proofOrDiaBackendAsset instanceof Proof
50+
? this.proofOrDiaBackendAsset.parentAssetCid
51+
: this.proofOrDiaBackendAsset.parent_asset_cid;
52+
4853
readonly mediaUrl$ = defer(() => {
4954
if (this.proofOrDiaBackendAsset instanceof Proof) {
5055
const proof = this.proofOrDiaBackendAsset;

src/app/shared/dia-backend/asset/dia-backend-asset-repository.service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ export interface DiaBackendAsset extends Tuple {
355355
readonly mint_workflow_id: string;
356356
readonly uploaded_at: string;
357357
readonly public_access: boolean;
358+
readonly parent_asset_cid: string;
358359
}
359360

360361
export interface OwnerAddresses extends Tuple {

src/app/shared/dia-backend/asset/downloading/dia-backend-downloading.service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export class DiaBackendAssetDownloadingService {
8989
proof.diaBackendAssetId = diaBackendAsset.id;
9090
proof.caption = diaBackendAsset.caption;
9191
proof.uploadedAt = diaBackendAsset.uploaded_at;
92+
proof.parentAssetCid = diaBackendAsset.parent_asset_cid;
9293
if (diaBackendAsset.signed_metadata) proof.setSignatureVersion();
9394
return this.proofRepository.add(proof, OnConflictStrategy.REPLACE);
9495
}

src/app/shared/dia-backend/asset/uploading/dia-backend-asset-uploading.service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export class DiaBackendAssetUploadingService {
146146
map(diaBackendAsset => {
147147
proof.diaBackendAssetId = diaBackendAsset.id;
148148
proof.uploadedAt = diaBackendAsset.uploaded_at;
149+
proof.parentAssetCid = diaBackendAsset.parent_asset_cid;
149150
return proof;
150151
}),
151152
retryWhen(err$ =>

src/app/shared/repositories/proof/proof.ts

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export class Proof {
4747

4848
integritySha?: string = undefined;
4949

50+
parentAssetCid?: string = undefined;
51+
5052
/**
5153
* Since capture cam originally capture photos/videos from camera we set cameraSource to
5254
* CameraSource.Camera by default. If user picks photo/video from galley then cameraSource
@@ -164,6 +166,7 @@ export class Proof {
164166
proof.isCollected = indexedProofView.isCollected ?? false;
165167
proof.signatureVersion = indexedProofView.signatureVersion;
166168
proof.integritySha = indexedProofView.integritySha;
169+
proof.parentAssetCid = indexedProofView.parentAssetCid;
167170
proof.cameraSource = indexedProofView.cameraSource;
168171
return proof;
169172
}
@@ -335,6 +338,7 @@ export class Proof {
335338
uploadedAt: this.uploadedAt,
336339
isCollected: this.isCollected,
337340
integritySha: this.integritySha,
341+
parentAssetCid: this.parentAssetCid,
338342
cameraSource: this.cameraSource,
339343
};
340344
}
@@ -471,6 +475,7 @@ export interface IndexedProofView extends Tuple {
471475
readonly uploadedAt?: string;
472476
readonly isCollected?: boolean;
473477
readonly integritySha?: string;
478+
readonly parentAssetCid?: string;
474479
readonly cameraSource: CameraSource;
475480
}
476481

src/app/shared/share/share.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class ShareService {
4646
.pipe(catchError((err: unknown) => this.errorService.toastError$(err)))
4747
.toPromise();
4848
}
49-
return getAssetProfileForNSE(asset.id);
49+
return getAssetProfileForNSE(asset.parent_asset_cid || asset.id);
5050
}
5151

5252
async shareReferralCode(referralCode: string) {

0 commit comments

Comments
 (0)