@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.
@@ -11368,7 +11368,7 @@ var SpeechRecognitionService = /** @class */ (function () {
11368
11368
  if (this.isListening) {
11369
11369
  speechSubject.error('Already listening');
11370
11370
  }
11371
- this.hasMicrophoneAccess().then(function (hasAccess) {
11371
+ this.hasMicrophoneAccess.then(function (hasAccess) {
11372
11372
  if (!hasAccess) {
11373
11373
  _this.toastService.show({ severity: 'error', text: _this.translateService.instant('platform.angular_components.no_microphone_permission') });
11374
11374
  speechSubject.error('Microphone access is disabled');
@@ -11447,43 +11447,48 @@ var SpeechRecognitionService = /** @class */ (function () {
11447
11447
  this.recognition.maxAlternatives = 1;
11448
11448
  this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
11449
11449
  };
11450
- SpeechRecognitionService.prototype.hasMicrophoneAccess = function () {
11451
- return __awaiter(this, void 0, void 0, function () {
11452
- var permission, stream, _a, _b;
11453
- return __generator(this, function (_c) {
11454
- switch (_c.label) {
11455
- case 0:
11456
- _c.trys.push([0, 6, , 7]);
11457
- return [4 /*yield*/, navigator.permissions.query({ name: 'microphone' })];
11458
- case 1:
11459
- permission = _c.sent();
11460
- if (permission.state === 'denied') {
11461
- return [2 /*return*/, false];
11462
- }
11463
- if (permission.state === 'granted') {
11464
- return [2 /*return*/, true];
11465
- }
11466
- if (!(permission.state === 'prompt')) return [3 /*break*/, 5];
11467
- _c.label = 2;
11468
- case 2:
11469
- _c.trys.push([2, 4, , 5]);
11470
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia({ audio: true })];
11471
- case 3:
11472
- stream = _c.sent();
11473
- stream.getTracks().forEach(function (t) { return t.stop(); });
11474
- return [2 /*return*/, true];
11475
- case 4:
11476
- _a = _c.sent();
11477
- return [2 /*return*/, false];
11478
- case 5: return [2 /*return*/, false];
11479
- case 6:
11480
- _b = _c.sent();
11481
- return [2 /*return*/, false];
11482
- case 7: return [2 /*return*/];
11483
- }
11484
- });
11485
- });
11486
- };
11450
+ Object.defineProperty(SpeechRecognitionService.prototype, "hasMicrophoneAccess", {
11451
+ get: function () {
11452
+ var _this = this;
11453
+ return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
11454
+ var permission;
11455
+ var _this = this;
11456
+ return __generator(this, function (_a) {
11457
+ switch (_a.label) {
11458
+ case 0: return [4 /*yield*/, navigator.permissions.query({ name: 'microphone' })];
11459
+ case 1:
11460
+ permission = _a.sent();
11461
+ if (permission.state === 'denied') {
11462
+ resolve(false);
11463
+ }
11464
+ else if (permission.state === 'granted') {
11465
+ resolve(true);
11466
+ }
11467
+ else if (permission.state === 'prompt') {
11468
+ try {
11469
+ navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {
11470
+ stream.getTracks().forEach(function (t) { return t.stop(); });
11471
+ }).catch(function () {
11472
+ resolve(false);
11473
+ });
11474
+ permission.onchange = function () {
11475
+ _this.ngZone.run(function () {
11476
+ resolve(permission.state === 'granted' ? true : false);
11477
+ });
11478
+ };
11479
+ }
11480
+ catch (error) {
11481
+ resolve(false);
11482
+ }
11483
+ }
11484
+ return [2 /*return*/];
11485
+ }
11486
+ });
11487
+ }); });
11488
+ },
11489
+ enumerable: true,
11490
+ configurable: true
11491
+ });
11487
11492
  SpeechRecognitionService.ctorParameters = function () { return [
11488
11493
  { type: LocaleService },
11489
11494
  { type: NgZone },