Skip to content

Commit

Permalink
feature: add feature flag guard for new account select component
Browse files Browse the repository at this point in the history
  • Loading branch information
jackson-dean committed Sep 21, 2023
1 parent 2196170 commit 4258114
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ export class AppComponent implements OnInit {
this.globalVars.getFreeDeso = true;
}

if (params.get('subAccounts') === 'true') {
this.globalVars.subAccounts = true;
}

// Callback should only be used in mobile applications, where payload is passed through URL parameters.
const callback = params.get('callback') || stateParamsFromGoogle.callback;
if (callback) {
Expand Down
19 changes: 11 additions & 8 deletions src/app/derive/derive.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@
}}</span>
</h4>
<ng-container *ngIf="!publicKeyBase58Check">
<app-account-select
[allUsers]="allUsers"
(onAccountSelect)="this.onAccountSelected($event)"
></app-account-select>
<div class="text--divider margin-top--medium margin-bottom--medium">
or
</div>
<app-log-in-options></app-log-in-options>
<grouped-account-select
*ngIf="globalVars.subAccounts; else legacyAccountSelect"
(onAccountSelect)="onAccountSelected($event)"
/>
<ng-template #legacyAccountSelect>
<app-account-select
(onAccountSelect)="onAccountSelected($event)"
></app-account-select>
<div class="text--divider margin-top--medium margin-bottom--medium">or</div>
<app-log-in-options></app-log-in-options>
</ng-template>
</ng-container>
<div
class="box--border box--base box--rounded"
Expand Down
5 changes: 0 additions & 5 deletions src/app/derive/derive.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export class DeriveComponent implements OnInit {
transactionSpendingLimitResponse:
| TransactionSpendingLimitResponse
| undefined;
hasUsers = false;
hoveredAccount = -1;
publicKeyBase58Check: string | undefined = undefined;
derivedPublicKeyBase58Check: string | undefined = undefined;
Expand All @@ -53,10 +52,6 @@ export class DeriveComponent implements OnInit {
) {}

ngOnInit(): void {
// Load profile pictures and usernames
const publicKeys = this.accountService.getPublicKeys();
this.hasUsers = publicKeys.length > 0;

this.backendApi.GetAppState().subscribe((res) => {
this.blockHeight = res.BlockHeight;
});
Expand Down
6 changes: 6 additions & 0 deletions src/app/global-vars.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export class GlobalVarsService {
*/
showSkip: boolean = false;

/**
* Flag used to gate the new subAccounts functionality. After some sunset
* period (TBD), we can remove this flag and make this the default behavior.
*/
subAccounts: boolean = false;

isFullAccessHostname(): boolean {
return GlobalVarsService.fullAccessHostnames.includes(this.hostname);
}
Expand Down
14 changes: 10 additions & 4 deletions src/app/log-in/log-in.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,16 @@ <h4 class="font-size--small font-weight--bold margin-bottom--small">
</div>
</div>
<div class="padding-bottom--xlarge">
<app-account-select
<grouped-account-select
*ngIf="globalVars.subAccounts; else legacyAccountSelect"
(onAccountSelect)="onAccountSelect($event)"
></app-account-select>
<div class="text--divider margin-top--large margin-bottom--large">or</div>
<app-log-in-options></app-log-in-options>
/>
<ng-template #legacyAccountSelect>
<app-account-select
(onAccountSelect)="onAccountSelect($event)"
></app-account-select>
<div class="text--divider margin-top--medium margin-bottom--medium">or</div>
<app-log-in-options></app-log-in-options>
</ng-template>
</div>
</div>

0 comments on commit 4258114

Please sign in to comment.