Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 321a6f7

Browse files
authored
Merge pull request #771 from lightninglabs/password-mobile
Password mobile
2 parents ddf0f45 + 0b336ac commit 321a6f7

File tree

4 files changed

+75
-13
lines changed

4 files changed

+75
-13
lines changed

mobile/main.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import SetPasswordConfirmView from '../src/view/set-password-confirm-mobile';
88
import SeedSuccessView from '../src/view/seed-success';
99
import NewAddressView from '../src/view/new-address';
1010

11+
import PasswordView from '../src/view/password-mobile';
12+
import WaitView from '../src/view/wait-mobile';
1113
import HomeView from '../src/view/home';
1214
import SettingView from '../src/view/setting';
1315
import SettingUnitView from '../src/view/setting-unit';
@@ -45,7 +47,6 @@ const wallet = new WalletAction(store, grpc, db, nav, notify);
4547
const setting = new SettingAction(store, wallet, db, ipc);
4648
sinon.stub(wallet, 'update');
4749
sinon.stub(wallet, 'checkSeed');
48-
sinon.stub(wallet, 'checkPassword');
4950
sinon.stub(wallet, 'getExchangeRate');
5051
const transaction = new TransactionAction(store, grpc, nav, notify);
5152
sinon.stub(transaction, 'update');
@@ -78,6 +79,10 @@ const NewAddress = () => (
7879
/>
7980
);
8081

82+
const Password = () => <PasswordView store={store} wallet={wallet} />;
83+
84+
const Wait = () => <WaitView />;
85+
8186
const Home = () => (
8287
<HomeView
8388
store={store}
@@ -112,20 +117,14 @@ const InvoiceQR = () => (
112117

113118
const Pay = () => <PaymentView store={store} payment={payment} nav={nav} />;
114119

115-
const SetupStack = createStackNavigator(
120+
const MainStack = createStackNavigator(
116121
{
117122
SetPassword,
118123
SetPasswordConfirm,
119124
SeedSuccess,
120125
NewAddress,
121-
},
122-
{
123-
headerMode: 'none',
124-
}
125-
);
126-
127-
const MainStack = createStackNavigator(
128-
{
126+
Password,
127+
Wait,
129128
Home,
130129
Settings,
131130
SettingsUnit,
@@ -158,7 +157,6 @@ const PayStack = createStackNavigator(
158157

159158
const RootStack = createStackNavigator(
160159
{
161-
Setup: SetupStack,
162160
Main: MainStack,
163161
Invoice: InvoiceStack,
164162
Pay: PayStack,

src/component/pin-entry.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const pinEntryStyles = StyleSheet.create({
1717
},
1818
});
1919

20-
export const PinBubbles = ({ pin }) => (
21-
<View style={pinEntryStyles.wrapper}>
20+
export const PinBubbles = ({ pin, style }) => (
21+
<View style={[pinEntryStyles.wrapper, style]}>
2222
<PinBubble char={pin[0]} />
2323
<PinBubble char={pin[1]} />
2424
<PinBubble char={pin[2]} />
@@ -30,6 +30,7 @@ export const PinBubbles = ({ pin }) => (
3030

3131
PinBubbles.propTypes = {
3232
pin: PropTypes.string.isRequired,
33+
style: View.propTypes.style,
3334
};
3435

3536
//

src/view/password-mobile.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from 'react';
2+
import { View, StyleSheet } from 'react-native';
3+
import { observer } from 'mobx-react';
4+
import PropTypes from 'prop-types';
5+
import Background from '../component/background';
6+
import MainContent from '../component/main-content';
7+
import BoltIcon from '../asset/icon/lightning-bolt';
8+
import LightningWord from '../asset/icon/lightning-word';
9+
import { Text } from '../component/text';
10+
import { FormStretcher } from '../component/form';
11+
import { PinBubbles, PinKeyboard } from '../component/pin-entry';
12+
13+
//
14+
// Password View (Mobile)
15+
//
16+
17+
const styles = StyleSheet.create({
18+
content: {
19+
paddingLeft: 20,
20+
paddingRight: 20,
21+
},
22+
boltWrapper: {
23+
marginTop: 50,
24+
},
25+
wordWrapper: {
26+
marginTop: 35,
27+
},
28+
bubbles: {
29+
marginTop: 10,
30+
},
31+
});
32+
33+
const PasswordView = ({ store, wallet }) => (
34+
<Background image="purple-gradient-bg">
35+
<MainContent style={styles.content}>
36+
<View style={styles.boltWrapper}>
37+
<BoltIcon height={64 * 1.3} width={126 * 1.3} />
38+
</View>
39+
<View style={styles.wordWrapper}>
40+
<LightningWord height={31.2} width={245.7} />
41+
</View>
42+
<FormStretcher>
43+
<Text>Unlock with your pin</Text>
44+
<PinBubbles pin={store.wallet.password} style={styles.bubbles} />
45+
</FormStretcher>
46+
<PinKeyboard
47+
onInput={digit => wallet.pushPinDigit({ digit, param: 'password' })}
48+
onBackspace={() => wallet.popPinDigit({ param: 'password' })}
49+
/>
50+
</MainContent>
51+
</Background>
52+
);
53+
54+
PasswordView.propTypes = {
55+
store: PropTypes.object.isRequired,
56+
wallet: PropTypes.object.isRequired,
57+
};
58+
59+
export default observer(PasswordView);

stories/screen-story.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import SetPasswordMobile from '../src/view/set-password-mobile';
5050
import SetPasswordConfirm from '../src/view/set-password-confirm';
5151
import SetPasswordConfirmMobile from '../src/view/set-password-confirm-mobile';
5252
import Password from '../src/view/password';
53+
import PasswordMobile from '../src/view/password-mobile';
5354
import RestorePassword from '../src/view/restore-password';
5455
import ResetPasswordCurrent from '../src/view/reset-password-current';
5556
import ResetPasswordNew from '../src/view/reset-password-new';
@@ -115,6 +116,9 @@ storiesOf('Screens', module)
115116
<SetPasswordConfirmMobile store={store} wallet={wallet} />
116117
))
117118
.add('Password', () => <Password store={store} wallet={wallet} />)
119+
.add('Password (Mobile)', () => (
120+
<PasswordMobile store={store} wallet={wallet} />
121+
))
118122
.add('Restore Wallet: Password', () => (
119123
<RestorePassword store={store} wallet={wallet} nav={nav} />
120124
))

0 commit comments

Comments
 (0)