mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
maps managment advancement
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import { IframeModal } from "renderer/components/modal/modal-types/iframe-modal.component";
|
||||
import { IpcService } from "./ipc.service";
|
||||
import { ModalService } from "./modale.service";
|
||||
|
||||
export class LinkOpenerService{
|
||||
|
||||
private static instance: LinkOpenerService;
|
||||
|
||||
private readonly ipcService: IpcService
|
||||
private readonly ipcService: IpcService;
|
||||
private readonly modals: ModalService;
|
||||
|
||||
public static getInstance(): LinkOpenerService{
|
||||
if(!LinkOpenerService.instance){ LinkOpenerService.instance = new LinkOpenerService(); }
|
||||
@@ -13,9 +16,14 @@ export class LinkOpenerService{
|
||||
|
||||
private constructor(){
|
||||
this.ipcService = IpcService.getInstance();
|
||||
this.modals = ModalService.getInsance();
|
||||
}
|
||||
|
||||
public open(url: string): void{
|
||||
public open(url: string, internal?: boolean): void{
|
||||
if(internal){
|
||||
this.modals.openModal(IframeModal, url);
|
||||
return;
|
||||
}
|
||||
this.ipcService.sendLazy("new-window", {args: url});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ export class MapsManagerService {
|
||||
}
|
||||
|
||||
public getMaps(version?: BSVersion): Observable<BsmLocalMap[]>{
|
||||
console.log("get maps")
|
||||
return new Observable(obs => {
|
||||
this.ipcService.send<BsmLocalMap[], BSVersion>("get-version-maps", {args: version}).then(res => {
|
||||
if(!res.success){ return obs.next(null);}
|
||||
|
||||
@@ -24,7 +24,7 @@ export class PageStateService {
|
||||
}
|
||||
|
||||
public getRoute(): string{
|
||||
return this.location$.value.pathname;
|
||||
return this.location$.value?.pathname;
|
||||
}
|
||||
|
||||
public get state$(): Observable<unknown>{
|
||||
@@ -32,7 +32,7 @@ export class PageStateService {
|
||||
}
|
||||
|
||||
public get route$(): Observable<string>{
|
||||
return this.location$.pipe(map(location => location.pathname));
|
||||
return this.location$.pipe(map(location => location?.pathname));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user