wizard cleanup

This commit is contained in:
Drew Ansbacher
2021-08-19 23:50:24 -06:00
committed by Aiden McClelland
parent 0aa75ee008
commit 88ed581d95
12 changed files with 128 additions and 473 deletions

View File

@@ -7,11 +7,12 @@ import { MockApiService } from './services/api/mock-api.service'
import { LiveApiService } from './services/api/live-api.service'
import { HttpService } from './services/api/http.service'
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { IonicModule, IonicRouteStrategy, iosTransitionAnimation } from '@ionic/angular';
import * as config from './config/config'
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
@@ -20,6 +21,9 @@ import { AppRoutingModule } from './app-routing.module';
IonicModule.forRoot(),
AppRoutingModule,
HttpClientModule,
IonicModule.forRoot({
navAnimation: iosTransitionAnimation,
}),
],
providers: [
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },

View File

@@ -10,6 +10,7 @@
<ion-card color="dark">
<ion-card-header class="ion-text-center" style="padding-bottom: 8px;">
<ion-card-title>{{ loading ? 'Loading Embassy Drives' : 'Select Embassy Drive'}}</ion-card-title>
<ion-card-subtitle>Select the drive where all your Embassy data will be stored.</ion-card-subtitle>
</ion-card-header>
<ion-card-content class="ion-margin">

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { AlertController, LoadingController, ModalController, NavController } from '@ionic/angular'
import { AlertController, iosTransitionAnimation, LoadingController, ModalController, NavController } from '@ionic/angular'
import { ApiService, EmbassyDrive } from 'src/app/services/api/api.service'
import { StateService } from 'src/app/services/state.service'
import { PasswordPage } from '../password/password.page'
@@ -19,7 +19,6 @@ export class EmbassyPage {
private readonly navCtrl: NavController,
private modalController: ModalController,
private stateService: StateService,
private readonly alertCtrl: AlertController,
private loadingCtrl: LoadingController
) {}
@@ -54,9 +53,9 @@ export class EmbassyPage {
} finally {
loader.dismiss()
if(!!this.stateService.recoveryDrive) {
await this.navCtrl.navigateForward(`/loading`, { animationDirection: 'forward' })
await this.navCtrl.navigateForward(`/loading`, { animationDirection: 'forward', animation: iosTransitionAnimation })
} else {
await this.navCtrl.navigateForward(`/success`, { animationDirection: 'forward' })
await this.navCtrl.navigateForward(`/success`, { animationDirection: 'forward', animation: iosTransitionAnimation })
}
}
})

View File

