Skip to content

Commit

Permalink
Merge branch 'fix/module-component' into 'develop'
Browse files Browse the repository at this point in the history
fix/module-component

See merge request papers/airgap/airgap-vault!493
  • Loading branch information
Stephen Debel committed Apr 29, 2024
2 parents 69ebc78 + e8fc58b commit 0ed766e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/app/pages/account-add/account-add.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h2>
</ng-container>
</ion-list>

<ion-card class="ion-padding" color="primary">
<ion-card class="ion-padding" color="primary" (click)="goToIsolatedModule()">
<ion-row>
<ion-col>
<ion-icon style="zoom: 4" src="assets/icons/shapes.svg"></ion-icon>
Expand Down
70 changes: 39 additions & 31 deletions src/app/pages/account-add/account-add.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,25 @@ export class AccountAddPage {
this.protocolService.getActiveProtocols().then(async (protocols: ICoinProtocol[]) => {
const navigationIdentifier: ProtocolSymbols | undefined = state.protocol

this.protocolList = await Promise.all(protocols.map(async (protocol) => {
const [symbol, identifier, name, supportsHD] = await Promise.all([
protocol.getSymbol(),
protocol.getIdentifier(),
protocol.getName(),
protocol.getSupportsHD()
])
const isChecked = navigationIdentifier === identifier

return {
protocol,
isHDWallet: supportsHD,
customDerivationPath: undefined,
isChecked: isChecked,
details: { symbol, identifier, name }
}
}))
this.protocolList = await Promise.all(
protocols.map(async (protocol) => {
const [symbol, identifier, name, supportsHD] = await Promise.all([
protocol.getSymbol(),
protocol.getIdentifier(),
protocol.getName(),
protocol.getSupportsHD()
])
const isChecked = navigationIdentifier === identifier

return {
protocol,
isHDWallet: supportsHD,
customDerivationPath: undefined,
isChecked: isChecked,
details: { symbol, identifier, name }
}
})
)
this.onProtocolSelected()
})
}
Expand Down Expand Up @@ -122,7 +124,7 @@ export class AccountAddPage {
if (selectedProtocols.length === 1) {
const selectedProtocol = selectedProtocols[0]
const standardDerivationPath = await selectedProtocol.protocol.getStandardDerivationPath()
if (await selectedProtocol.protocol.getSupportsHD() && selectedProtocol.isHDWallet) {
if ((await selectedProtocol.protocol.getSupportsHD()) && selectedProtocol.isHDWallet) {
selectedProtocol.customDerivationPath = standardDerivationPath
} else {
selectedProtocol.customDerivationPath = `${standardDerivationPath}/0/0`
Expand Down Expand Up @@ -161,19 +163,21 @@ export class AccountAddPage {
this.secretsService
.addWallets(
this.secret,
await Promise.all(this.protocolList.map(async (protocolWrapper: ProtocolWrapper) => {
const protocol = protocolWrapper.protocol
return {
protocolIdentifier: await protocol.getIdentifier(),
isHDWallet: protocolWrapper.isChecked ? protocolWrapper.isHDWallet : await protocol.getSupportsHD(),
customDerivationPath:
protocolWrapper.isChecked && protocolWrapper.customDerivationPath
? protocolWrapper.customDerivationPath
: await protocol.getStandardDerivationPath(),
bip39Passphrase: protocolWrapper.isChecked ? this.bip39Passphrase : '',
isActive: protocolWrapper.isChecked
}
}))
await Promise.all(
this.protocolList.map(async (protocolWrapper: ProtocolWrapper) => {
const protocol = protocolWrapper.protocol
return {
protocolIdentifier: await protocol.getIdentifier(),
isHDWallet: protocolWrapper.isChecked ? protocolWrapper.isHDWallet : await protocol.getSupportsHD(),
customDerivationPath:
protocolWrapper.isChecked && protocolWrapper.customDerivationPath
? protocolWrapper.customDerivationPath
: await protocol.getStandardDerivationPath(),
bip39Passphrase: protocolWrapper.isChecked ? this.bip39Passphrase : '',
isActive: protocolWrapper.isChecked
}
})
)
)
.then(() => {
this.navigationService
Expand Down Expand Up @@ -218,4 +222,8 @@ export class AccountAddPage {
addAccount()
}
}

public goToIsolatedModule(): void {
this.navigationService.route('/isolated-modules-list').catch(handleErrorLocal(ErrorCategory.IONIC_NAVIGATION))
}
}
1 change: 1 addition & 0 deletions src/app/pages/secret-setup/secret-setup.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
</ion-row>
</ion-card-title>
</ion-card-header>

<ion-card-content>{{ 'secret-setup.import.text' | translate }}</ion-card-content>
</ion-card>
<ion-card class="airgap--card ion-padding-vertical ion-margin-bottom" (click)="goToSocialRecoveryImport()" [color]="'tertiary'">
Expand Down

0 comments on commit 0ed766e

Please sign in to comment.