From 3041f752fa6f78ff56f44a1a524c496fe6e79521 Mon Sep 17 00:00:00 2001 From: JDonadio Date: Wed, 4 Oct 2017 16:29:34 -0300 Subject: [PATCH] add single address template --- .../add/single-wallet/single-wallet.html | 62 +++++++++++++- .../add/single-wallet/single-wallet.scss | 9 +++ src/pages/add/single-wallet/single-wallet.ts | 80 ++++++++++++++++++- 3 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 src/pages/add/single-wallet/single-wallet.scss diff --git a/src/pages/add/single-wallet/single-wallet.html b/src/pages/add/single-wallet/single-wallet.html index c68c2d4fa..05d8f2d04 100644 --- a/src/pages/add/single-wallet/single-wallet.html +++ b/src/pages/add/single-wallet/single-wallet.html @@ -4,6 +4,66 @@ - + +
+ + Wallet name + + + + + + + Show advanced options + Hide advanced options + + +
+ + Wallet service URL + + + + + Wallet key + + {{opt.label}} + + + + + Add a password + + + +
+ + Password + + + + Repeat password + + + + +
+ This password cannot be recovered. If the password is lost, there is no way you could recover your funds. +
+
+
+ + + Testnet + + + + + Single address + + +
+ +
\ No newline at end of file diff --git a/src/pages/add/single-wallet/single-wallet.scss b/src/pages/add/single-wallet/single-wallet.scss new file mode 100644 index 000000000..40b44287f --- /dev/null +++ b/src/pages/add/single-wallet/single-wallet.scss @@ -0,0 +1,9 @@ +.warning { + background-color: #ef473a; + border-color: #e42112; + color: #fff; + padding: 0.5rem; + border: 1px solid; + white-space: normal; + text-align: center; +} \ No newline at end of file diff --git a/src/pages/add/single-wallet/single-wallet.ts b/src/pages/add/single-wallet/single-wallet.ts index b098d386a..c7a45cd69 100644 --- a/src/pages/add/single-wallet/single-wallet.ts +++ b/src/pages/add/single-wallet/single-wallet.ts @@ -1,10 +1,88 @@ import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; +import { AppProvider } from '../../../providers/app/app'; @Component({ selector: 'page-single-wallet', templateUrl: 'single-wallet.html' }) export class SingleWalletPage { - constructor(public navCtrl: NavController) {} + public formData: any; + public showAdvOpts: boolean; + public seedOptions: any; + + private appName: string; + + constructor(public navCtrl: NavController, private app: AppProvider) { + this.showAdvOpts = false; + this.formData = { + bwsURL: 'https://bws.bitpay.com/bws/api', + addPassword: false, + passphrase: null, + repeatPassphrase: null, + testnet: false, + singleAddress: false, + }; + this.seedOptions = [{ + id: 'new', + label: 'Random', + supportsTestnet: true + }, { + id: 'set', + label: 'Specify Recovery Phrase...', + supportsTestnet: false + }]; + this.appName = this.app.info.name; + this.updateSeedSourceSelect(1); + } + + updateSeedSourceSelect(n: number) { + this.formData.selectedSeed = { + id: this.seedOptions[0].id + }; + + /* Disable Hardware Wallets for BitPay distribution */ + var seedOptions = []; + + if (this.appName == 'copay') { + // if (n > 1 && walletService.externalSource.ledger.supported) + // seedOptions.push({ + // id: walletService.externalSource.ledger.id, + // label: walletService.externalSource.ledger.longName, + // supportsTestnet: walletService.externalSource.ledger.supportsTestnet + // }); + + // if (walletService.externalSource.trezor.supported) { + // seedOptions.push({ + // id: walletService.externalSource.trezor.id, + // label: walletService.externalSource.trezor.longName, + // supportsTestnet: walletService.externalSource.trezor.supportsTestnet + // }); + // } + + // if (walletService.externalSource.intelTEE.supported) { + // seedOptions.push({ + // id: walletService.externalSource.intelTEE.id, + // label: walletService.externalSource.intelTEE.longName, + // supportsTestnet: walletService.externalSource.intelTEE.supportsTestnet + // }); + // } + } + this.seedOptions = this.seedOptions.concat(seedOptions); + console.log('Seed options:', this.seedOptions); + }; + + seedOptionsChange(seed: any) { + this.formData.selectedSeed.id = seed; + this.resetPasswordFields(); + } + + resetPasswordFields() { + this.formData.passphrase = + this.formData.createPassphrase = + this.formData.passwordSaved = + this.formData.repeatPassword = + // this.result = + null; + } }