Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljscript committed Jan 6, 2025
1 parent aa148ec commit f426793
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {NotificationPopup} from './common/NotificationPopup'
import {NotificationStack} from './common/NotificationStack'

const displayLimit = 3
const displayTime = 20 * 1000

export const NotificationUIHandler = () => {
const enabled = useNotificationDisplaySettings()
Expand All @@ -34,8 +35,6 @@ export const NotificationUIHandler = () => {
)
}

const notificationDisplayTime = 20 * 1000

const useCollectNewNotifications = ({enabled}: {enabled: boolean}) => {
const manager = useNotificationManager()
const walletManager = useWalletManager()
Expand All @@ -46,7 +45,7 @@ const useCollectNewNotifications = ({enabled}: {enabled: boolean}) => {
if (!enabled) return
const pushEvent = (event: Notifications.Event) => {
setEvents((e) => [...e, event])
setTimeout(() => setEvents((e) => e.filter((ev) => ev.id !== event.id)), notificationDisplayTime)
setTimeout(() => setEvents((e) => e.filter((ev) => ev.id !== event.id)), displayTime)
}

const subscription = manager.newEvents$.subscribe((event) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {Text} from '../../../components/Text'
import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider'
import {notificationManager} from './common/notification-manager'
import {createTransactionReceivedNotification} from './common/transaction-received-notification'
import {NotificationUIHandler} from './NotificationUIHandler'

export const NotificationsDevScreen = () => {
return (
Expand Down Expand Up @@ -47,8 +46,6 @@ const Screen = () => {

return (
<SafeAreaView edges={['bottom', 'top', 'left', 'right']}>
<NotificationUIHandler />

<ScrollView>
<View style={{padding: 16, gap: 8}}>
<Text style={{fontSize: 24}}>Notifications Playground</Text>
Expand Down

0 comments on commit f426793

Please sign in to comment.