diff --git a/src/app/features/home/details/details.page.ts b/src/app/features/home/details/details.page.ts index 4da9d097b..93acb15f0 100644 --- a/src/app/features/home/details/details.page.ts +++ b/src/app/features/home/details/details.page.ts @@ -302,7 +302,7 @@ export class DetailsPage { const result = await this.confirmAlert.present({ message: this.translocoService.translate( - 'message.assetBecomePublicAfterSharing' + 'message.assetBecomePublicFor24Hours' ) + '!', }); if (result) { diff --git a/src/app/shared/share/share.service.ts b/src/app/shared/share/share.service.ts index 8ecbc52d2..b087b744d 100644 --- a/src/app/shared/share/share.service.ts +++ b/src/app/shared/share/share.service.ts @@ -2,7 +2,10 @@ import { Injectable } from '@angular/core'; import { Share } from '@capacitor/share'; import { TranslocoService } from '@ngneat/transloco'; import { catchError } from 'rxjs/operators'; -import { getAssetProfileUrl } from '../../utils/url'; +import { + getAssetProfileUrl, + getAssetProfileUrlWithTmpToken, +} from '../../utils/url'; import { DiaBackendAsset, DiaBackendAssetRepository, @@ -22,9 +25,13 @@ export class ShareService { ) {} async share(asset: DiaBackendAsset) { + const tmpToken = await this.diaBackendAssetRepository + .createTemporaryShareToken$(asset.id) + .toPromise(); + return Share.share({ text: this.defaultShareText, - url: await this.setPublicAndGetLink(asset), + url: getAssetProfileUrlWithTmpToken(asset.id, tmpToken), }); } diff --git a/src/app/utils/url.ts b/src/app/utils/url.ts index 969c647a4..b4b7bd9ff 100644 --- a/src/app/utils/url.ts +++ b/src/app/utils/url.ts @@ -13,7 +13,7 @@ export function getAssetProfileUrl(id: string, token?: string) { export function getAssetProfileUrlWithTmpToken(id: string, tmpToken?: string) { if (tmpToken) { - return `https://authmedia.net/asset-profile?cid=${id}&tmp_token=${tmpToken}`; + return `https://authmedia.net/asset-profile?cid=${id}&token=${tmpToken}`; } return `https://authmedia.net/asset-profile?cid=${id}`; } diff --git a/src/assets/i18n/en-us.json b/src/assets/i18n/en-us.json index 956fd9d69..f16fd3600 100644 --- a/src/assets/i18n/en-us.json +++ b/src/assets/i18n/en-us.json @@ -183,6 +183,7 @@ "copyIpfsAddress": "Copy IPFS address", "shareAssetProfile": "Share Asset Profile", "assetBecomePublicAfterSharing": "This asset will become public after sharing", + "assetBecomePublicFor24Hours": "Anyone with the link will be able to access the asset in the next 24 hours", "mintNftToken": "Mint NFT token", "mintNftAlert": "Once the NFT is minted, photo and its information can be accessed publicly. Do you still want to proceed?", "sentSuccessfully": "Sent Successfully", diff --git a/src/assets/i18n/zh-tw.json b/src/assets/i18n/zh-tw.json index 23c1fe697..abb6df09f 100644 --- a/src/assets/i18n/zh-tw.json +++ b/src/assets/i18n/zh-tw.json @@ -183,6 +183,7 @@ "copyIpfsAddress": "複製 IPFS 位址", "shareAssetProfile": "分享資產檔案", "assetBecomePublicAfterSharing": "該資產將在分享後公開", + "assetBecomePublicFor24Hours": "其他用戶在接下來的 24 小時將可透過此連結存取影像", "mintNftToken": "鑄造 NFT 代幣", "mintNftAlert": "NFT 代幣鑄造後,影像以及所有資訊都將可被公開檢視。確定要繼續嗎?", "sentSuccessfully": "成功送出",