Skip to content

Commit

Permalink
Merge pull request #3324 from numbersprotocol/feature-update-share-link
Browse files Browse the repository at this point in the history
feat(features/home): update share text and link
  • Loading branch information
olgahaha authored Feb 13, 2025
2 parents 6291cd6 + 3c4e2a1 commit fe104a1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/app/features/home/details/details.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export class DetailsPage {
this.translocoService.selectTranslateObject({
'details.shares.downloadC2pa': null,
'details.shares.viewBlockchainProof': null,
'details.shares.shareBlockchainProof': null,
'details.shares.shareCapturePage': null,
'details.shares.copyNid': null,
}),
])
Expand All @@ -367,7 +367,7 @@ export class DetailsPage {
([
diaBackendAsset,
publicKey,
[downloadC2paText, viewProofText, shareProofText, copyNidText],
[downloadC2paText, viewProofText, shareCaptureText, copyNidText],
]) =>
new Promise<void>(resolve => {
const buttons: ActionSheetButton[] = [];
Expand Down Expand Up @@ -399,7 +399,7 @@ export class DetailsPage {
},
});
buttons.push({
text: shareProofText,
text: shareCaptureText,
handler: async () => {
const result =
diaBackendAsset.public_access ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ export interface DiaBackendAsset extends Tuple {
readonly id: string;
readonly uuid: string;
readonly cid: string;
readonly type: 'unique' | 'child';
readonly proof_hash: string;
readonly is_original_owner: boolean;
readonly owner: string;
Expand All @@ -348,6 +349,7 @@ export interface DiaBackendAsset extends Tuple {
readonly supporting_file: string | null;
readonly source_type: 'original' | 'post_capture' | 'store';
readonly cai_file: string;
readonly nft_chain_id: number | null;
readonly nft_token_id: string | null;
readonly nft_token_uri: string;
readonly nft_blockchain_name: string;
Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/share/share.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Share } from '@capacitor/share';
import { TranslocoService } from '@ngneat/transloco';
import { catchError } from 'rxjs/operators';
import { urlToDownloadApp } from '../../utils/constants';
import { getAssetProfileForNSE } from '../../utils/url';
import { getCapturePage } from '../../utils/url';
import {
DiaBackendAsset,
DiaBackendAssetRepository,
Expand Down Expand Up @@ -46,7 +46,7 @@ export class ShareService {
.pipe(catchError((err: unknown) => this.errorService.toastError$(err)))
.toPromise();
}
return getAssetProfileForNSE(asset.parent_asset_cid || asset.id);
return getCapturePage(asset);
}

async shareReferralCode(referralCode: string) {
Expand Down
21 changes: 21 additions & 0 deletions src/app/utils/url.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DiaBackendAsset } from '../shared/dia-backend/asset/dia-backend-asset-repository.service';
import { BUBBLE_IFRAME_URL } from '../shared/dia-backend/secret';
import { urlToDownloadApp } from './constants';
import { MimeType } from './mime-type';
Expand All @@ -24,6 +25,26 @@ export function getAppDownloadLink(isPlatform: (platformName: any) => boolean) {
return urlToDownloadApp;
}

export function getCapturePage(asset: DiaBackendAsset) {
const nid =
asset.type === 'child' && asset.parent_asset_cid
? asset.parent_asset_cid
: asset.id;
let url = `https://asset.captureapp.xyz/${nid}`;
if (
asset.type === 'child' &&
asset.nft_chain_id &&
asset.nft_contract_address &&
asset.nft_token_id
) {
url +=
`?chain_id=${asset.nft_chain_id}` +
`&contract=${asset.nft_contract_address}` +
`&token_id=${asset.nft_token_id}`;
}
return url;
}

export function getFaqUrl() {
return 'https://docs.captureapp.xyz/faq';
}
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
"shares": {
"copyNid": "Copy Nid",
"downloadC2pa": "Download C2PA",
"shareBlockchainProof": "Share Blockchain Proof",
"shareCapturePage": "Social Share",
"viewBlockchainProof": "View Blockchain Proof"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
"shares": {
"copyNid": "複製 Nid",
"downloadC2pa": "下載 C2PA",
"shareBlockchainProof": "分享區塊鏈證明",
"shareCapturePage": "社群分享",
"viewBlockchainProof": "檢視區塊鏈證明"
},
"error": {
Expand Down

0 comments on commit fe104a1

Please sign in to comment.