|
32 | 32 | const { wallets, heading, description } = module; |
33 | 33 | const deviceWallets = wallets[mobileDevice ? "mobile" : "desktop"]; |
34 | 34 |
|
35 | | - $: if ($app.autoSelectWallet) { |
36 | | - const module = deviceWallets.find(m => m.name === $app.autoSelectWallet); |
37 | | - handleWalletSelect(module); |
38 | | - } |
39 | | -
|
40 | 35 | let primaryWallets; |
41 | 36 | let secondaryWallets; |
42 | 37 |
|
43 | | - if (deviceWallets.find(wallet => wallet.preferred)) { |
44 | | - // if preferred wallets, then split in to preferred and not preferred |
45 | | - primaryWallets = deviceWallets.filter(wallet => wallet.preferred); |
46 | | - secondaryWallets = deviceWallets.filter(wallet => !wallet.preferred); |
| 38 | + $: if ($app.autoSelectWallet) { |
| 39 | + const module = deviceWallets.find(m => m.name === $app.autoSelectWallet); |
| 40 | + handleWalletSelect(module); |
47 | 41 | } else { |
48 | | - // otherwise make the first 4 wallets preferred |
49 | | - primaryWallets = deviceWallets.slice(0, 4); |
50 | | - secondaryWallets = deviceWallets.length > 4 && deviceWallets.slice(4); |
51 | | - } |
| 42 | + if (deviceWallets.find(wallet => wallet.preferred)) { |
| 43 | + // if preferred wallets, then split in to preferred and not preferred |
| 44 | + primaryWallets = deviceWallets.filter(wallet => wallet.preferred); |
| 45 | + secondaryWallets = deviceWallets.filter(wallet => !wallet.preferred); |
| 46 | + } else { |
| 47 | + // otherwise make the first 4 wallets preferred |
| 48 | + primaryWallets = deviceWallets.slice(0, 4); |
| 49 | + secondaryWallets = deviceWallets.length > 4 && deviceWallets.slice(4); |
| 50 | + } |
52 | 51 |
|
53 | | - // set the data to show in the modal if wallet hasn't been auto selected |
54 | | - modalData = !$app.autoSelectWallet && { |
55 | | - heading, |
56 | | - description, |
57 | | - primaryWallets, |
58 | | - secondaryWallets |
59 | | - }; |
| 52 | + modalData = { |
| 53 | + heading, |
| 54 | + description, |
| 55 | + primaryWallets, |
| 56 | + secondaryWallets |
| 57 | + }; |
| 58 | + } |
60 | 59 |
|
61 | 60 | function handleWalletSelect(module) { |
62 | 61 | const { provider, interface: selectedWalletInterface } = module.wallet({ |
|
0 commit comments