From 2e16054fc3b453f4697d93e6283d3f5c92c032c2 Mon Sep 17 00:00:00 2001 From: 4gray Date: Sat, 30 Nov 2024 16:53:24 +0100 Subject: [PATCH] fix: add Tauri environment check in EpgService methods --- src/app/services/epg.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/services/epg.service.ts b/src/app/services/epg.service.ts index 1164c2d7e..cee1d803c 100644 --- a/src/app/services/epg.service.ts +++ b/src/app/services/epg.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Store } from '@ngrx/store'; import { TranslateService } from '@ngx-translate/core'; -import { invoke } from '@tauri-apps/api/core'; +import { invoke, isTauri } from '@tauri-apps/api/core'; import { BehaviorSubject, from } from 'rxjs'; import { catchError, map, tap } from 'rxjs/operators'; import { EpgProgram } from '../player/models/epg-program.model'; @@ -28,6 +28,7 @@ export class EpgService { * Fetches EPG from the given URLs */ fetchEpg(urls: string[]): void { + if (!isTauri()) return; this.showFetchSnackbar(); // Filter out empty URLs and send all URLs at once @@ -54,6 +55,7 @@ export class EpgService { * Gets EPG programs for a specific channel */ getChannelPrograms(channelId: string): void { + if (!isTauri()) return; console.log('Fetching EPG for channel ID:', channelId); from(invoke('get_channel_programs', { channelId })) .pipe(