diff --git a/app/src/app/account/backup/backup.component.html b/app/src/app/account/backup/backup.component.html index 63429235..82d0d228 100644 --- a/app/src/app/account/backup/backup.component.html +++ b/app/src/app/account/backup/backup.component.html @@ -29,7 +29,7 @@

Backup your account

- diff --git a/app/src/app/account/backup/backup.component.scss b/app/src/app/account/backup/backup.component.scss index d87676ad..92b23de7 100644 --- a/app/src/app/account/backup/backup.component.scss +++ b/app/src/app/account/backup/backup.component.scss @@ -25,5 +25,4 @@ mat-card { .copy-button { margin-left: 0.1em; - } \ No newline at end of file diff --git a/app/src/app/account/backup/backup.component.ts b/app/src/app/account/backup/backup.component.ts index ec668cec..1795e698 100644 --- a/app/src/app/account/backup/backup.component.ts +++ b/app/src/app/account/backup/backup.component.ts @@ -7,11 +7,12 @@ import { Web5IdentityAgent } from '@web5/identity-agent'; import { AppService } from '../../app.service'; import { CommonModule } from '@angular/common'; import { MatTooltipModule } from '@angular/material/tooltip'; +import { Router, RouterModule } from '@angular/router'; @Component({ selector: 'app-backup', standalone: true, - imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule, MatTooltipModule], + imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule, MatTooltipModule, RouterModule], templateUrl: './backup.component.html', styleUrl: './backup.component.scss' }) @@ -21,7 +22,7 @@ export class BackupComponent { reveal = signal(false); - constructor(public identityService: IdentityService, public appService: AppService) { + constructor(private router: Router, public identityService: IdentityService, public appService: AppService) { } async backupToFile() { @@ -39,6 +40,13 @@ export class BackupComponent { } } +confirmBackup() { + this.appService.state().backupConfirmed = true; + this.appService.saveState(); + + this.router.navigate(['/introduction']); +} + async saveFile(data: string) { const blob = new Blob([data], { type: 'text/plain' }); diff --git a/app/src/app/account/password/password.component.ts b/app/src/app/account/password/password.component.ts index 3b55cb11..92958294 100644 --- a/app/src/app/account/password/password.component.ts +++ b/app/src/app/account/password/password.component.ts @@ -91,6 +91,6 @@ export class PasswordComponent { this.invalidPassword.set(false); this.unlocking.set(false); - this.router.navigate(['/account', 'did:dht:umj7apgmkodtrb7mdpjo4h7xinqdnatzgy38j7wi67k9c7sdns1o']); + this.router.navigate(['/introduction']); } } diff --git a/app/src/app/app.service.ts b/app/src/app/app.service.ts index c094a835..1c9ce28d 100644 --- a/app/src/app/app.service.ts +++ b/app/src/app/app.service.ts @@ -6,6 +6,7 @@ import { Web5ConnectResult } from '@web5/api'; export interface AppState { selectedAccount: string; + backupConfirmed?: boolean; } export interface Account { @@ -45,6 +46,10 @@ export class AppService { this.storage.save('accounts', this.accounts()); } + saveState() { + this.storage.save('state', this.state()); + } + async initialize() { console.log('Initializing Ariton...'); diff --git a/app/src/app/introduction/introduction.component.html b/app/src/app/introduction/introduction.component.html index d43f9518..dcf42b73 100644 --- a/app/src/app/introduction/introduction.component.html +++ b/app/src/app/introduction/introduction.component.html @@ -22,11 +22,17 @@

Welcome

} @else { - + + } + @if(!backup()) { + + } + @else { + } - +

diff --git a/app/src/app/introduction/introduction.component.ts b/app/src/app/introduction/introduction.component.ts index 7919cf3b..b145c648 100644 --- a/app/src/app/introduction/introduction.component.ts +++ b/app/src/app/introduction/introduction.component.ts @@ -16,4 +16,7 @@ export class IntroductionComponent { appService = inject(AppService); reset = computed(() => (this.appService.account().passwordHash)); + + backup = computed(() => (this.appService.state().backupConfirmed)); + }