20 lines
608 B
TypeScript
20 lines
608 B
TypeScript
import { BrowserApi } from "../../browser/browserApi";
|
|
|
|
import { Injectable } from "@angular/core";
|
|
import { CanActivate, Router } from "@angular/router";
|
|
|
|
import { UnauthGuardService } from "jslib-angular/services/unauth-guard.service";
|
|
|
|
@Injectable()
|
|
export class LaunchGuardService implements CanActivate {
|
|
constructor(private router: Router, private unauthGuardService: UnauthGuardService) {}
|
|
|
|
async canActivate() {
|
|
if (BrowserApi.getBackgroundPage() == null) {
|
|
this.router.navigate(["private-mode"]);
|
|
return false;
|
|
}
|
|
return await this.unauthGuardService.canActivate();
|
|
}
|
|
}
|