Skip to content

Commit 006fdbc

Browse files
committed
fix: invalid feedback modal on pin screen
1 parent 419e2fb commit 006fdbc

File tree

5 files changed

+16
-144
lines changed

5 files changed

+16
-144
lines changed

src/sagas/wallet.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ export function* startWallet(action) {
144144
pin,
145145
} = action.payload;
146146

147+
console.log('PIN: ', pin);
148+
147149
const uniqueDeviceId = getUniqueId();
148150
const useWalletService = false; // yield call(isWalletServiceEnabled);
149151
const usePushNotification = yield call(isPushNotificationEnabled);

src/screens/CreateTokenConfirm.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class CreateTokenConfirm extends React.Component {
103103
},
104104
});
105105
}, (err) => {
106+
console.log('Err: ', err);
106107
this.onError(err.message);
107108
});
108109
}
@@ -112,7 +113,7 @@ class CreateTokenConfirm extends React.Component {
112113
*/
113114
onSendPress = () => {
114115
const params = {
115-
cb: this.executeCreate,
116+
cb: this.executeCreate.bind(this),
116117
screenText: t`Enter your 6-digit pin to create your token`,
117118
biometryText: t`Authorize token creation`,
118119
canCancel: true,
@@ -138,6 +139,7 @@ class CreateTokenConfirm extends React.Component {
138139
* @param {String} message Error message
139140
*/
140141
onError = (message) => {
142+
console.log('Message on error: ', message);
141143
this.setState({
142144
modalType: 'FeedbackModal',
143145
modal: {
@@ -169,9 +171,9 @@ class CreateTokenConfirm extends React.Component {
169171
this.state.modalType === 'FeedbackModal' ? (
170172
// eslint-disable-next-line react/jsx-indent
171173
<FeedbackModal
172-
icon={this.modal.icon}
173-
text={this.modal.message}
174-
onDismiss={this.modal.onDismiss}
174+
icon={this.state.modal.icon}
175+
text={this.state.modal.text}
176+
onDismiss={this.state.modal.onDismiss}
175177
/>
176178
) : (
177179
// eslint-disable-next-line react/jsx-indent

src/screens/Dashboard.js

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -25,122 +25,6 @@ import { COLORS } from '../styles/themes';
2525
import { TOKEN_DOWNLOAD_STATUS } from '../sagas/tokens';
2626
import { NanoContractsList } from '../components/NanoContract/NanoContractsList';
2727
import { getNanoContractFeatureToggle } from '../utils';
28-
import { Address } from '@hathor/wallet-lib';
29-
30-
const MOCK_DEPOSIT = (wallet) => ({
31-
type: 'WC_SESSION_REQUEST',
32-
payload: {
33-
id: 3,
34-
topic: '6514868878fe1dadd648a495692d5ab9d458c7d45876f2c63e1e7274640a53d4',
35-
jsonrpc: '2.0',
36-
params: {
37-
request: {
38-
method: 'htr_sendNanoContractTx',
39-
params: {
40-
push_tx: true,
41-
network: 'testnet',
42-
method: 'bet',
43-
blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595',
44-
nc_id: '00002a71944472852754ed2f53dbd366b90b090bb319715e82f7fe0e786f0553',
45-
actions: [{
46-
type: 'deposit',
47-
token: '00',
48-
amount: 1
49-
}],
50-
args: [
51-
(new Address('WdXfZ6zKa1mQpBAhGQVj9pCuWDqCrG5ZR6', {
52-
network: wallet.getNetwork()
53-
})).decode().toString('hex'),
54-
'true'
55-
],
56-
},
57-
},
58-
},
59-
},
60-
});
61-
62-
const MOCK_INITIALIZE = (wallet) => ({
63-
type: 'WC_SESSION_REQUEST',
64-
payload: {
65-
id: 3,
66-
topic: '6514868878fe1dadd648a495692d5ab9d458c7d45876f2c63e1e7274640a53d4',
67-
jsonrpc: '2.0',
68-
params: {
69-
request: {
70-
method: 'htr_sendNanoContractTx',
71-
params: {
72-
push_tx: true,
73-
network: 'testnet',
74-
method: 'initialize',
75-
blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595',
76-
args: [
77-
'76a914969647cffd30891b1444944ff228f3bd7582fa4588ac',
78-
'00',
79-
1720281665,
80-
],
81-
},
82-
},
83-
},
84-
},
85-
});
86-
87-
const MOCK_WITHDRAWL = (wallet) => ({
88-
type: 'WC_SESSION_REQUEST',
89-
payload: {
90-
id: 3,
91-
topic: '6514868878fe1dadd648a495692d5ab9d458c7d45876f2c63e1e7274640a53d4',
92-
jsonrpc: '2.0',
93-
params: {
94-
request: {
95-
method: 'htr_sendNanoContractTx',
96-
params: {
97-
push_tx: true,
98-
network: 'testnet',
99-
method: 'withdrawl',
100-
blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595',
101-
nc_id: '00002a71944472852754ed2f53dbd366b90b090bb319715e82f7fe0e786f0553',
102-
actions: [{
103-
type: 'withdrawal',
104-
token: '00',
105-
amount: 1
106-
}],
107-
},
108-
},
109-
},
110-
},
111-
});
112-
113-
const MOCK_SET_RESULT = (wallet) => ({
114-
type: 'WC_SESSION_REQUEST',
115-
payload: {
116-
id: 3,
117-
topic: '6514868878fe1dadd648a495692d5ab9d458c7d45876f2c63e1e7274640a53d4',
118-
jsonrpc: '2.0',
119-
params: {
120-
request: {
121-
method: 'htr_sendNanoContractTx',
122-
params: {
123-
push_tx: true,
124-
network: 'testnet',
125-
method: 'set_result',
126-
blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595',
127-
nc_id: '00002a71944472852754ed2f53dbd366b90b090bb319715e82f7fe0e786f0553',
128-
actions: [{
129-
type: 'deposit',
130-
token: '00',
131-
amount: 1
132-
}],
133-
args: [
134-
(new Address('WdXfZ6zKa1mQpBAhGQVj9pCuWDqCrG5ZR6', {
135-
network: wallet.getNetwork()
136-
})).decode().toString('hex'),
137-
'true'
138-
],
139-
},
140-
},
141-
},
142-
},
143-
});
14428

14529
/**
14630
* State filter to retrieve token-related data from root state.
@@ -233,32 +117,8 @@ export const Dashboard = () => {
233117
navigation.navigate('MainScreen');
234118
}
235119

236-
const onInitializeNanoTx = () => {
237-
dispatch(MOCK_INITIALIZE(wallet));
238-
console.log('initialize call on nano contract');
239-
};
240-
241-
const onSendNanoTx = () => {
242-
dispatch(MOCK_DEPOSIT(wallet));
243-
console.log('deposit call on nano contract');
244-
};
245-
246-
const onWithdrawalNanoTx = () => {
247-
dispatch(MOCK_WITHDRAWL(wallet));
248-
console.log('withdrawal call on nano contract');
249-
};
250-
251-
const onSetResultNanoTx = () => {
252-
dispatch(MOCK_SET_RESULT(wallet));
253-
console.log('set_result call on nano contract');
254-
};
255-
256120
return (
257121
<Wrapper>
258-
<Button title='Deposit Nano Tx' onPress={onSendNanoTx} />
259-
<Button title='Initialize Nano Tx' onPress={onInitializeNanoTx} />
260-
<Button title='Withdrawal Nano Tx' onPress={onWithdrawalNanoTx} />
261-
<Button title='Set Result Nano Tx' onPress={onSetResultNanoTx} />
262122
<ShowPushNotificationTxDetails navigation={navigation} />
263123
<AskForPushNotification navigation={navigation} />
264124
<AskForPushNotificationRefresh />

src/screens/PinScreen.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ export default function PinScreen({ isLockScreen }) {
232232
if (route.params.dispatchResponse) {
233233
dispatch(pinScreenResult(pin));
234234
}
235+
236+
// TODO: We need to refactor CreateTokenConfirm and SendConfirmScreen
237+
// to stop passing a method as callback so we can remove this:
238+
if (route.params.cb) {
239+
route.params.cb(pin);
240+
}
235241
}
236242
};
237243

src/screens/WalletConnect/SignMessageRequestScreen.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { COLORS } from '../../styles/themes';
1919
export function SignMessageRequestScreen({ route }) {
2020
const { signMessageRequest } = route.params;
2121

22+
console.log('Sign Message Request: ', signMessageRequest);
23+
2224
return (
2325
<Wrapper>
2426
<HathorHeader

0 commit comments

Comments
 (0)