Skip to content

Commit

Permalink
feat: trigger qrsigning modal using approval controller (#6212)
Browse files Browse the repository at this point in the history
* feat: trigger qrsigning modal using approval controller

* fix: use approval request to control QR modal

* remove QRState usage

* use approval request to control QR modal for tx

* fix lint

* add early return on qr signing modal

---------

Co-authored-by: Vinicius Stevam <[email protected]>
Co-authored-by: Vinicius Stevam <[email protected]>
  • Loading branch information
3 people authored Jun 23, 2023
1 parent e090191 commit 96473d3
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/components/Nav/Main/RootRPCMethodsUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,16 @@ const RootRPCMethodsUI = (props) => {

const renderQRSigningModal = () => {
const { isSigningQRObject, QRState } = props;
const shouldRenderThisModal = !showPendingApproval && isSigningQRObject;
return (
shouldRenderThisModal && (
<QRSigningModal isVisible={isSigningQRObject} QRState={QRState} />
)
);

if (
!isSigningQRObject ||
transactionModalType ||
showPendingApproval?.type !== ApprovalTypes.TRANSACTION
) {
return null;
}

return <QRSigningModal isVisible QRState={QRState} />;
};

const onWalletConnectSessionApproval = () => {
Expand Down Expand Up @@ -439,6 +443,7 @@ const RootRPCMethodsUI = (props) => {

const hideTransactionModal = () => {
setShowPendingApproval(false);
setTransactionModalType(undefined);
};

const showTransactionApproval = () =>
Expand Down Expand Up @@ -830,7 +835,9 @@ RootRPCMethodsUI.propTypes = {
* Chain id
*/
chainId: PropTypes.string,
// eslint-disable-next-line react/no-unused-prop-types
isSigningQRObject: PropTypes.bool,
// eslint-disable-next-line react/no-unused-prop-types
QRState: PropTypes.object,
/**
* updates redux when network is switched
Expand Down

0 comments on commit 96473d3

Please sign in to comment.