maps managment advancement

This commit is contained in:
MathieuG-P
2022-11-07 17:09:19 +01:00
parent 5e2dd10035
commit cd8dae5976
20 changed files with 515 additions and 29 deletions
+10 -2
View File
@@ -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);}
+2 -2
View File
@@ -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));
}
}