Skip to content

Commit 1afb9ae

Browse files
authored
Merge pull request #10256 from Gamboster/ref/createNewKeyLogic
Ref: create new key logic
2 parents 7fe69bc + db52de5 commit 1afb9ae

File tree

12 files changed

+12
-88
lines changed

12 files changed

+12
-88
lines changed

src/pages/add/add.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<div class="item-title" translate>Join Shared Wallet</div>
2323
<span class="item-subtitle" translate>Requires invitation to join</span>
2424
</button>
25-
<button class="list-button" ion-item (click)="goToImportWallet()" *ngIf="!keyId">
25+
<button class="list-button" ion-item (click)="goToImportWallet()">
2626
<ion-icon item-start>
2727
<img src="assets/img/add-wallet/import.svg" />
2828
</ion-icon>

src/pages/add/add.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { Logger } from '../../providers';
1515
templateUrl: 'add.html'
1616
})
1717
export class AddPage {
18-
public allowMultiplePrimaryWallets: boolean;
1918
public keyId: string;
2019
public isOnboardingFlow: boolean;
2120
public isZeroState: boolean;

src/pages/add/import-wallet/import-wallet.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ export class ImportWalletPage {
243243
if (wallets && wallets[0]) {
244244
this.profileProvider.setBackupGroupFlag(wallets[0].credentials.keyId);
245245
}
246-
this.allowMultiplePrimaryWallets();
247246

248247
// using setRoot(TabsPage) as workaround when coming from scanner
249248
this.app
@@ -254,17 +253,6 @@ export class ImportWalletPage {
254253
});
255254
}
256255

