Skip to content

Commit

Permalink
Update settings.component.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
miladsoft committed Sep 18, 2024
1 parent 0c3b904 commit 0c436fd
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions src/app/components/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { SettingsSecurityComponent } from './security/security.component';
import { SettingsRelayComponent } from './relay/relay.component';
import { SettingsNetworkComponent } from "./network/network.component";
import { SettingsIndexerComponent } from "./indexer/indexer.component";
import { SignerService } from 'app/services/signer.service';

@Component({
selector: 'settings',
Expand Down Expand Up @@ -68,28 +69,51 @@ export class SettingsComponent implements OnInit, OnDestroy {
title: 'Profile',
description: 'Update your personal profile, manage your account details, and modify your private information.',
},
{
id: 'security',
icon: 'heroicons_outline:shield-check',
title: 'Security',
description: 'Enhance your security by managing passwords, enabling 2-step verification, and other security preferences.',
},
{
id: 'notifications',
icon: 'heroicons_outline:bell',
title: 'Notifications',
description: 'Control when and how you’ll be notified across various communication channels.',
},
{
id: 'security',
icon: 'heroicons_outline:shield-check',
title: 'Security',
description: 'Enhance your security by managing passwords, enabling 2-step verification, and other security preferences.',
}
];


selectedPanel = 'relay';
private _unsubscribeAll = new Subject<void>();

constructor(
private _changeDetectorRef: ChangeDetectorRef,
private _angorMediaWatcherService: AngorMediaWatcherService
private _angorMediaWatcherService: AngorMediaWatcherService,
private _signerService: SignerService
) {}

ngOnInit(): void {
const securityPanel = {
id: 'security',
icon: 'heroicons_outline:shield-check',
title: 'Security',
description: 'Enhance your security by managing passwords, enabling 2-step verification, and other security preferences.',
};

if (!this._signerService.isUsingSecretKey()) {
this.panels = this.panels.filter(panel => panel.id !== 'security');
console.log("Extension used, security panel removed");
} else {
const panelExists = this.panels.some(panel => panel.id === 'security');
if (!panelExists) {
this.panels.push(securityPanel);
console.log("Extension not used, security panel added");
}
}

this._changeDetectorRef.markForCheck();

this._angorMediaWatcherService.onMediaChange$
.pipe(takeUntil(this._unsubscribeAll))
.subscribe(({ matchingAliases }) => {
Expand All @@ -99,6 +123,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
});
}


ngOnDestroy(): void {
this._unsubscribeAll.next();
this._unsubscribeAll.complete();
Expand Down

0 comments on commit 0c436fd

Please sign in to comment.