import { Injectable , Injector } from '@angular/core' ; import { OverlayModalService } from '../../../../services/ux/overlay-modal' ; import { FeaturesService } from '../../../../services/features.service' ; import { Router } from '@angular/router' ; import { ActivityEntity } from '../activity.service' ; import { ActivityModalComponent } from './modal.component' ; import { MediaModalComponent } from '../../../media/modal/modal.component' ; @ Injectable ( ) export class ActivityModalCreatorService { constructor ( private overlayModal , private features , private router ) { } create ( entity , injector ) { if ( ! this . overlayModal . canOpenInModal ( ) ) { return ; } /**
         * NOTE: 'modal_source_url' is only used in the MediaModalComponent
         * and can be removed when it is replaced with ActivityModalComponent
         */ entity . modal_source_url = this . router . url ; if ( entity . type === 'comment' ) { entity . entity_guid = ( entity as any ) . attachment_guid ; } const modal = ActivityModalComponent ; this . overlayModal . create ( modal , { entity : entity } , { class : 'm-overlayModal--media' , } , injector ) . present ( ) ; } }