refactor(xtream): use epg runtime capability only

This commit is contained in:
4gray committed 2026-05-22 13:34:37 +03:00
1 parent 465b1b5559
commit 5cf7ab9358
2 files changed
+4 -28

No files matched your search

@@ -1,10 +1,6 @@
import { TestBed } from '@angular/core/testing';
import { signalStore, withState } from '@ngrx/signals';
import {
DataService,
RuntimeCapabilitiesService,
SettingsStore,
} from '@iptvnator/services';
import { RuntimeCapabilitiesService, SettingsStore } from '@iptvnator/services';
import { EpgItem } from '@iptvnator/shared/interfaces';
import { XtreamApiService } from '../../services/xtream-api.service';
import { XtreamXmltvFallbackService } from '../../services/xtream-xmltv-fallback.service';
@@ -48,7 +44,6 @@ function buildProgram(
interface TestStoreSetup {
appEnvironment?: 'electron' | 'pwa';
isElectron?: boolean;
selectedItem: { xtream_id: number; epg_channel_id?: string | null };
preferUploaded?: boolean;
}
@@ -82,18 +77,6 @@ function configureStore(setup: TestStoreSetup) {
TestBed.configureTestingModule({
providers: [
TestEpgStore,
{
provide: DataService,
useValue: {
getAppEnvironment: jest.fn(
() => setup.appEnvironment ?? 'electron'
),
isElectron: setup.isElectron ?? true,
supportsEpg:
setup.appEnvironment !== 'pwa' &&
(setup.isElectron ?? true),
},
},
{
provide: RuntimeCapabilitiesService,
useValue: {
@@ -183,7 +166,6 @@ describe('withEpg', () => {
it('does not load Xtream or XMLTV EPG in browser/PWA mode', async () => {
const { store, xtreamApiService, fallbackService } = configureStore({
appEnvironment: 'pwa',
isElectron: false,
selectedItem: { xtream_id: 101, epg_channel_id: 'rtl.de' },
});
@@ -8,7 +8,6 @@ import {
} from '@ngrx/signals';
import { EpgItem } from '@iptvnator/shared/interfaces';
import {
DataService,
RuntimeCapabilitiesService,
SettingsStore,
} from '@iptvnator/services';
@@ -84,7 +83,6 @@ export function withEpg() {
withMethods((store) => {
const apiService = inject(XtreamApiService);
const dataService = inject(DataService);
const fallbackService = inject(XtreamXmltvFallbackService);
const runtime = inject(RuntimeCapabilitiesService);
const settingsStore = inject(SettingsStore);
@@ -116,13 +114,9 @@ export function withEpg() {
credentials: XtreamCredentials,
xtreamId: number
): Promise<EpgItem[]> =>
dataService.isElectron
? apiService.getFullEpg(credentials, xtreamId, {
suppressErrorLog: true,
})
: apiService.getShortEpg(credentials, xtreamId, 10, {
suppressErrorLog: true,
});
apiService.getFullEpg(credentials, xtreamId, {
suppressErrorLog: true,
});
return {
/**