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

Commit 2156998

Browse files
Add parameter to customize Wait screen copy.
1 parent 11fae4d commit 2156998

File tree

11 files changed

+36
-16
lines changed

11 files changed

+36
-16
lines changed

src/action/nav-mobile.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ class NavAction {
9696
this._reset('Main', 'LoaderSyncing');
9797
}
9898

99-
goWait() {
99+
goWait({ copy = 'Loading network...' }) {
100+
this._store.waitScreenCopy = copy;
100101
this._navigate('Wait');
101102
}
102103

src/action/nav.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ class NavAction {
6969
this._store.route = 'LoaderSyncing';
7070
}
7171

72-
goWait() {
72+
goWait({ copy = 'Loading network...' }) {
73+
this._store.waitScreenCopy = copy;
7374
this._store.route = 'Wait';
7475
}
7576

src/action/payment.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class PaymentAction {
265265
msg: 'Sending transaction timed out!',
266266
});
267267
}, PAYMENT_TIMEOUT);
268-
this._nav.goWait();
268+
this._nav.goWait({ copy: 'Sending payment...' });
269269
try {
270270
await this._sendPayment();
271271
this._nav.goPayBitcoinDone();
@@ -302,7 +302,7 @@ class PaymentAction {
302302
this._nav.goPaymentFailed();
303303
}, PAYMENT_TIMEOUT);
304304
try {
305-
this._nav.goWait();
305+
this._nav.goWait({ copy: 'Sending payment...' });
306306
const invoice = this._store.payment.address;
307307
const stream = this._grpc.sendStreamCommand('sendPayment');
308308
await new Promise((resolve, reject) => {

src/action/wallet.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class WalletAction {
247247
this.initResetPassword();
248248
return this._notification.display({ msg: errorMsg });
249249
}
250-
this._nav.goWait();
250+
this._nav.goWait({ copy: 'Updating password...' });
251251
await this.resetPassword({
252252
currentPassword: password,
253253
newPassword: newPassword,
@@ -396,7 +396,7 @@ class WalletAction {
396396
*/
397397
async unlockWallet({ walletPassword }) {
398398
try {
399-
this._nav.goWait();
399+
this._nav.goWait({});
400400
await this._grpc.sendUnlockerCommand('UnlockWallet', {
401401
walletPassword: toBuffer(walletPassword),
402402
recoveryWindow: this._store.settings.restoring ? 250 : 0,
@@ -465,7 +465,7 @@ class WalletAction {
465465
if (this._store.walletAddress) {
466466
this._nav.goNewAddress();
467467
} else {
468-
this._nav.goWait();
468+
this._nav.goWait({});
469469
when(() => this._store.walletAddress, () => this._nav.goNewAddress());
470470
}
471471
}

src/store.js

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export class Store {
8989
notifications: [],
9090
unseenNtfnCount: 0,
9191
logs: '',
92+
waitScreenCopy: 'Loading network...',
9293

9394
// Persistent data
9495
settings: {

src/view/main-mobile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const ResetPasswordSaved = () => <ResetPinSavedView nav={nav} />;
111111

112112
const LoaderSyncing = () => <LoaderSyncingView store={store} />;
113113

114-
const Wait = () => <WaitView />;
114+
const Wait = () => <WaitView store={store} />;
115115

116116
const Home = () => (
117117
<HomeView

src/view/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class MainView extends Component {
9999
<NewAddress store={store} invoice={invoice} info={info} />
100100
)}
101101
{route === 'LoaderSyncing' && <LoaderSyncing store={store} />}
102-
{route === 'Wait' && <Wait />}
102+
{route === 'Wait' && <Wait store={store} />}
103103
{route === 'Home' && (
104104
<Home
105105
store={store}

src/view/wait-mobile.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { StyleSheet, ActivityIndicator } from 'react-native';
3+
import PropTypes from 'prop-types';
34
import Background from '../component/background';
45
import MainContent from '../component/main-content';
56
import Text from '../component/text';
@@ -19,17 +20,21 @@ const styles = StyleSheet.create({
1920
},
2021
});
2122

22-
const WaitView = () => (
23+
const WaitView = ({ store }) => (
2324
<Background color={color.blackDark}>
2425
<MainContent style={styles.content}>
2526
<ActivityIndicator
2627
size="large"
2728
color={color.lightPurple}
2829
style={styles.spinner}
2930
/>
30-
<Text style={styles.copy}>Loading network...</Text>
31+
<Text style={styles.copy}>{store.waitScreenCopy}</Text>
3132
</MainContent>
3233
</Background>
3334
);
3435

36+
WaitView.propTypes = {
37+
store: PropTypes.object.isRequired,
38+
};
39+
3540
export default WaitView;

src/view/wait.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { StyleSheet } from 'react-native';
3+
import PropTypes from 'prop-types';
34
import Background from '../component/background';
45
import MainContent from '../component/main-content';
56
import { color } from '../component/style';
@@ -11,12 +12,16 @@ const styles = StyleSheet.create({
1112
},
1213
});
1314

14-
const WaitView = () => (
15+
const WaitView = ({ store }) => (
1516
<Background color={color.blackDark}>
1617
<MainContent style={styles.content}>
17-
<ContinuousLoadNetworkSpinner msg="Loading network..." />
18+
<ContinuousLoadNetworkSpinner msg={store.waitScreenCopy} />
1819
</MainContent>
1920
</Background>
2021
);
2122

23+
WaitView.propTypes = {
24+
store: PropTypes.object.isRequired,
25+
};
26+
2227
export default WaitView;

stories/screen-story.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ storiesOf('Screens', module)
192192
.add('Loader - Syncing Chain (Mobile)', () => (
193193
<LoaderSyncingMobile store={store} />
194194
))
195-
.add('Wait', () => <Wait />)
196-
.add('Wait (Mobile)', () => <WaitMobile />)
195+
.add('Wait', () => <Wait store={store} />)
196+
.add('Wait (Mobile)', () => <WaitMobile store={store} />)
197197
.add('Home', () => (
198198
<Home
199199
store={store}

test/unit/action/nav.spec.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,16 @@ describe('Action Nav Unit Tests', () => {
9797

9898
describe('goWait()', () => {
9999
it('should set correct route', () => {
100-
nav.goWait();
100+
nav.goWait({});
101101
expect(store.route, 'to equal', 'Wait');
102102
});
103+
104+
it('should set correct copy', () => {
105+
const testCopy = 'foobar';
106+
nav.goWait({ copy: testCopy });
107+
expect(store.route, 'to equal', 'Wait');
108+
expect(store.waitScreenCopy, 'to equal', testCopy);
109+
});
103110
});
104111

105112
describe('goHome()', () => {

0 commit comments

Comments
 (0)