Skip to content

Commit

Permalink
Merge pull request #2546 from CityOfZion/CU-86a0yj0rj
Browse files Browse the repository at this point in the history
CU-86a0yj0rj - Extend the WC connection time by 1 week everytime the …
  • Loading branch information
melanke authored Oct 23, 2023
2 parents fcb6f7c + 080d730 commit 739dcc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
16 changes: 8 additions & 8 deletions app/containers/App/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ErrorBoundary from '../../components/ErrorBoundaries/Main'
import FramelessNavigation from '../../components/FramelessNavigation'
import { parseQuery } from '../../core/formatters'
import withSettingsContext from '../../hocs/withSettingsContext'
import { getInformationFromSession } from '../../util/walletConnect'

const ipc = require('electron').ipcRenderer

Expand Down Expand Up @@ -133,18 +134,17 @@ const App = ({

useEffect(
() => {
const disconnectAllDaps = async () => {
await Promise.all(sessions.map(session => disconnect(session)))
ipc.send('closed')
}
if (!address || !sessions.length) return

ipc.on('quit', disconnectAllDaps)
const [{ address: connectedAddress }] = getInformationFromSession(
sessions[0],
)

return () => {
ipc.off('quit', disconnectAllDaps)
if (connectedAddress !== address) {
Promise.all(sessions.map(session => disconnect(session)))
}
},
[sessions, disconnect],
[address],
)

return (
Expand Down
3 changes: 0 additions & 3 deletions app/containers/App/Sidebar/Logout/Logout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from 'react'
import classNames from 'classnames'
import { FormattedMessage } from 'react-intl'

import { useWalletConnectWallet } from '@cityofzion/wallet-connect-sdk-wallet-react'
import LogoutIcon from '../../../../assets/navigation/logout.svg'
import styles from './Logout.scss'

Expand All @@ -15,9 +14,7 @@ type Props = {
}

const Logout = ({ id, className, logout, promptHasBeenDisplayed }: Props) => {
const { sessions, disconnect } = useWalletConnectWallet()
const handleClick = () => {
if (sessions) Promise.all(sessions.map(session => disconnect(session)))
promptHasBeenDisplayed(false)
logout()
}
Expand Down

0 comments on commit 739dcc1

Please sign in to comment.