import { Injectable } from '@angular/core';
import {VoiceService} from "./services/voice.service";

@Injectable({
  providedIn: 'root'
})
export class ToastService {

  constructor(private voiceService:VoiceService) { }
  public isShown = false;
  public text = '';

  public showToast(msgText: string, timeout: number) {
    this.text = msgText;
    this.isShown = true;
    this.voiceService.playAudio(this.voiceService.getAudioUrl(msgText));
    setTimeout(() => this.isShown = false, timeout);
  }
}
