import { FactoryProvider } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { ConfigService } from "@arrow/bom/config"; import { TranslateService } from "@ngx-translate/core"; import { AuthService } from '../auth.service'; import { AuthTokenService } from "../auth-token.service"; import { UserService } from "../user/user.service"; import { Utils } from "../utils.service"; import { DialogService } from "../dialog/dialog.service"; import { SocketsService } from "./sockets.service"; import { SignalRSocketsService} from "./signalr.sockets.service"; export function socketsServiceFactory(_config: ConfigService, _userService: UserService, _dialog: DialogService, _router: Router, _route: ActivatedRoute, _authService: AuthService, _authTokenService: AuthTokenService, _translate: TranslateService, _utilsService: Utils) { if (_config.shouldUseSignalR()) { return new SignalRSocketsService(_config, _userService, _dialog, _router, _route, _authService, _authTokenService, _translate, _utilsService); } else { return new SocketsService(_config, _userService, _dialog, _router, _route, _authService, _authTokenService, _translate, _utilsService); } } export const SocketsProvider: FactoryProvider = { provide: SocketsService, useFactory: socketsServiceFactory, deps: [ ConfigService, UserService, DialogService, Router, ActivatedRoute, AuthService, AuthTokenService, TranslateService, Utils ] };