import { Component, Inject, OnInit } from "@angular/core";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
import { CordovaService } from "../../services/cordova.service";
import { NanoDialogBase } from "../nano-base-dialog";

@Component({
  selector: "app-outbound-link-dialog",
  templateUrl: "./outbound-link-dialog.component.html",
  styleUrls: ["./outbound-link-dialog.component.scss"],
})
export class OutboundLinkDialogComponent
  extends NanoDialogBase<OutboundLinkDialogComponent>
  implements OnInit
{
  public linkHref: string;
  public linkDomain: string;

  constructor(
    public dialogRef: MatDialogRef<OutboundLinkDialogComponent>,
    @Inject(MAT_DIALOG_DATA) public location: any
  ) {
    super(dialogRef);

    this.linkHref = location.href;
    this.linkDomain = location.host;
  }

  ngOnInit(): void {}

  navigationAccepted(accepted: boolean): void {
    this.dialogRef.close(accepted);
  }
}
