@seniorsistemas/angular-components 17.26.9-bugfix-sds-309-cfd66723 → 17.26.9-bugfix-sds-309-1338ba18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11513,7 +11513,7 @@
11513
11513
  if (this.isListening) {
11514
11514
  speechSubject.error('Already listening');
11515
11515
  }
11516
- this.hasMicrophoneAccess().then(function (hasAccess) {
11516
+ this.hasMicrophoneAccess.then(function (hasAccess) {
11517
11517
  if (!hasAccess) {
11518
11518
  _this.toastService.show({ severity: 'error', text: _this.translateService.instant('platform.angular_components.no_microphone_permission') });
11519
11519
  speechSubject.error('Microphone access is disabled');
@@ -11592,43 +11592,48 @@
11592
11592
  this.recognition.maxAlternatives = 1;
11593
11593
  this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
11594
11594
  };
11595
- SpeechRecognitionService.prototype.hasMicrophoneAccess = function () {
11596
- return __awaiter(this, void 0, void 0, function () {
11597
- var permission, stream, _a, _b;
11598
- return __generator(this, function (_c) {
11599
- switch (_c.label) {
11600
- case 0:
11601
- _c.trys.push([0, 6, , 7]);
11602
- return [4 /*yield*/, navigator.permissions.query({ name: 'microphone' })];
11603
- case 1:
11604
- permission = _c.sent();
11605
- if (permission.state === 'denied') {
11606
- return [2 /*return*/, false];
11607
- }
11608
- if (permission.state === 'granted') {
11609
- return [2 /*return*/, true];
11610
- }
11611
- if (!(permission.state === 'prompt')) return [3 /*break*/, 5];
11612
- _c.label = 2;
11613
- case 2:
11614
- _c.trys.push([2, 4, , 5]);
11615
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia({ audio: true })];
11616
- case 3:
11617
- stream = _c.sent();
11618
- stream.getTracks().forEach(function (t) { return t.stop(); });
11619
- return [2 /*return*/, true];
11620
- case 4:
11621
- _a = _c.sent();
11622
- return [2 /*return*/, false];
11623
- case 5: return [2 /*return*/, false];
11624
- case 6:
11625
- _b = _c.sent();
11626
- return [2 /*return*/, false];
11627
- case 7: return [2 /*return*/];
11628
- }
11629
- });
11630
- });
11631
- };
11595
+ Object.defineProperty(SpeechRecognitionService.prototype, "hasMicrophoneAccess", {
11596
+ get: function () {
11597
+ var _this = this;
11598
+ return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
11599
+ var permission;
11600
+ var _this = this;
11601
+ return __generator(this, function (_a) {
11602
+ switch (_a.label) {
11603
+ case 0: return [4 /*yield*/, navigator.permissions.query({ name: 'microphone' })];
11604
+ case 1:
11605
+ permission = _a.sent();
11606
+ if (permission.state === 'denied') {
11607
+ resolve(false);
11608
+ }
11609
+ else if (permission.state === 'granted') {
11610
+ resolve(true);
11611
+ }
11612
+ else if (permission.state === 'prompt') {
11613
+ try {
11614
+ navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {
11615
+ stream.getTracks().forEach(function (t) { return t.stop(); });
11616
+ }).catch(function () {
11617
+ resolve(false);
11618
+ });
11619
+ permission.onchange = function () {
11620
+ _this.ngZone.run(function () {
11621
+ resolve(permission.state === 'granted' ? true : false);
11622
+ });
11623
+ };
11624
+ }
11625
+ catch (error) {
11626
+ resolve(false);
11627
+ }
11628
+ }
11629
+ return [2 /*return*/];
11630
+ }
11631
+ });
11632
+ }); });
11633
+ },
11634
+ enumerable: true,
11635
+ configurable: true
11636
+ });
11632
11637
  SpeechRecognitionService.ctorParameters = function () { return [
11633
11638
  { type: LocaleService },
11634
11639
  { type: core.NgZone },