Skip to content

Commit

Permalink
[Wallet] Fix notifications (#1637)
Browse files Browse the repository at this point in the history
* Lowercase account address in redux state and getter

* Fix `this` issue at update payment request

See here why: https://github.com/invertase/react-native-firebase/blob/ea901386db3d2414c124b208b5f8538175528c9d/src/modules/database/Reference.js#L193

* Fix tests
  • Loading branch information
i1skn authored and cmcewen committed Nov 9, 2019
1 parent 471735d commit f8ccbca
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/mobile/src/app/__snapshots__/Debug.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports[`Debug renders correctly 1`] = `
}
}
>
Address: 0x0000000000000000000000000000000000007E57
Address: 0x0000000000000000000000000000000000007e57
</Text>
<Text
style={
Expand Down
7 changes: 6 additions & 1 deletion packages/mobile/src/firebase/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ function* subscribeToPaymentRequests() {
function* updatePaymentRequestStatus({ id, status }: UpdatePaymentRequestStatusAction) {
try {
Logger.debug(TAG, 'Updating payment request', id, status)
yield call(firebase.database().ref(`${REQUEST_DB}/${id}`).update, { status })
yield call(() =>
firebase
.database()
.ref(`${REQUEST_DB}/${id}`)
.update({ status })
)
Logger.debug(TAG, 'Payment request status updated', id)
} catch (error) {
Logger.error(TAG, `Error while updating payment request ${id} status`, error)
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/mobile/src/web3/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const reducer = (
case Actions.SET_ACCOUNT:
return {
...state,
account: action.address,
account: action.address.toLowerCase(),
}
case Actions.SET_ACCOUNT_IN_WEB3_KEYSTORE:
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/src/web3/saga.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe(getOrCreateAccount, () => {
.withState(state)
.provide([[select(currentAccountSelector), null]])
.provide([[select(pincodeTypeSelector), '123']])
.returns('0x0000000000000000000000000000000000007E57')
.returns('0x0000000000000000000000000000000000007e57')
.run()
})
})
Expand Down
3 changes: 2 additions & 1 deletion packages/mobile/src/web3/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { RootState } from 'src/redux/reducers'

export const currentAccountSelector = (state: RootState) => state.web3.account
export const currentAccountSelector = (state: RootState) =>
(state.web3.account && state.web3.account.toLowerCase()) || null
export const currentAccountInWeb3KeystoreSelector = (state: RootState) =>
state.web3.accountInWeb3Keystore
export const zeroSyncSelector = (state: RootState) => state.web3.zeroSyncMode
Expand Down

0 comments on commit f8ccbca

Please sign in to comment.