Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement/tx status notification #1475

Merged
merged 83 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
72cd543
simple not update
estebanmino Mar 27, 2020
241a0d6
text update
estebanmino Mar 27, 2020
e79a830
wip
estebanmino Mar 30, 2020
54c7587
delete old details
estebanmino Mar 30, 2020
41917d7
delete old confirm
estebanmino Mar 30, 2020
4b6d6ff
almost done withtx details
estebanmino Mar 30, 2020
23201b3
modal working
estebanmino Mar 31, 2020
b3fb383
modal title
estebanmino Mar 31, 2020
c31ea12
rm transfer element
estebanmino Apr 1, 2020
f2bcdeb
clean
estebanmino Apr 1, 2020
539018d
fix transfer
estebanmino Apr 1, 2020
e60647d
transfer and payment channel
estebanmino Apr 1, 2020
17fa91b
decodeTransferFromTx
estebanmino Apr 1, 2020
a9f4204
decodeDeploymentTx
estebanmino Apr 1, 2020
f5d7eb0
decodeConfirmTx
estebanmino Apr 1, 2020
398fb12
onpress
estebanmino Apr 1, 2020
adf81c5
status
estebanmino Apr 1, 2020
f1f3d66
close on view web
estebanmino Apr 1, 2020
934dd23
more cleanup
estebanmino Apr 1, 2020
7861149
payment
estebanmino Apr 1, 2020
e035443
showing not
estebanmino Apr 3, 2020
f82ac3b
closer?
estebanmino Apr 3, 2020
2fff69b
comment
estebanmino Apr 3, 2020
a2ca3a4
tx details and not
estebanmino Apr 3, 2020
a828467
animated
estebanmino Apr 3, 2020
584dafc
tx not
estebanmino Apr 3, 2020
cf16ae1
enable access view on not
estebanmino Apr 6, 2020
906c2f9
animated
estebanmino Apr 6, 2020
8882500
rename
estebanmino Apr 6, 2020
5f12016
using txnnot manager
estebanmino Apr 6, 2020
14c3887
working
estebanmino Apr 6, 2020
e696946
receive
estebanmino Apr 7, 2020
0098c29
rm unused
estebanmino Apr 7, 2020
d422e9c
rm logs
estebanmino Apr 7, 2020
3776f95
handle browser not
estebanmino Apr 7, 2020
9bab873
parse date
estebanmino Apr 7, 2020
059da37
handle asset details
estebanmino Apr 7, 2020
cfc9c33
tx summary rename props
estebanmino Apr 7, 2020
d3e184f
Refactor names in details
estebanmino Apr 7, 2020
12dc41b
handle primary currency
estebanmino Apr 7, 2020
e6b544e
missing props
estebanmino Apr 7, 2020
013ad51
Merge branch 'develop' into improvement/tx-status-notification
estebanmino Apr 7, 2020
a4a8757
almost there
estebanmino Apr 8, 2020
aba9071
working but browser
estebanmino Apr 8, 2020
281cd5e
finally
estebanmino Apr 8, 2020
e25468a
one more thing
estebanmino Apr 9, 2020
a19096e
done
estebanmino Apr 9, 2020
46fb9ad
snaps
estebanmino Apr 9, 2020
007dcae
missing locales
estebanmino Apr 9, 2020
12111bd
update ethereum address
estebanmino Apr 15, 2020
124eb15
snaps
estebanmino Apr 16, 2020
20a968a
Merge branch 'develop' into improvement/tx-status-notification
estebanmino Apr 21, 2020
0b41c31
handle instapay txs
estebanmino Apr 21, 2020
f731820
snaps
estebanmino Apr 21, 2020
1cbd3a8
feeless tx
estebanmino Apr 27, 2020
bb1b869
data check
estebanmino Apr 27, 2020
4fedc62
merge dev
estebanmino Apr 27, 2020
24eb0cf
No fee
estebanmino Apr 27, 2020
0092cd4
instance._hideTransactionNotification
estebanmino Apr 27, 2020
f5943c7
fix instapay notifications
estebanmino Apr 28, 2020
481a406
elevation
estebanmino Apr 29, 2020
95ec237
fix remaining issues
estebanmino Apr 29, 2020
1afa65a
apeed up cancel
estebanmino Apr 29, 2020
101822e
transaction modal
estebanmino Apr 29, 2020
66ff1f5
speed cancel
estebanmino Apr 30, 2020
77a233e
speedup cancel ui
estebanmino Apr 30, 2020
47509b2
working
estebanmino Apr 30, 2020
014c0bb
added engine methods
estebanmino Apr 30, 2020
a5831e7
done
estebanmino Apr 30, 2020
0a274ba
snaps
estebanmino Apr 30, 2020
0c95c75
Merge branch 'develop' into improvement/tx-status-notification
estebanmino Apr 30, 2020
6071431
develop|
estebanmino May 4, 2020
3f59325
fix qaing
estebanmino May 4, 2020
a3e9547
fix ios build
estebanmino May 4, 2020
c8ac5ce
one snap
estebanmino May 4, 2020
fb0ab20
remove test
estebanmino May 4, 2020
a295ca9
status text fix
estebanmino May 5, 2020
2a59cb8
cancelled
estebanmino May 5, 2020
13bf1ad
margin
estebanmino May 5, 2020
34466eb
snaps
estebanmino May 5, 2020
b2aac67
fix insufficient funds
estebanmino May 5, 2020
b87f678
doc
estebanmino May 5, 2020
714b968
Merge branch 'develop' into improvement/tx-status-notification
estebanmino May 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/actions/transactionNotification/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export function hideTransactionNotification() {
return {
type: 'HIDE_TRANSACTION_NOTIFICATION'
};
}