@@ -33,7 +33,7 @@
>
<ion-card-header>
<ion-card-title style="font-size: 40px;">Recover</ion-card-title>
<ion-card-subtitle>Recover the data from an old embassy</ion-card-subtitle>
<ion-card-subtitle>Recover data from an old embassy</ion-card-subtitle>
</ion-card-header>
</ion-card>
</ion-card-content>

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { NavController } from '@ionic/angular'
import { iosTransitionAnimation, NavController } from '@ionic/angular'
@Component({
selector: 'app-home',
@@ -12,11 +12,11 @@ export class HomePage {
) {}
async recoverNav () {
await this.navCtrl.navigateForward(`/recover`, { animationDirection: 'forward' })
await this.navCtrl.navigateForward(`/recover`, { animationDirection: 'forward', animation: iosTransitionAnimation })
}
async embassyNav () {
await this.navCtrl.navigateForward(`/embassy`, { animationDirection: 'forward' })
await this.navCtrl.navigateForward(`/embassy`, { animationDirection: 'forward', animation: iosTransitionAnimation })
}
}

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { AlertController } from '@ionic/angular'
import { iosTransitionAnimation, NavController } from '@ionic/angular'
import { StateService } from 'src/app/services/state.service'
@Component({
@@ -10,35 +10,18 @@ import { StateService } from 'src/app/services/state.service'
export class LoadingPage {
constructor(
private stateService: StateService,
private alertCtrl: AlertController
private navCtrl: NavController
) {}
ngOnInit () {
this.stateService.pollDataTransferProgress()
const progSub = this.stateService.dataProgSubject.subscribe(async progress => {
if(progress === 1) {
await this.successAlert()
progSub.unsubscribe()
await this.navCtrl.navigateForward(`/success`, { animationDirection: 'forward', animation: iosTransitionAnimation })
}
})
}
async successAlert () {
const alert = await this.alertCtrl.create({
cssClass: 'success-alert',
header: 'Success!',
subHeader: `Your Embassy is set up and ready to go.`,
backdropDismiss: false,
buttons: [
{
text: 'Go To Embassy',
handler: () => {
window.location.reload()
}
}
]
})
await alert.present()
}
}

View File

@@ -10,6 +10,7 @@
<ion-content color="light">
<form (ngSubmit)="!!recoveryDrive ? verifyPw() : submitPw()">
<div style="padding: 8px 24px;">
<p *ngIf="!!embassyDrive">Choose a password for your embassy. You will need it every time you log in. If you lose it you will be permanently locked out of your embassy.</p>
<p *ngIf="embassyDrive && embassyDrive.used > 0" style="padding-bottom: 15px;color: var(--ion-color-warning);"><b>Warning:</b> After submit, any data currently stored on <b>{{ embassyDrive.labels.length ? embassyDrive.labels.join(' / ') : embassyDrive.logicalname }}</b> will be wiped.</p>
<h4 class="input-label">
@@ -45,7 +46,6 @@
[ngModelOptions]="{'standalone': true}"
[type]="!unmasked2 ? 'password' : 'text'"
debounce="500"
[disabled]="password.length < 12"
(ionChange)="checkVer()"
maxlength="64"
placeholder="Retype Password"

View File

@@ -16,8 +16,8 @@
<form (submit)="submit()" style="margin-bottom: 12px;">
<ion-item-group>
<ion-item>
<ion-icon color="medium" slot="start" name="key-outline" style="margin-right: 16px;"></ion-icon>
<ion-input (click)="error = ''" color="medium" maxlength="12" name="productKey" [(ngModel)]="productKey"></ion-input>
<ion-icon color="light" slot="start" name="key-outline" style="margin-right: 16px;"></ion-icon>
<ion-input style="color: var(--ion-color-light)" (click)="error = ''" color="medium" maxlength="12" name="productKey" [(ngModel)]="productKey"></ion-input>
</ion-item>
<div class="ion-text-left">

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { LoadingController, NavController } from '@ionic/angular'
import { iosTransitionAnimation, LoadingController, NavController } from '@ionic/angular'
import { ApiService } from 'src/app/services/api/api.service'
import { StateService } from 'src/app/services/state.service'
@@ -31,12 +31,12 @@ export class ProductKeyPage {
const state = await this.apiService.verifyProductKey(this.productKey)
this.stateService.productKey = this.productKey
if(state['is-recovering']) {
await this.navCtrl.navigateForward(`/loading`, { animationDirection: 'forward' })
await this.navCtrl.navigateForward(`/loading`, { animationDirection: 'forward', animation: iosTransitionAnimation })
} else if (!!state['tor-address']) {
this.stateService.torAddress = state['tor-address']
await this.navCtrl.navigateForward(`/success`, { animationDirection: 'forward' })
await this.navCtrl.navigateForward(`/success`, { animationDirection: 'forward', animation: iosTransitionAnimation })
} else {
await this.navCtrl.navigateForward(`/home`, { animationDirection: 'forward' })
await this.navCtrl.navigateForward(`/home`, { animationDirection: 'forward', animation: iosTransitionAnimation })
}
} catch (e) {
this.error = e.message
@@ -44,13 +44,5 @@ export class ProductKeyPage {
loader.dismiss()
}
}
async recoverNav () {
await this.navCtrl.navigateForward(`/recover`, { animationDirection: 'forward' })
}
async embassyNav () {
await this.navCtrl.navigateForward(`/embassy`, { animationDirection: 'forward' })
}
}

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { ModalController, NavController } from '@ionic/angular'
import { iosTransitionAnimation, ModalController, NavController } from '@ionic/angular'
import { ApiService, RecoveryDrive } from 'src/app/services/api/api.service'
import { StateService } from 'src/app/services/state.service'
import { PasswordPage } from '../password/password.page'
@@ -61,6 +61,6 @@ export class RecoverPage {
if(pw) {
this.stateService.recoveryPassword = pw
}
await this.navCtrl.navigateForward(`/embassy`, { animationDirection: 'forward' })
await this.navCtrl.navigateForward(`/embassy`, { animationDirection: 'forward', animation: iosTransitionAnimation })
}
}

View File

@@ -30,10 +30,6 @@
</ion-label>
</ion-item>
<ion-button (click)="goToEmbassy()" style="height: 60px; margin-top: 30px;" type="submit" expand="block">
<span style="font-size: larger; font-weight: bold; padding: 10px 20px">Go To Embassy!</span>
</ion-button>
</ion-card-content>
</ion-card>
</ion-col>