<div>
<my-input-switch
+ [inputName]="'web-notification-' + notificationType"
[(ngModel)]="webNotifications[notificationType]"
(ngModelChange)="updateWebSetting(notificationType, webNotifications[notificationType])"
></my-input-switch>
<div *ngIf="emailEnabled">
<my-input-switch
+ [inputName]="'email-notification-' + notificationType"
[(ngModel)]="emailNotifications[notificationType]"
(ngModelChange)="updateEmailSetting(notificationType, emailNotifications[notificationType])"
></my-input-switch>
import { Component, Input, OnInit } from '@angular/core'
import { Notifier, ServerService, User } from '@app/core'
import { UserNotificationService } from '@app/shared/shared-main'
+import { objectKeysTyped } from '@shared/core-utils'
import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models'
@Component({
}
private loadNotificationSettings () {
- for (const key of Object.keys(this.user.notificationSettings) as (keyof UserNotificationSetting)[]) {
+ for (const key of objectKeysTyped(this.user.notificationSettings)) {
const value = this.user.notificationSettings[key]
this.emailNotifications[key] = !!(value & UserNotificationSettingValue.EMAIL)
[ngbTooltip]="autoPlayNextVideoTooltip" placement="bottom-right auto"
>
<span i18n>AUTOPLAY</span>
- <my-input-switch class="small" [(ngModel)]="autoPlayNextVideo" (ngModelChange)="switchAutoPlayNextVideo()"></my-input-switch>
+ <my-input-switch class="small" inputName="autoplay-next-video" [(ngModel)]="autoPlayNextVideo" (ngModelChange)="switchAutoPlayNextVideo()"></my-input-switch>
</div>
</div>
<my-global-icon iconName="p2p" aria-hidden="true"></my-global-icon>
<ng-container i18n>Help share videos</ng-container>
- <my-input-switch class="ms-auto" [checked]="user.p2pEnabled"></my-input-switch>
+ <my-input-switch inputName="p2p-enabled" class="ms-auto" [checked]="user.p2pEnabled"></my-input-switch>
</button>
<div class="dropdown-divider"></div>
propagateChange = (_: any) => { /* empty */ }
writeValue (checked: boolean) {
+ console.log(checked)
this.checked = checked
}
}
update () {
+ console.log(this.checked)
this.checked = !this.checked
this.propagateChange(this.checked)
}