export function showTransactionNotification({ autodismiss, transaction, status }) {
return {
type: 'SHOW_TRANSACTION_NOTIFICATION',
isVisible: true,
autodismiss,
transaction,
status
};
}
31 changes: 20 additions & 11 deletions app/components/Nav/Main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { createStackNavigator } from 'react-navigation-stack';
import { createBottomTabNavigator } from 'react-navigation-tabs';
import ENS from 'ethjs-ens';
import GlobalAlert from '../../UI/GlobalAlert';
import FlashMessage from 'react-native-flash-message';
import BackgroundTimer from 'react-native-background-timer';
import Browser from '../../Views/Browser';
import AddBookmark from '../../Views/AddBookmark';
Expand Down Expand Up @@ -59,7 +58,6 @@ import PaymentChannel from '../../Views/PaymentChannel';
import ImportPrivateKeySuccess from '../../Views/ImportPrivateKeySuccess';
import PaymentRequest from '../../UI/PaymentRequest';
import PaymentRequestSuccess from '../../UI/PaymentRequestSuccess';
import { TransactionNotification } from '../../UI/TransactionNotification';
import TransactionsNotificationManager from '../../../core/TransactionsNotificationManager';
import Engine from '../../../core/Engine';
import AppConstants from '../../../core/AppConstants';
Expand Down Expand Up @@ -100,6 +98,8 @@ import Amount from '../../Views/SendFlow/Amount';
import Confirm from '../../Views/SendFlow/Confirm';
import ContactForm from '../../Views/Settings/Contacts/ContactForm';
import TransactionTypes from '../../../core/TransactionTypes';
import TxNotification from '../../UI/TxNotification';
import { showTransactionNotification, hideTransactionNotification } from '../../../actions/transactionNotification';

