frontend: Refactors recording URL generation

Moves recording URL generation to the component using the URL.

This provides more flexibility in how the URL is generated,
allowing the component to handle different scenarios.
The service is no longer responsible for generating the URL.
This commit is contained in:
Carlos Santos 2026-01-12 20:13:26 +01:00
parent 8afed3a2f8
commit 7cddb59e2d
2 changed files with 14 additions and 5 deletions

View File

@ -15,7 +15,6 @@ import { MatInputModule } from '@angular/material/input';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatRadioModule } from '@angular/material/radio';
import { MatTooltipModule } from '@angular/material/tooltip';
import { RecordingService } from '../../services/recording.service';
@Component({
selector: 'ov-share-recording-dialog',
@ -46,8 +45,12 @@ export class RecordingShareDialogComponent implements OnInit {
copied = false;
constructor(
@Inject(MAT_DIALOG_DATA) public data: { recordingId: string; recordingUrl?: string },
private recordingService: RecordingService,
@Inject(MAT_DIALOG_DATA)
public data: {
recordingId: string;
recordingUrl?: string;
generateRecordingUrl?: (privateAccess: boolean) => Promise<{ url: string }>;
},
private clipboard: Clipboard
) {
this.recordingUrl = data.recordingUrl;
@ -63,12 +66,17 @@ export class RecordingShareDialogComponent implements OnInit {
}
async getRecordingUrl() {
if (!this.data.generateRecordingUrl) {
this.erroMessage = 'URL generation function not available.';
return;
}
this.loading = true;
this.erroMessage = undefined;
try {
const privateAccess = this.accessType === 'private';
const { url } = await this.recordingService.generateRecordingUrl(this.data.recordingId, privateAccess);
const { url } = await this.data.generateRecordingUrl(privateAccess);
this.recordingUrl = url;
} catch (error) {
this.erroMessage = 'Failed to generate recording URL. Please try again later.';

View File

@ -269,7 +269,8 @@ export class RecordingService {
width: '450px',
data: {
recordingId,
recordingUrl
recordingUrl,
generateRecordingUrl: (privateAccess: boolean) => this.generateRecordingUrl(recordingId, privateAccess)
},
panelClass: 'ov-meet-dialog'
});