mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
refactor: simplify DataFactory and PwaService dependencies
Remove unnecessary parameters from DataFactory and PwaService constructor. The changes streamline the service initialization process by eliminating the unused HttpClient dependency in DataFactory and adjusting PwaService to inject HttpClient directly. This improves code clarity and reduces complexity.
This commit is contained in:
1 parent
25875bf721
commit
5a7d25548f
2 files changed
+9
-14
No files matched your search
@@ -48,17 +48,14 @@ function isTauri() {
|
||||
/**
|
||||
* Conditionally imports the necessary service based on the current environment
|
||||
*/
|
||||
export function DataFactory(
|
||||
ngxIndexedDBService: NgxIndexedDBService,
|
||||
http: HttpClient
|
||||
) {
|
||||
export function DataFactory() {
|
||||
if (isElectron()) {
|
||||
return new ElectronService();
|
||||
}
|
||||
if (isTauri()) {
|
||||
return new TauriService();
|
||||
}
|
||||
return new PwaService(http);
|
||||
return new PwaService();
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { ApplicationRef, inject, Injectable } from '@angular/core';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { SwUpdate } from '@angular/service-worker';
|
||||
import { Store } from '@ngrx/store';
|
||||
@@ -19,23 +19,21 @@ import { Playlist } from '../../../shared/playlist.interface';
|
||||
import { AppConfig } from '../../environments/environment';
|
||||
import * as PlaylistActions from '../state/actions';
|
||||
import { DataService } from './data.service';
|
||||
import { PlaylistsService } from './playlists.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PwaService extends DataService {
|
||||
appRef = inject(ApplicationRef);
|
||||
playlistService = inject(PlaylistsService);
|
||||
snackBar = inject(MatSnackBar);
|
||||
store = inject(Store);
|
||||
swUpdate = inject(SwUpdate);
|
||||
translateService = inject(TranslateService);
|
||||
private readonly http = inject(HttpClient);
|
||||
private readonly snackBar = inject(MatSnackBar);
|
||||
private readonly store = inject(Store);
|
||||
private readonly swUpdate = inject(SwUpdate);
|
||||
private readonly translateService = inject(TranslateService);
|
||||
|
||||
/** Proxy URL to avoid CORS issues */
|
||||
corsProxyUrl = AppConfig.BACKEND_URL;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
constructor() {
|
||||
super();
|
||||
console.log('PWA service initialized...');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user