mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-13 20:56:19 -08:00
refactor(workspace-shell): use runtime capabilities
This commit is contained in:
1 parent
6211bd2f94
commit
f894e5242b
5 files changed
+59
-5
No files matched your search
@@ -18,6 +18,8 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
expect(service.environment).toBe('pwa');
|
||||
expect(service.isPwa).toBe(true);
|
||||
expect(service.isElectron).toBe(false);
|
||||
expect(service.platform).toBeUndefined();
|
||||
expect(service.isMacOS).toBe(false);
|
||||
expect(service.supportsEpg).toBe(false);
|
||||
expect(service.supportsSqlite).toBe(false);
|
||||
expect(service.supportsDownloads).toBe(false);
|
||||
@@ -29,6 +31,7 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
|
||||
it('reports Electron capabilities from the available preload bridge methods', () => {
|
||||
testWindow.electron = {
|
||||
platform: 'darwin',
|
||||
dbGetAppPlaylists: jest.fn(),
|
||||
dbUpsertAppPlaylist: jest.fn(),
|
||||
dbGetAppState: jest.fn(),
|
||||
@@ -47,6 +50,8 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
expect(service.environment).toBe('electron');
|
||||
expect(service.isElectron).toBe(true);
|
||||
expect(service.isPwa).toBe(false);
|
||||
expect(service.platform).toBe('darwin');
|
||||
expect(service.isMacOS).toBe(true);
|
||||
expect(service.supportsEpg).toBe(true);
|
||||
expect(service.supportsSqlite).toBe(true);
|
||||
expect(service.supportsDownloads).toBe(true);
|
||||
@@ -64,6 +69,8 @@ describe('RuntimeCapabilitiesService', () => {
|
||||
const service = new RuntimeCapabilitiesService();
|
||||
|
||||
expect(service.environment).toBe('electron');
|
||||
expect(service.platform).toBeUndefined();
|
||||
expect(service.isMacOS).toBe(false);
|
||||
expect(service.supportsEpg).toBe(true);
|
||||
expect(service.supportsSqlite).toBe(false);
|
||||
expect(service.supportsDownloads).toBe(false);
|
||||
|
||||
@@ -22,6 +22,15 @@ export class RuntimeCapabilitiesService {
|
||||
return !this.isElectron;
|
||||
}
|
||||
|
||||
get platform(): string | undefined {
|
||||
const platform = this.electronBridge?.['platform'];
|
||||
return typeof platform === 'string' ? platform : undefined;
|
||||
}
|
||||
|
||||
get isMacOS(): boolean {
|
||||
return this.platform === 'darwin';
|
||||
}
|
||||
|
||||
get supportsEpg(): boolean {
|
||||
return this.isElectron;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user