const styles = StyleSheet.create({
flex: {
Expand Down Expand Up @@ -417,7 +417,15 @@ class Main extends PureComponent {
/**
* A string representing the network name
*/
providerType: PropTypes.string
providerType: PropTypes.string,
/**
* Dispatch showing a transaction notification
*/
showTransactionNotification: PropTypes.func,
/**
* Dispatch hiding a transaction notification
*/
hideTransactionNotification: PropTypes.func
};

state = {
Expand Down Expand Up @@ -515,7 +523,11 @@ class Main extends PureComponent {
});

setTimeout(() => {
TransactionsNotificationManager.init(this.props.navigation);
TransactionsNotificationManager.init(
this.props.navigation,
this.props.showTransactionNotification,
this.props.hideTransactionNotification
);
this.pollForIncomingTransactions();

this.initializeWalletConnect();
Expand Down Expand Up @@ -1063,18 +1075,13 @@ class Main extends PureComponent {

render() {
const { forceReload } = this.state;

return (
<React.Fragment>
<View style={styles.flex}>
{!forceReload ? <MainNavigator navigation={this.props.navigation} /> : this.renderLoader()}
<GlobalAlert />
<FlashMessage
position="bottom"
MessageComponent={TransactionNotification}
animationDuration={150}
/>
<FadeOutOverlay />
<TxNotification navigation={this.props.navigation} />
</View>
{this.renderSigningModal()}
{this.renderWalletConnectSessionRequestModal()}
Expand All @@ -1098,7 +1105,9 @@ const mapStateToProps = state => ({

const mapDispatchToProps = dispatch => ({
setEtherTransaction: transaction => dispatch(setEtherTransaction(transaction)),
setTransactionObject: transaction => dispatch(setTransactionObject(transaction))
setTransactionObject: transaction => dispatch(setTransactionObject(transaction)),
showTransactionNotification: args => dispatch(showTransactionNotification(args)),
hideTransactionNotification: () => dispatch(hideTransactionNotification())
});

export default connect(
Expand Down
156 changes: 156 additions & 0 deletions app/components/UI/ActionModal/ActionContent/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import React from 'react';
import PropTypes from 'prop-types';
import { StyleSheet, View } from 'react-native';
import { colors } from '../../../../styles/common';
import StyledButton from '../../StyledButton';
import { strings } from '../../../../../locales/i18n';

const styles = StyleSheet.create({
viewWrapper: {
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
marginHorizontal: 24
},
viewContainer: {
width: '100%',
backgroundColor: colors.white,
borderRadius: 10
},
actionContainer: {
borderTopColor: colors.grey200,
borderTopWidth: 1,
flexDirection: 'row',
padding: 16
},
childrenContainer: {
minHeight: 250,
width: '100%',

flexDirection: 'row',
alignItems: 'center'
},
button: {
flex: 1
},
cancel: {
marginRight: 8
},
confirm: {
marginLeft: 8
}
});

/**
* View that renders the content of an action modal
* The objective of this component is to reuse it in other places and not
* only on ActionModal component
*/
export default function ActionContent({
cancelTestID,
confirmTestID,
cancelText,
children,
confirmText,
confirmDisabled,
cancelButtonMode,
confirmButtonMode,
displayCancelButton,
displayConfirmButton,
onCancelPress,
onConfirmPress
}) {
return (
<View style={styles.viewWrapper}>
<View style={styles.viewContainer}>
<View style={styles.childrenContainer}>{children}</View>
<View style={styles.actionContainer}>
{displayCancelButton && (
<StyledButton
testID={cancelTestID}
type={cancelButtonMode}
onPress={onCancelPress}
containerStyle={[styles.button, displayConfirmButton ? styles.cancel : {}]}
>
{cancelText}
</StyledButton>
)}
{displayConfirmButton && (
<StyledButton
testID={confirmTestID}
type={confirmButtonMode}
onPress={onConfirmPress}
containerStyle={[styles.button, displayCancelButton ? styles.confirm : {}]}
disabled={confirmDisabled}
>
{confirmText}
</StyledButton>
)}
</View>
</View>
</View>
);
}

ActionContent.defaultProps = {
cancelButtonMode: 'neutral',
confirmButtonMode: 'warning',
confirmTestID: '',
cancelTestID: '',
cancelText: strings('action_view.cancel'),
confirmText: strings('action_view.confirm'),
confirmDisabled: false,
displayCancelButton: true,
displayConfirmButton: true
};

ActionContent.propTypes = {
/**
* TestID for the cancel button
*/
cancelTestID: PropTypes.string,
/**
* TestID for the confirm button
*/
confirmTestID: PropTypes.string,
/**
* Text to show in the cancel button
*/
cancelText: PropTypes.string,
/**
* Content to display above the action buttons
*/
children: PropTypes.node,
/**
* Type of button to show as the cancel button
*/
cancelButtonMode: PropTypes.oneOf(['cancel', 'neutral', 'confirm', 'normal']),
/**
* Type of button to show as the confirm button
*/
confirmButtonMode: PropTypes.oneOf(['normal', 'confirm', 'warning']),
/**
* Whether confirm button is disabled
*/
confirmDisabled: PropTypes.bool,
/**
* Text to show in the confirm button
*/
confirmText: PropTypes.string,
/**
* Whether cancel button should be displayed
*/
displayCancelButton: PropTypes.bool,
/**
* Whether confirm button should be displayed
*/
displayConfirmButton: PropTypes.bool,
/**
* Called when the cancel button is clicked
*/
onCancelPress: PropTypes.func,
/**
* Called when the confirm button is clicked
*/
onConfirmPress: PropTypes.func
};
105 changes: 11 additions & 94 deletions app/components/UI/ActionModal/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,99 +41,16 @@ exports[`ActionModal should render correctly 1`] = `
swipeThreshold={100}
useNativeDriver={false}
>
<View
style={
Object {
"alignItems": "center",
"flexDirection": "column",
"justifyContent": "center",
"marginHorizontal": 24,
}
}
>
<View
style={
Object {
"backgroundColor": "#FFFFFF",
"borderRadius": 10,
"width": "100%",
}
}
>
<View
style={
Object {
"alignItems": "center",
"flexDirection": "row",
"minHeight": 250,
}
}
/>
<View
style={
Object {
"borderTopColor": "#bbc0c5",
"borderTopWidth": 1,
"flexDirection": "row",
"padding": 16,
}
}
>
<StyledButton
containerStyle={
Array [
Object {
"flex": 1,
},
Object {
"marginRight": 8,
},
]
}
disabledContainerStyle={
Object {
"opacity": 0.6,
}
}
styleDisabled={
Object {
"opacity": 0.6,
}
}
testID=""
type="neutral"
>
Cancel
</StyledButton>
<StyledButton
containerStyle={
Array [
Object {
"flex": 1,
},
Object {
"marginLeft": 8,
},
]
}
disabled={false}
disabledContainerStyle={
Object {
"opacity": 0.6,
}
}
styleDisabled={
Object {
"opacity": 0.6,
}
}
testID=""
type="warning"
>
Confirm
</StyledButton>
</View>
</View>
</View>
<ActionContent
cancelButtonMode="neutral"
cancelTestID=""
cancelText="Cancel"
confirmButtonMode="warning"
confirmDisabled={false}
confirmTestID=""
confirmText="Confirm"
displayCancelButton={true}
displayConfirmButton={true}
/>
</ReactNativeModal>
`;
Loading