257-
private allowMultiplePrimaryWallets(): void {
258-
let config = this.configProvider.get();
259-
const allowMultiplePrimaryWallets = config.allowMultiplePrimaryWallets;
260-
if (allowMultiplePrimaryWallets) return;
261-
262-
let opts = {
263-
allowMultiplePrimaryWallets: true
264-
};
265-
this.configProvider.set(opts);
266-
}
267-
268256
private importExtendedPrivateKey(xPrivKey, opts) {
269257
this.onGoingProcessProvider.set('importingWallet');
270258
this.profileProvider

src/pages/settings/advanced/advanced.html

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@
2222
</label-tip>
2323
</ion-list>
2424
<ion-list class="settings-list bp-list">
25-
<ion-item class="with-label no-border" *ngIf="nrKeys==1">
26-
<ion-label>{{
27-
'Support Wallets with Different Keys' | translate
28-
}}</ion-label>
29-
<ion-toggle [(ngModel)]="allowMultiplePrimaryWallets" (ionChange)="allowMultiplePrimaryWalletsChange()"></ion-toggle>
30-
</ion-item>
31-
<label-tip class="info" type="info" header="no-header" *ngIf="nrKeys==1">
32-
<div label-tip-body>
33-
<div translate>
34-
If enabled, the new wallets may have different keys and will require a new backup.
35-
</div>
36-
</div>
37-
</label-tip>
3825
<button ion-item *ngIf="oldProfileAvailable && wallets && wallets[0]" class="with-label no-border" (click)="openWalletRecoveryPage()" translate>
3926
Recover old wallets
4027
</button>

src/pages/settings/advanced/advanced.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import { WalletRecoverPage } from './wallet-recover-page/wallet-recover-page';
1717
})
1818
export class AdvancedPage {
1919
public spendUnconfirmed: boolean;
20-
public allowMultiplePrimaryWallets: boolean;
21-
public nrKeys: number;
2220
public isCopay: boolean;
2321
public oldProfileAvailable: boolean;
2422
public wallets;
@@ -54,14 +52,6 @@ export class AdvancedPage {
5452
let config = this.configProvider.get();
5553

5654
this.spendUnconfirmed = config.wallet.spendUnconfirmed;
57-
58-
const opts = {
59-
showHidden: true
60-
};
61-
const wallets = this.profileProvider.getWallets(opts);
62-
this.nrKeys = _.values(_.groupBy(wallets, 'keyId')).length;
63-
64-
this.allowMultiplePrimaryWallets = config.allowMultiplePrimaryWallets;
6555
}
6656

6757
public spendUnconfirmedChange(): void {
@@ -73,13 +63,6 @@ export class AdvancedPage {
7363
this.configProvider.set(opts);
7464
}
7565

76-
public allowMultiplePrimaryWalletsChange(): void {
77-
let opts = {
78-
allowMultiplePrimaryWallets: this.allowMultiplePrimaryWallets
79-
};
80-
this.configProvider.set(opts);
81-
}
82-
8366
public openWalletRecoveryPage() {
8467
this.navCtrl.push(WalletRecoverPage);
8568
}

src/pages/settings/settings.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ <h4>Learn where you can spend your crypto today.</h4>
5353
{{walletsGroup.length}} Wallet<span *ngIf="walletsGroup.length > 1">s</span>
5454
</ion-note>
5555
</button>
56-
<button ion-item class="create-button" *ngIf="walletsGroups && walletsGroups[0] && allowMultiplePrimaryWallets" (click)="goToAddView()" translate>
57-
Create New Key
56+
<button ion-item class="create-button" *ngIf="walletsGroups && walletsGroups[0]" (click)="goToAddView()" translate>
57+
Create or Import a Key
5858
</button>
5959

6060
<ion-item-divider>{{'Preferences' | translate}}</ion-item-divider>

src/pages/settings/settings.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import { WalletSettingsPage } from './wallet-settings/wallet-settings';
4141
templateUrl: 'settings.html'
4242
})
4343
export class SettingsPage {
44-
public allowMultiplePrimaryWallets: boolean;
4544
public appName: string;
4645
public currentLanguageName: string;
4746
public languages;
@@ -101,9 +100,6 @@ export class SettingsPage {
101100
this.config && this.config.lock && this.config.lock.method
102101
? this.config.lock.method.toLowerCase()
103102
: null;
104-
105-
this.allowMultiplePrimaryWallets =
106-
this.config.allowMultiplePrimaryWallets || this.walletsGroups.length != 1;
107103
}
108104

109105
ionViewDidEnter() {

src/providers/address/address.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('AddressProvider', () => {
99
addressProvider = testBed.get(AddressProvider);
1010
});
1111

12-
fdescribe('getCoinAndNetwork', () => {
12+
describe('getCoinAndNetwork', () => {
1313
const testVectors: any[] = [
1414
// Bech32
1515
['bc1q9225pawdj2dlwsk3dd8phudsap6vjp7fg3nwdl', 'btc', 'livenet'],

src/providers/config/config.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ export interface Config {
103103
bch: string;
104104
eth: string;
105105
};
106-
107-
allowMultiplePrimaryWallets: boolean;
108106
}
109107

110108
@Injectable()
@@ -231,9 +229,7 @@ export class ConfigProvider {
231229
btc: 'insight.bitcore.io/#/BTC/',
232230
bch: 'insight.bitcore.io/#/BCH/',
233231
eth: 'insight.bitcore.io/#/ETH/'
234-
},
235-
236-
allowMultiplePrimaryWallets: false
232+
}
237233
};
238234
}
239235

src/providers/incoming-data/incoming-data.spec.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { AppProvider, PopupProvider } from '..';
44
import { TestUtils } from '../../test';
55
import { ActionSheetProvider } from '../action-sheet/action-sheet';
66
import { BwcProvider } from '../bwc/bwc';
7-
import { ConfigProvider } from '../config/config';
87
import { Logger } from '../logger/logger';
98
import { ProfileProvider } from '../profile/profile';
109
import { IncomingDataProvider } from './incoming-data';
@@ -17,7 +16,6 @@ describe('Provider: Incoming Data Provider', () => {
1716
let loggerSpy;
1817
let eventsSpy;
1918
let actionSheetSpy;
20-
let configProvider;
2119
let profileProvider;
2220

2321
class AppProviderMock {
@@ -63,12 +61,6 @@ describe('Provider: Incoming Data Provider', () => {
6361
}
6462
}
6563
]);
66-
67-
configProvider = testBed.get(ConfigProvider);
68-
69-
spyOn(configProvider, 'get').and.returnValue({
70-
allowMultiplePrimaryWallets: true
71-
});
7264
});
7365

7466
describe('Function: SCANNER Redir', () => {
@@ -113,9 +105,9 @@ describe('Provider: Incoming Data Provider', () => {
113105
it('Should handle Join Wallet', () => {
114106
let data =
115107
'copay:RTpopkn5KBnkxuT7x4ummDKx3Lu1LvbntddBC4ssDgaqP7DkojT8ccxaFQEXY4f3huFyMewhHZLbtc';
116-
let stateParams = { url: data, isJoin: true };
108+
let stateParams = { keyId: 'keyId1', url: data };
117109
let nextView = {
118-
name: 'AddWalletPage',
110+
name: 'JoinWalletPage',
119111
params: stateParams
120112
};
121113

@@ -130,9 +122,9 @@ describe('Provider: Incoming Data Provider', () => {
130122
it('Should handle Old Join Wallet', () => {
131123
let data =
132124
'RTpopkn5KBnkxuT7x4ummDKx3Lu1LvbntddBC4ssDgaqP7DkojT8ccxaFQEXY4f3huFyMewhHZLbtc';
133-
let stateParams = { url: data, isJoin: true };
125+
let stateParams = { keyId: 'keyId1', url: data };
134126
let nextView = {
135-
name: 'AddWalletPage',
127+
name: 'JoinWalletPage',
136128
params: stateParams
137129
};
138130

0 commit comments

Comments
 (0)