diff options
Diffstat (limited to 'src/state/queries/notifications')
-rw-r--r-- | src/state/queries/notifications/feed.ts | 18 | ||||
-rw-r--r-- | src/state/queries/notifications/types.ts | 2 | ||||
-rw-r--r-- | src/state/queries/notifications/unread.tsx | 20 | ||||
-rw-r--r-- | src/state/queries/notifications/util.ts | 18 |
4 files changed, 32 insertions, 26 deletions
diff --git a/src/state/queries/notifications/feed.ts b/src/state/queries/notifications/feed.ts index 405d054d4..dbc23fcbd 100644 --- a/src/state/queries/notifications/feed.ts +++ b/src/state/queries/notifications/feed.ts @@ -16,24 +16,26 @@ * 3. Don't call this query's `refetch()` if you're trying to sync latest; call `checkUnread()` instead. */ -import {useEffect, useRef} from 'react' import {AppBskyFeedDefs} from '@atproto/api' import { - useInfiniteQuery, InfiniteData, + QueryClient, QueryKey, + useInfiniteQuery, useQueryClient, - QueryClient, } from '@tanstack/react-query' -import {useModerationOpts} from '../preferences' -import {useUnreadNotificationsApi} from './unread' -import {fetchPage} from './util' -import {FeedPage} from './types' +import {useEffect, useRef} from 'react' + import {useMutedThreads} from '#/state/muted-threads' + import {STALE} from '..' +import {useModerationOpts} from '../preferences' import {embedViewRecordToPostView, getEmbeddedPost} from '../util' +import {FeedPage} from './types' +import {useUnreadNotificationsApi} from './unread' +import {fetchPage} from './util' -export type {NotificationType, FeedNotification, FeedPage} from './types' +export type {FeedNotification, FeedPage, NotificationType} from './types' const PAGE_SIZE = 30 diff --git a/src/state/queries/notifications/types.ts b/src/state/queries/notifications/types.ts index 812236cf0..db1cf878f 100644 --- a/src/state/queries/notifications/types.ts +++ b/src/state/queries/notifications/types.ts @@ -1,6 +1,6 @@ import { - AppBskyNotificationListNotifications, AppBskyFeedDefs, + AppBskyNotificationListNotifications, } from '@atproto/api' export type NotificationType = diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx index e7a0631ec..2f55872eb 100644 --- a/src/state/queries/notifications/unread.tsx +++ b/src/state/queries/notifications/unread.tsx @@ -2,20 +2,22 @@ * A kind of companion API to ./feed.ts. See that file for more info. */ -import React from 'react' -import * as Notifications from 'expo-notifications' import {useQueryClient} from '@tanstack/react-query' +import * as Notifications from 'expo-notifications' +import React from 'react' +import {AppState} from 'react-native' + import BroadcastChannel from '#/lib/broadcast' -import {useSession, getAgent} from '#/state/session' -import {useModerationOpts} from '../preferences' -import {fetchPage} from './util' -import {CachedFeedPage, FeedPage} from './types' +import {logger} from '#/logger' import {isNative} from '#/platform/detection' import {useMutedThreads} from '#/state/muted-threads' -import {RQKEY as RQKEY_NOTIFS} from './feed' -import {logger} from '#/logger' +import {getAgent, useSession} from '#/state/session' + +import {useModerationOpts} from '../preferences' import {truncateAndInvalidate} from '../util' -import {AppState} from 'react-native' +import {RQKEY as RQKEY_NOTIFS} from './feed' +import {CachedFeedPage, FeedPage} from './types' +import {fetchPage} from './util' const UPDATE_INTERVAL = 30 * 1e3 // 30sec diff --git a/src/state/queries/notifications/util.ts b/src/state/queries/notifications/util.ts index 626d3e911..f019c8966 100644 --- a/src/state/queries/notifications/util.ts +++ b/src/state/queries/notifications/util.ts @@ -1,19 +1,21 @@ import { - AppBskyNotificationListNotifications, - ModerationOpts, - moderateProfile, + AppBskyEmbedRecord, AppBskyFeedDefs, + AppBskyFeedLike, AppBskyFeedPost, AppBskyFeedRepost, - AppBskyFeedLike, - AppBskyEmbedRecord, + AppBskyNotificationListNotifications, + moderateProfile, + ModerationOpts, } from '@atproto/api' -import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped' -import chunk from 'lodash.chunk' import {QueryClient} from '@tanstack/react-query' +import chunk from 'lodash.chunk' + +import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped' + import {getAgent} from '../../session' import {precacheProfile} from '../profile' -import {NotificationType, FeedNotification, FeedPage} from './types' +import {FeedNotification, FeedPage, NotificationType} from './types' const GROUPABLE_REASONS = ['like', 'repost', 'follow'] const MS_1HR = 1e3 * 60 * 60 |