Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request papers/airgap/airgap-vault!398
  • Loading branch information
godenzim committed Feb 1, 2023
2 parents 30d0534 + 17a759b commit e6ae6f2
Show file tree
Hide file tree
Showing 13 changed files with 2,277 additions and 1,996 deletions.
32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,23 @@
"apply-diagnostic-modules": "node apply-diagnostic-modules.js"
},
"dependencies": {
"@airgap/aeternity": "0.13.8",
"@airgap/angular-core": "0.0.33",
"@airgap/angular-ngrx": "0.0.33",
"@airgap/astar": "0.13.8",
"@airgap/bitcoin": "0.13.8",
"@airgap/coinlib-core": "0.13.8",
"@airgap/cosmos": "0.13.8",
"@airgap/ethereum": "0.13.8",
"@airgap/groestlcoin": "0.13.8",
"@airgap/moonbeam": "0.13.8",
"@airgap/polkadot": "0.13.8",
"@airgap/aeternity": "0.13.9",
"@airgap/angular-core": "0.0.34",
"@airgap/angular-ngrx": "0.0.34",
"@airgap/astar": "0.13.9",
"@airgap/bitcoin": "0.13.9",
"@airgap/coinlib-core": "0.13.9",
"@airgap/cosmos": "0.13.9",
"@airgap/ethereum": "0.13.9",
"@airgap/groestlcoin": "0.13.9",
"@airgap/icp": "0.13.9",
"@airgap/module-kit": "0.13.9",
"@airgap/moonbeam": "0.13.9",
"@airgap/polkadot": "0.13.9",
"@airgap/sapling-wasm": "0.0.7",
"@airgap/serializer": "0.13.8",
"@airgap/substrate": "0.13.8",
"@airgap/tezos": "0.13.8",
"@airgap/serializer": "0.13.9",
"@airgap/substrate": "0.13.9",
"@airgap/tezos": "0.13.9",
"@angular/common": "13.2.5",
"@angular/core": "13.2.5",
"@angular/forms": "13.2.5",
Expand Down Expand Up @@ -122,7 +124,7 @@
"@angular/compiler": "13.2.5",
"@angular/compiler-cli": "13.2.5",
"@angular/language-service": "13.2.5",
"@capacitor/cli": "^4.0.0",
"@capacitor/cli": "3.2.5",
"@ionic/angular-toolkit": "6.0.0",
"@ionic/cli": "6.18.2",
"@types/emscripten": "^1.39.6",
Expand Down
11 changes: 10 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { APP_PLUGIN, IACMessageTransport, ProtocolService, SPLASH_SCREEN_PLUGIN, STATUS_BAR_PLUGIN } from '@airgap/angular-core'
import { MainProtocolSymbols } from '@airgap/coinlib-core'
import {
TezosSaplingExternalMethodProvider,
TezosShieldedTezProtocol,
Expand All @@ -22,6 +23,7 @@ import { MnemonicSecret } from './models/secret'
import { ErrorCategory, handleErrorLocal } from './services/error-handler/error-handler.service'
import { IACService } from './services/iac/iac.service'
import { NavigationService } from './services/navigation/navigation.service'
import { ProtocolModuleService } from './services/protocol-module/protocol-module.service'
import { SaplingNativeService } from './services/sapling-native/sapling-native.service'
import { SecretsService } from './services/secrets/secrets.service'
import { StartupChecksService } from './services/startup-checks/startup-checks.service'
Expand Down Expand Up @@ -55,6 +57,7 @@ export class AppComponent implements AfterViewInit {
private readonly navigationService: NavigationService,
private readonly httpClient: HttpClient,
private readonly saplingNativeService: SaplingNativeService,
private readonly protocolModuleService: ProtocolModuleService,
@Inject(APP_PLUGIN) private readonly app: AppPlugin,
@Inject(SECURITY_UTILS_PLUGIN) private readonly securityUtils: SecurityUtilsPlugin,
@Inject(SPLASH_SCREEN_PLUGIN) private readonly splashScreen: SplashScreenPlugin,
Expand Down Expand Up @@ -131,6 +134,8 @@ export class AppComponent implements AfterViewInit {
}

private async initializeProtocols(): Promise<void> {
const protocols = await this.protocolModuleService.loadProtocols([MainProtocolSymbols.XTZ_SHIELDED])

const externalMethodProvider: TezosSaplingExternalMethodProvider | undefined =
await this.saplingNativeService.createExternalMethodProvider()

Expand All @@ -142,7 +147,11 @@ export class AppComponent implements AfterViewInit {
)

this.protocolService.init({
extraActiveProtocols: [shieldedTezProtocol]
activeProtocols: protocols.activeProtocols,
passiveProtocols: protocols.passiveProtocols,
extraActiveProtocols: [shieldedTezProtocol],
activeSubProtocols: protocols.activeSubProtocols,
passiveSubProtocols: protocols.passiveSubProtocols
})

await shieldedTezProtocol.initParameters(await this.getSaplingParams('spend'), await this.getSaplingParams('output'))
Expand Down
20 changes: 14 additions & 6 deletions src/app/components/secret-item/secret-item.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AirGapWalletStatus } from '@airgap/coinlib-core'
import { AirGapWallet, AirGapWalletStatus } from '@airgap/coinlib-core'
import { Component, Input, OnInit } from '@angular/core'
import { ErrorCategory, handleErrorLocal } from 'src/app/services/error-handler/error-handler.service'
import { NavigationService } from 'src/app/services/navigation/navigation.service'
Expand Down Expand Up @@ -47,11 +47,19 @@ export class SecretItemComponent implements OnInit {
this.lifehashData = await this.lifehashService.generateLifehash(this.secret.fingerprint)
}

public getWalletsFromSecret() {
this.activeWallets = this.secret.wallets
.filter((wallet) => wallet.status === AirGapWalletStatus.ACTIVE)
.sort((a, b) => a.protocol.name.localeCompare(b.protocol.name)) // TODO: Use same order as common lib
.map((wallet) => wallet.protocol.symbol)
public async getWalletsFromSecret() {
const activeWallets: AirGapWallet[] = this.secret.wallets.filter((wallet: AirGapWallet) => wallet.status === AirGapWalletStatus.ACTIVE)
const comparableActiveWallets: [string, AirGapWallet][] = await Promise.all(activeWallets.map(async (wallet: AirGapWallet) => {
return [await wallet.protocol.getName(), wallet] as [string, AirGapWallet]
}))
const sortedActiveWallets: AirGapWallet[] = comparableActiveWallets
.sort((a: [string, AirGapWallet], b: [string, AirGapWallet]) => a[0].localeCompare(b[0])) // TODO: Use same order as common lib
.map(([_, wallet]: [string, AirGapWallet]) => wallet)

this.activeWallets = await Promise.all(sortedActiveWallets.map(async (wallet: AirGapWallet) => {
return wallet.protocol.getSymbol()
}))


if (this.activeWallets.length > 10) {
this.hasMoreWallets = this.activeWallets.length - 10
Expand Down
5 changes: 4 additions & 1 deletion src/app/pages/account-share/account-share.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@
<ion-col class="ion-no-padding">
<pre *ngIf="displayRawData" class="ion-no-margin">{{ interactionUrl | json }}</pre>
<ion-button *ngIf="displayRawData" (click)="copyToClipboard()">Copy data to clipboard</ion-button>
<ion-button class="float-right" *ngIf="displayRawData" color="primary" shape="round" (click)="done()">
{{ 'wallet-share.done_label' | translate }}
</ion-button>
</ion-col>
</ion-row>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab vertical="bottom" horizontal="end" slot="fixed" *ngIf="!displayRawData">
<ion-button color="primary" shape="round" (click)="done()">{{ 'wallet-share.done_label' | translate }}</ion-button>
</ion-fab>
</ion-content>
4 changes: 4 additions & 0 deletions src/app/pages/account-share/account-share.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
}
}

.float-right {
float: right;
}

.rawdata--container.ios {
margin-bottom: 48px;
}
Expand Down
13 changes: 10 additions & 3 deletions src/app/pages/accounts-list/accounts-list.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export class AccountsListPage {

ionViewWillEnter() {
this.secret = this.navigationService?.getState()?.secret
console.log('this.secret', this.secret)
if (this.secret) {
this.loadWallets()
} else {
Expand All @@ -49,8 +48,16 @@ export class AccountsListPage {
}
}

private loadWallets() {
this.wallets$.next([...this.secret?.wallets].sort((a, b) => a.protocol.name.localeCompare(b.protocol.name)))
private async loadWallets() {
const comparableWallets: [string, AirGapWallet][] = await Promise.all([...this.secret?.wallets].map(async (wallet: AirGapWallet) => {
return [await wallet.protocol.getName(), wallet] as [string, AirGapWallet]
}))
const sortedWallets: AirGapWallet[] = comparableWallets
.sort((a: [string, AirGapWallet], b: [string, AirGapWallet]) => a[0].localeCompare(b[0]))
.map(([_, wallet]: [string, AirGapWallet]) => wallet)

this.wallets$.next(sortedWallets)

}

public goToReceiveAddress(wallet: AirGapWallet): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export class DeserializedDetailEffects {
id: transaction.id,
details: transaction.details,
data: {
accountIdentifier: transaction.wallet.publicKey.substr(-6),
accountIdentifier: transaction.wallet.publicKey,
transaction: signed,
callbackURL: transaction.data.callbackURL
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ <h1>Unlock powerful features</h1>
<img src="assets/img/onboarding-terms.svg" />
<h1>Let's set up AirGap Vault!</h1>

<ion-item lines="none">
<ion-checkbox [(ngModel)]="disclaimerAccepted" color="primary" slot="end"></ion-checkbox>
<p>I accept the AirGap Terms of Service</p>
</ion-item>

<ion-button (click)="readTos()">Read Terms of Service</ion-button>
<ion-button [disabled]="!disclaimerAccepted" (click)="next()">Start</ion-button>
<ion-button (click)="readDisclaimer()">Read Disclaimer</ion-button>
</ion-slide>
</ion-slides>
</ion-content>
6 changes: 4 additions & 2 deletions src/app/pages/onboarding-welcome/onboarding-welcome.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ export class OnboardingWelcomePage {
.catch(handleErrorLocal(ErrorCategory.SECURE_STORAGE))
}

public async readTos() {
public async readDisclaimer() {
const modal: HTMLIonModalElement = await this.modalController.create({
component: WarningModalPage,
componentProps: { errorType: Warning.INITIAL_DISCLAIMER },
backdropDismiss: false
})

modal.onDidDismiss().then(() => {
this.next()
})
modal.present().catch(handleErrorLocal(ErrorCategory.IONIC_MODAL))
}
}

0 comments on commit e6ae6f2

Please sign in to comment.