diff --git a/packages/web/src/stage/crew/photographer/Photographer.ts b/packages/web/src/stage/crew/photographer/Photographer.ts index aac4b31b523..2df7704baa9 100644 --- a/packages/web/src/stage/crew/photographer/Photographer.ts +++ b/packages/web/src/stage/crew/photographer/Photographer.ts @@ -221,7 +221,9 @@ export class Photographer implements StageCrewMember { } if (event instanceof ActivityStarts || event instanceof ActivityFinished) { - this.photoTakingStrategy.considerTakingPhoto(event, this.stage); + this.photoTakingStrategy.considerTakingPhoto(event, this.stage).then( (artifact) => { + if (artifact) this.stage.announce(artifact); + }) } } } diff --git a/packages/web/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts b/packages/web/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts index a99d94fbd83..c3795ec5412 100644 --- a/packages/web/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +++ b/packages/web/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts @@ -27,7 +27,7 @@ export abstract class PhotoTakingStrategy { * @param stage * The Stage that holds reference to the Actor in the spotlight */ - async considerTakingPhoto(event: ActivityStarts | ActivityFinished, stage: Stage): Promise { + async considerTakingPhoto(event: ActivityStarts | ActivityFinished, stage: Stage): Promise { if (! this.shouldTakeAPhotoOf(event)) { return void 0; } @@ -61,18 +61,21 @@ export abstract class PhotoTakingStrategy { context = [ capabilities.platformName, capabilities.browserName, capabilities.browserVersion ], photoName = this.combinedNameFrom(...context, nameSuffix); - stage.announce(new ActivityRelatedArtifactGenerated( + const artifact = new ActivityRelatedArtifactGenerated( event.sceneId, event.activityId, photoName, Photo.fromBase64(screenshot), stage.currentTime(), - )); + ) - return stage.announce(new AsyncOperationCompleted( + stage.announce(new AsyncOperationCompleted( id, stage.currentTime(), )); + + return new Promise( (resolve) => + resolve(artifact)); } catch (error) { if (this.shouldIgnore(error)) {