import { Component , OnInit } from '@angular/core' ; import { FormControl , FormGroup } from '@angular/forms' ; import { Router } from '@angular/router' ; import { FormToastService } from '../../../../common/services/form-toast.service' ; import { Session } from '../../../../services/session' ; import { SettingsV2WalletService } from './wallet.service' ; /**
 * Settings v2 Wallet settings component.
 */ @ Component ( { selector : 'm-settingsV2__wallet' , templateUrl : 'wallet.component.html' , styleUrls : [ 'wallet.component.ng.scss' ] , } ) export class SettingsV2WalletComponent implements OnInit { public form : FormGroup ; public inProgress : boolean = true ; constructor ( private session , private router , private service , private toast ) { } ngOnInit ( ) { if ( ! this . session . isLoggedIn ( ) ) { this . router . navigate ( [ '/login' ] ) ; } this . form = new FormGroup ( { displayWalletBalance : new FormControl ( ! this . service . shouldHideWalletBalance ( ) ) , } ) ; this . inProgress = false ; } returns { void } public submit ( ) { this . service . setShouldHideWalletBalance ( ! this . form . get ( 'displayWalletBalance' ) . value ) ; this . toast . success ( 'Successfully changed wallet privacy settings.' ) ; } }