fix: update environment detection to use Tauri instead of Electron for service worker registration

This commit is contained in:
4gray committed 2025-03-10 22:17:12 +01:00
1 parent 119a7b156b
commit ef2b42f3f7
1 file changed
+2 -12
+2 -12
View File
@@ -13,6 +13,7 @@ import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { isTauri } from '@tauri-apps/api/core';
import { NgxIndexedDBModule, NgxIndexedDBService } from 'ngx-indexed-db';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { NgxWhatsNewModule } from 'ngx-whats-new';
@@ -33,17 +34,6 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
/**
* Returns true if the application runs in the electron based environment.
*/
function isElectron() {
return !!(window && window.process && (window.process as any).type);
}
function isTauri() {
return '__TAURI_INTERNALS__' in window || '__TAURI__' in window;
}
/**
* Conditionally imports the necessary service based on the current environment
*/
@@ -78,7 +68,7 @@ export function DataFactory() {
},
}),
ServiceWorkerModule.register('ngsw-worker.js', {
enabled: AppConfig.production && !isElectron(),
enabled: AppConfig.production && !isTauri(),
registrationStrategy: 'registerWhenStable:30000',
}),
StoreModule.forRoot({