Skip to content

Commit

Permalink
🚸 Set DRM option on ISCN update if current is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Jan 20, 2025
1 parent a5fba17 commit 85f079c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 6 additions & 2 deletions components/IscnRegisterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
:label="$t('IscnRegisterForm.label.drm')"
class="mb-[12px]"
>
<CheckBox v-model="isUseArweaveLink">
<CheckBox v-model="isUseArweaveLinkChecked">
{{ $t('IscnRegisterForm.label.drm.details') }}
</CheckBox>
</FormField>
Expand Down Expand Up @@ -813,7 +813,7 @@ export default class IscnRegisterForm extends Vue {
isRegisterNumbersProtocolAsset = false
numbersProtocolAssetIds = new Map<string, string>()
isUseArweaveLink= false
isUseArweaveLinkChecked= false
isOpenFileInfoDialog = false
isOpenAuthorDialog = false
isOpenWarningSnackbar = false
Expand All @@ -836,6 +836,10 @@ export default class IscnRegisterForm extends Vue {
language: string = ''
shouldShowMoreSettings: boolean = false
get isUseArweaveLink() {
return this.shouldShowDRMOption && this.isUseArweaveLinkChecked
}
get ipfsHashList() {
const list = []
if (this.ipfsHash) {
Expand Down
14 changes: 11 additions & 3 deletions pages/edit/_iscnId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
:label="$t('IscnRegisterForm.label.drm')"
class="mb-[12px]"
>
<CheckBox v-model="isUseArweaveLink">
<CheckBox v-model="isUseArweaveLinkChecked">
{{ $t('IscnRegisterForm.label.drm.details') }}
</CheckBox>
</FormField>
Expand Down Expand Up @@ -251,6 +251,7 @@ import { ISCN_PREFIX, ISCN_GAS_FEE, UPDATE_ISCN_GAS_MULTIPLIER } from '~/constan
import { logTrackerEvent } from '~/utils/logger'
import { signISCN } from '~/utils/cosmos/iscn/sign'
import { extractIscnIdPrefix } from '~/utils/ui'
import { LIKE_CO_API_ROOT } from '~/constant/api';
const walletModule = namespace('wallet')
Expand Down Expand Up @@ -300,7 +301,7 @@ export default class EditIscnPage extends Vue {
publisher: string = ''
datePublished: string = ''
isUseArweaveLink= false
isUseArweaveLinkChecked = false
shouldShowUploadSection: boolean = false
shouldShowMoreSettings: boolean = false
uploadFileRecords: any = null
Expand All @@ -318,6 +319,10 @@ export default class EditIscnPage extends Vue {
latestVersion: number | string = ''
get isUseArweaveLink() {
return this.shouldShowDRMOption && this.isUseArweaveLinkChecked
}
get combinedArweaveIdList() {
return this.uploadArweaveIdList || []
}
Expand Down Expand Up @@ -355,7 +360,7 @@ export default class EditIscnPage extends Vue {
if (this.combinedArweaveLinks.length) {
array.push(...this.combinedArweaveLinks)
}
if (!this.isUseArweaveLink && this.uploadIpfsHashList.length) {
if (!this.isUseArweaveLinkChecked && this.uploadIpfsHashList.length) {
array.push(...this.uploadIpfsHashList.map((ipfs) => this.formatIpfs(ipfs) as string))
}
if (this.customContentFingerprints.length) {
Expand Down Expand Up @@ -401,6 +406,9 @@ export default class EditIscnPage extends Vue {
this.isbn = this.contentMetadata.isbn || ''
this.publisher = this.contentMetadata.publisher || ''
this.datePublished = this.contentMetadata.datePublished || ''
this.isUseArweaveLinkChecked = !!this.contentFingerprints.find(
link => link.startsWith(LIKE_CO_API_ROOT),
)
}
}
Expand Down

0 comments on commit 85f079c

Please sign in to comment.