mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
refactor(settings): use runtime capabilities for platform state
This commit is contained in:
1 parent
615ad98566
commit
78a5a7af74
2 files changed
+8
-2
No files matched your search
@@ -705,6 +705,10 @@ describe('SettingsComponent', () => {
|
||||
.mockResolvedValue(undefined);
|
||||
browserFixture.detectChanges();
|
||||
|
||||
expect(browserComponent.isDesktop).toBe(false);
|
||||
expect(browserComponent.isPwa).toBe(true);
|
||||
expect(browserComponent.settingsForm.get('epgUrl')).toBeNull();
|
||||
|
||||
mockStore.overrideSelector(selectAllPlaylistsMeta, [
|
||||
createPlaylistMeta({ _id: 'browser-m3u' }),
|
||||
]);
|
||||
|
||||
@@ -43,6 +43,7 @@ import {
|
||||
PlaylistBackupImportSummary,
|
||||
PlaylistBackupService,
|
||||
PlaylistsService,
|
||||
RuntimeCapabilitiesService,
|
||||
} from '@iptvnator/services';
|
||||
import {
|
||||
EmbeddedMpvSupport,
|
||||
@@ -121,6 +122,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
private matDialog = inject(MatDialog);
|
||||
private playlistBackupService = inject(PlaylistBackupService);
|
||||
private readonly databaseService = inject(DatabaseService);
|
||||
private readonly runtime = inject(RuntimeCapabilitiesService);
|
||||
private readonly dialogData = inject<{ isDialog: boolean } | null>(
|
||||
MAT_DIALOG_DATA,
|
||||
{ optional: true }
|
||||
@@ -134,13 +136,13 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
readonly streamFormatEnum = StreamFormat;
|
||||
|
||||
/** Flag that indicates whether the app runs in electron environment */
|
||||
readonly isDesktop = !!window.electron;
|
||||
readonly isDesktop = this.runtime.isElectron;
|
||||
readonly embeddedMpvSupport = signal<EmbeddedMpvSupport | null>(null);
|
||||
readonly supportsEmbeddedMpv = computed(
|
||||
() => this.isDesktop && !!this.embeddedMpvSupport()?.supported
|
||||
);
|
||||
|
||||
isPwa = this.dataService.getAppEnvironment() === 'pwa';
|
||||
readonly isPwa = this.runtime.isPwa;
|
||||
|
||||
private readonly settingsCtx = inject(SettingsContextService);
|
||||
readonly activeSection = this.settingsCtx.activeSection;
|
||||
|
||||
Reference in new issue
Block a user