@sumaris-net/ngx-components 2.4.68 → 2.4.70
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.
- package/esm2020/src/app/shared/audio/audio.mjs +20 -8
- package/esm2020/src/app/social/user-event/notification/user-event-notification.icon.mjs +3 -3
- package/fesm2015/sumaris-net.ngx-components.mjs +18 -9
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +21 -9
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -10476,6 +10476,10 @@ const SYSTEM_SOUNDS = [
|
|
|
10476
10476
|
{ assetId: 'beep-error', assetPath: 'assets/audio/beep-error.mp3', vibration: 1000 },
|
|
10477
10477
|
{ assetId: 'beep-notification', assetPath: 'assets/audio/beep-notification.mp3', vibration: [450, 150, 450] }
|
|
10478
10478
|
];
|
|
10479
|
+
const DEFAULT_AUDIO_MODE_RETURN = {
|
|
10480
|
+
audioMode: AudioManagement.AudioMode.NORMAL,
|
|
10481
|
+
label: 'Normal'
|
|
10482
|
+
};
|
|
10479
10483
|
class AudioProvider extends StartableService {
|
|
10480
10484
|
constructor(platform, audioManagement) {
|
|
10481
10485
|
super(platform);
|
|
@@ -10526,10 +10530,14 @@ class AudioProvider extends StartableService {
|
|
|
10526
10530
|
return this.play('startup');
|
|
10527
10531
|
}
|
|
10528
10532
|
async preload(sound) {
|
|
10533
|
+
if (!sound?.assetId)
|
|
10534
|
+
return; // Skip
|
|
10535
|
+
if (!!this._preloadedSounds[sound.assetId])
|
|
10536
|
+
return; // Already preloaded
|
|
10529
10537
|
if (isNil(this._audioType))
|
|
10530
10538
|
await this.ready();
|
|
10531
10539
|
const assetPath = (this._assetPathPrefix || '') + sound.assetPath;
|
|
10532
|
-
console.info(`[audio] Preloading
|
|
10540
|
+
console.info(`[audio] Preloading sound '${sound.assetId}', from file '${assetPath}'...`);
|
|
10533
10541
|
try {
|
|
10534
10542
|
if (this._audioType === 'native') {
|
|
10535
10543
|
await NativeAudio.preload({
|
|
@@ -10544,10 +10552,10 @@ class AudioProvider extends StartableService {
|
|
|
10544
10552
|
}
|
|
10545
10553
|
// Add to map
|
|
10546
10554
|
this._preloadedSounds[sound.assetId] = sound;
|
|
10547
|
-
console.info(`[audio] Preloading
|
|
10555
|
+
console.info(`[audio] Preloading sound '${sound.assetId}' [OK]`);
|
|
10548
10556
|
}
|
|
10549
10557
|
catch (err) {
|
|
10550
|
-
console.error(`[audio] Unable to preload
|
|
10558
|
+
console.error(`[audio] Unable to preload sound '${sound.assetId}', from file '${assetPath}': ${err && err.message || err}\n${err?.originalStack || ''}`);
|
|
10551
10559
|
}
|
|
10552
10560
|
}
|
|
10553
10561
|
async play(assetId, opts) {
|
|
@@ -10556,7 +10564,7 @@ class AudioProvider extends StartableService {
|
|
|
10556
10564
|
await this.ready();
|
|
10557
10565
|
const sound = this._preloadedSounds[assetId];
|
|
10558
10566
|
if (!sound) {
|
|
10559
|
-
throw Error(`Unable to find
|
|
10567
|
+
throw Error(`Unable to find sound '${assetId}'. Please call preload() before playing a sound.`);
|
|
10560
10568
|
}
|
|
10561
10569
|
// If silent: skip
|
|
10562
10570
|
if (this._audioMode === AudioManagement.AudioMode.SILENT)
|
|
@@ -10647,9 +10655,13 @@ class AudioProvider extends StartableService {
|
|
|
10647
10655
|
}
|
|
10648
10656
|
/* -- protected methods -- */
|
|
10649
10657
|
async readAudioMode() {
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10658
|
+
let value = await this.audioManagement.getAudioMode();
|
|
10659
|
+
value = {
|
|
10660
|
+
...DEFAULT_AUDIO_MODE_RETURN,
|
|
10661
|
+
...value
|
|
10662
|
+
};
|
|
10663
|
+
console.debug(`[audio] Detected audio mode {label: '${value.label}', audioMode: ${value.audioMode}}`);
|
|
10664
|
+
this._audioMode = value.audioMode;
|
|
10653
10665
|
}
|
|
10654
10666
|
}
|
|
10655
10667
|
AudioProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AudioProvider, deps: [{ token: i1.Platform }, { token: i2$1.AudioManagement, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -32754,10 +32766,10 @@ class UserEventNotificationIcon {
|
|
|
32754
32766
|
}
|
|
32755
32767
|
}
|
|
32756
32768
|
UserEventNotificationIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: UserEventNotificationIcon, deps: [{ token: APP_USER_EVENT_SERVICE, optional: true }, { token: AccountService }, { token: i1.PopoverController }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
32757
|
-
UserEventNotificationIcon.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: UserEventNotificationIcon, selector: "app-user-event-notification-icon", inputs: { debug: "debug", titleI18n: "titleI18n", disabled: "disabled", filter: "filter", autoHide: "autoHide" }, ngImport: i0, template: "<button\n
|
|
32769
|
+
UserEventNotificationIcon.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: UserEventNotificationIcon, selector: "app-user-event-notification-icon", inputs: { debug: "debug", titleI18n: "titleI18n", disabled: "disabled", filter: "filter", autoHide: "autoHide" }, ngImport: i0, template: "<button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n *ngIf=\"visible\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"countChanges | async\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >notifications\n </mat-icon>\n</button>\n\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i9.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i6$5.MatBadge, selector: "[matBadge]", inputs: ["matBadgeDisabled", "matBadgeColor", "matBadgeOverlap", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
32758
32770
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: UserEventNotificationIcon, decorators: [{
|
|
32759
32771
|
type: Component,
|
|
32760
|
-
args: [{ selector: 'app-user-event-notification-icon', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n
|
|
32772
|
+
args: [{ selector: 'app-user-event-notification-icon', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n *ngIf=\"visible\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"countChanges | async\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >notifications\n </mat-icon>\n</button>\n\n" }]
|
|
32761
32773
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
32762
32774
|
type: Optional
|
|
32763
32775
|
}, {
|