@@ -332,18 +332,12 @@ export class DetailsPage {
332332 ) ,
333333 this . translocoService . selectTranslateObject ( {
334334 'message.transferOwnership' : null ,
335- 'details.error.transferOwnershipActionIsUnavailable' : null ,
336335 'message.viewOnCaptureClub' : null ,
337- 'details.error.viewOnCaptureClubIsUnavailable' : null ,
338336 'message.deregisterFromNetwork' : null ,
339337 'message.mintNftToken' : null ,
340- 'details.error.mintNftTokenIsUnavailable' : null ,
341338 'message.viewBlockchainCertificate' : null ,
342- 'details.error.viewBlockchainCertificateIsUnavailable' : null ,
343339 'message.viewSupportingVideoOnIpfs' : null ,
344- 'details.error.viewSupportingVideoOnIpfsIsUnavailable' : null ,
345340 networkActions : null ,
346- 'details.error.networkActionsAreUnavailable' : null ,
347341 } ) ,
348342 ] )
349343 . pipe (
@@ -355,121 +349,83 @@ export class DetailsPage {
355349 postCreationWorkflowCompleted ,
356350 [
357351 messageTransferOwnership ,
358- messageTransferOwnershipIsUnavailable ,
359352 messageViewOnCaptureClub ,
360- messageviewOnCaptureClubIsUnavailable ,
361353 messageDeregisterFromNetwork ,
362354 messageMintNftToken ,
363- messageMintNftTokenIsUnavailable ,
364355 messageViewBlockchainCertificate ,
365- messageViewBlockchainCertificateIsUnavailable ,
366356 messageViewSupportingVideoOnIpfs ,
367- messageviewSupportingVideoOnIpfsIsUnavailable ,
368357 messageNetworkActions ,
369- messageNetworkActionsAreUnavailable ,
370358 ] ,
371359 ] ) =>
372360 new Promise < void > ( resolve => {
373361 const buttons : ActionSheetButton [ ] = [ ] ;
374- buttons . push ( {
375- text : messageViewSupportingVideoOnIpfs ,
376- handler :
377- postCreationWorkflowCompleted &&
378- diaBackendAsset ?. supporting_file
379- ? ( ) => {
380- this . openIpfsSupportingVideo ( ) ;
381- }
382- : ( ) => {
383- this . errorService
384- . toastError$ (
385- messageviewSupportingVideoOnIpfsIsUnavailable
386- )
387- . toPromise ( ) ;
388- } ,
389- } ) ;
390-
391- buttons . push ( {
392- text : messageTransferOwnership ,
393- handler :
394- postCreationWorkflowCompleted && detailedCapture . id
395- ? ( ) => {
396- this . openContactSelectionDialog ( ) ;
397- resolve ( ) ;
398- }
399- : ( ) => {
400- this . errorService
401- . toastError$ ( messageTransferOwnershipIsUnavailable )
402- . toPromise ( ) ;
403- } ,
404- } ) ;
405-
406- buttons . push ( {
407- text : messageViewOnCaptureClub ,
408- handler :
409- diaBackendAsset ?. source_type === 'store'
410- ? ( ) => {
411- this . openCaptureClub ( ) ;
412- }
413- : ( ) => {
414- this . errorService
415- . toastError$ ( messageviewOnCaptureClubIsUnavailable )
416- . toPromise ( ) ;
417- } ,
418- } ) ;
362+ if (
363+ postCreationWorkflowCompleted &&
364+ diaBackendAsset ?. supporting_file
365+ ) {
366+ buttons . push ( {
367+ text : messageViewSupportingVideoOnIpfs ,
368+ handler : ( ) => {
369+ this . openIpfsSupportingVideo ( ) ;
370+ } ,
371+ } ) ;
372+ }
373+ if ( postCreationWorkflowCompleted && detailedCapture . id ) {
374+ buttons . push ( {
375+ text : messageTransferOwnership ,
376+ handler : ( ) => {
377+ this . openContactSelectionDialog ( ) ;
378+ resolve ( ) ;
379+ } ,
380+ } ) ;
381+ }
382+ if ( diaBackendAsset ?. source_type === 'store' ) {
383+ buttons . push ( {
384+ text : messageViewOnCaptureClub ,
385+ handler : ( ) => {
386+ this . openCaptureClub ( ) ;
387+ } ,
388+ } ) ;
389+ }
419390 buttons . push ( {
420391 text : messageDeregisterFromNetwork ,
421392 handler : ( ) => {
422393 this . remove ( ) . then ( ( ) => resolve ( ) ) ;
423394 } ,
424395 } ) ;
425-
426- buttons . push ( {
427- text : messageMintNftToken ,
428- handler :
429- postCreationWorkflowCompleted &&
430- diaBackendAsset ?. nft_token_id === null
431- ? ( ) => {
432- this . mintNft ( ) . then ( ( ) => resolve ( ) ) ;
433- }
434- : ( ) => {
435- this . errorService
436- . toastError$ ( messageMintNftTokenIsUnavailable )
437- . toPromise ( ) ;
438- } ,
439- role : 'destructive' ,
440- } ) ;
441- buttons . push ( {
442- text : messageViewBlockchainCertificate ,
443- handler :
444- postCreationWorkflowCompleted && detailedCapture . id
445- ? ( ) => {
446- this . openCertificate ( ) ;
447- resolve ( ) ;
448- }
449- : ( ) => {
450- this . errorService
451- . toastError$ (
452- messageViewBlockchainCertificateIsUnavailable
453- )
454- . toPromise ( ) ;
455- } ,
456- } ) ;
457- buttons . push ( {
458- text : messageNetworkActions ,
459- handler : postCreationWorkflowCompleted
460- ? ( ) => {
461- this . router . navigate (
462- [ 'actions' , { id : detailedCapture . id } ] ,
463- { relativeTo : this . route }
464- ) ;
465- resolve ( ) ;
466- }
467- : ( ) => {
468- this . errorService
469- . toastError$ ( messageNetworkActionsAreUnavailable )
470- . toPromise ( ) ;
471- } ,
472- } ) ;
396+ if (
397+ postCreationWorkflowCompleted &&
398+ diaBackendAsset ?. nft_token_id === null
399+ ) {
400+ buttons . push ( {
401+ text : messageMintNftToken ,
402+ handler : ( ) => {
403+ this . mintNft ( ) . then ( ( ) => resolve ( ) ) ;
404+ } ,
405+ role : 'destructive' ,
406+ } ) ;
407+ }
408+ if ( postCreationWorkflowCompleted && detailedCapture . id ) {
409+ buttons . push ( {
410+ text : messageViewBlockchainCertificate ,
411+ handler : ( ) => {
412+ this . openCertificate ( ) ;
413+ resolve ( ) ;
414+ } ,
415+ } ) ;
416+ }
417+ if ( postCreationWorkflowCompleted ) {
418+ buttons . push ( {
419+ text : messageNetworkActions ,
420+ handler : ( ) => {
421+ this . router . navigate (
422+ [ 'actions' , { id : detailedCapture . id } ] ,
423+ { relativeTo : this . route }
424+ ) ;
425+ resolve ( ) ;
426+ } ,
427+ } ) ;
428+ }
473429 this . actionSheetController
474430 . create ( { buttons } )
475431 . then ( sheet => sheet . present ( ) ) ;
0 commit comments