Browse Source

feat(client): enforce encapsulation

pull/7302/head
KenTandrian 3 days ago
parent
commit
b2fc25b523
  1. 48
      apps/client/src/app/components/user-account-settings/user-account-settings.component.ts

48
apps/client/src/app/components/user-account-settings/user-account-settings.component.ts

@ -69,22 +69,22 @@ import { catchError } from 'rxjs/operators';
templateUrl: './user-account-settings.html' templateUrl: './user-account-settings.html'
}) })
export class GfUserAccountSettingsComponent implements OnInit { export class GfUserAccountSettingsComponent implements OnInit {
public appearancePlaceholder = $localize`Auto`; protected appearancePlaceholder = $localize`Auto`;
public baseCurrency: string; protected baseCurrency: string;
public closeUserAccountMail: string; protected closeUserAccountMail: string;
public currencies: string[] = []; protected currencies: string[] = [];
public deleteOwnUserForm = this.formBuilder.group({ protected deleteOwnUserForm = this.formBuilder.group({
accessToken: ['', Validators.required] accessToken: ['', Validators.required]
}); });
public hasPermissionToDeleteOwnUser: boolean; protected hasPermissionToDeleteOwnUser: boolean;
public hasPermissionToRequestOwnUserDeletion: boolean; protected hasPermissionToRequestOwnUserDeletion: boolean;
public hasPermissionToUpdateViewMode: boolean; protected hasPermissionToUpdateViewMode: boolean;
public hasPermissionToUpdateUserSettings: boolean; protected hasPermissionToUpdateUserSettings: boolean;
public isAccessTokenHidden = true; protected isAccessTokenHidden = true;
public isFingerprintSupported = this.doesBrowserSupportAuthn(); protected isFingerprintSupported = this.doesBrowserSupportAuthn();
public isWebAuthnEnabled: boolean; protected isWebAuthnEnabled: boolean;
public language = document.documentElement.lang; protected language = document.documentElement.lang;
public locales = [ protected locales = [
'ca', 'ca',
'de', 'de',
'de-CH', 'de-CH',
@ -102,7 +102,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
'uk', 'uk',
'zh' 'zh'
]; ];
public user: User; protected user: User;
public constructor( public constructor(
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
@ -113,7 +113,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
private settingsStorageService: SettingsStorageService, private settingsStorageService: SettingsStorageService,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
private userService: UserService, private userService: UserService,
public webAuthnService: WebAuthnService private webAuthnService: WebAuthnService
) { ) {
const { baseCurrency, currencies } = this.dataService.fetchInfo(); const { baseCurrency, currencies } = this.dataService.fetchInfo();
@ -164,11 +164,11 @@ export class GfUserAccountSettingsComponent implements OnInit {
this.update(); this.update();
} }
public isCommunityLanguage() { protected isCommunityLanguage() {
return !['de', 'en'].includes(this.language); return !['de', 'en'].includes(this.language);
} }
public onChangeUserSetting(aKey: string, aValue: string) { protected onChangeUserSetting(aKey: string, aValue: string) {
this.dataService this.dataService
.putUserSetting({ [aKey]: aValue }) .putUserSetting({ [aKey]: aValue })
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
@ -192,7 +192,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
}); });
} }
public onCloseAccount() { protected onCloseAccount() {
this.notificationService.confirm({ this.notificationService.confirm({
confirmFn: () => { confirmFn: () => {
this.dataService this.dataService
@ -220,7 +220,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
}); });
} }
public onExperimentalFeaturesChange(aEvent: MatSlideToggleChange) { protected onExperimentalFeaturesChange(aEvent: MatSlideToggleChange) {
this.dataService this.dataService
.putUserSetting({ isExperimentalFeatures: aEvent.checked }) .putUserSetting({ isExperimentalFeatures: aEvent.checked })
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
@ -236,7 +236,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
}); });
} }
public onExport() { protected onExport() {
this.dataService this.dataService
.fetchExport() .fetchExport()
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
@ -256,7 +256,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
}); });
} }
public onRestrictedViewChange(aEvent: MatSlideToggleChange) { protected onRestrictedViewChange(aEvent: MatSlideToggleChange) {
this.dataService this.dataService
.putUserSetting({ isRestrictedView: aEvent.checked }) .putUserSetting({ isRestrictedView: aEvent.checked })
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
@ -272,7 +272,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
}); });
} }
public async onSignInWithFingerprintChange(aEvent: MatSlideToggleChange) { protected async onSignInWithFingerprintChange(aEvent: MatSlideToggleChange) {
if (aEvent.checked) { if (aEvent.checked) {
try { try {
await this.registerDevice(); await this.registerDevice();
@ -295,7 +295,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
} }
} }
public onViewModeChange(aEvent: MatSlideToggleChange) { protected onViewModeChange(aEvent: MatSlideToggleChange) {
this.dataService this.dataService
.putUserSetting({ viewMode: aEvent.checked === true ? 'ZEN' : 'DEFAULT' }) .putUserSetting({ viewMode: aEvent.checked === true ? 'ZEN' : 'DEFAULT' })
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))

Loading…
Cancel
Save