Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 1 addition & 17 deletions oxlint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1076,20 +1076,9 @@
"count": 2
}
},
"src/state/queries/notifications/feed.ts": {
"typescript/no-explicit-any": {
"count": 2
},
"typescript/no-floating-promises": {
"count": 1
},
"typescript/no-unsafe-member-access": {
"count": 2
}
},
"src/state/queries/notifications/unread.tsx": {
"typescript/no-floating-promises": {
"count": 4
"count": 2
},
"typescript/no-misused-promises": {
"count": 1
Expand Down Expand Up @@ -1423,11 +1412,6 @@
"count": 1
}
},
"src/view/screens/Notifications.tsx": {
"typescript/no-floating-promises": {
"count": 3
}
},
"src/view/screens/Storybook/ListContained.tsx": {
"typescript/no-unsafe-call": {
"count": 1
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/features/__tests__/isOnForBetaUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jest.mock('#/analytics/features/bootstrap', () => ({
readFeatureBootstrap: () => Promise.resolve(),
}))

const FEATURE = Features.NotificationsV2Enable
const FEATURE = Features.ModerationInboxEnable

async function setRules(
rules: {id: string; condition?: FeatureRule['condition']}[],
Expand Down
17 changes: 0 additions & 17 deletions src/analytics/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,6 @@ export function getFeatureDescription(feature: Features, i18n: I18n) {
}),
),
}
case Features.NotificationsV2Enable:
return {
key: feature,
name: i18n._(
msg({
message: 'Redesigned notifications',
comment: 'Name for a feature flag',
}),
),
description: i18n._(
msg({
message:
'Notifications sorted into tabs – people you follow, followers, replies and activity.',
comment: 'Description of a feature flag (Redesigned notifications)',
}),
),
}
case Features.ModerationInboxEnable:
return {
key: feature,
Expand Down
1 change: 0 additions & 1 deletion src/analytics/features/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export enum Features {
OnboardingInterestsRequiredEnable = 'onboarding:interests:required:enable',
ModerationInboxEnable = 'moderation_inbox:enable',
AtmosphereScreenEnable = 'atmosphere_screen:enable',
NotificationsV2Enable = 'notifications_v2:enable',

// values
StarterPacksConfig = 'starter_packs:config',
Expand Down
21 changes: 2 additions & 19 deletions src/components/StarterPack/StarterPackCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,10 @@ export function Default({
)
}

export function Notification({
starterPack,
}: {
starterPack?: bsky.starterPack.AnyStarterPackView
}) {
if (!starterPack) return null
return (
<Link starterPack={starterPack}>
<Card starterPack={starterPack} noIcon={true} noDescription={true} />
</Link>
)
}

export function Card({
starterPack,
noIcon,
noDescription,
}: {
starterPack: bsky.starterPack.AnyStarterPackView
noIcon?: boolean
noDescription?: boolean
}) {
const {record, creator, joinedAllTimeCount} = starterPack

Expand All @@ -69,7 +52,7 @@ export function Card({
return (
<View style={[a.w_full, a.gap_md]}>
<View style={[a.flex_row, a.gap_sm, a.w_full]}>
{!noIcon ? <StarterPackIcon width={40} gradient="sky" /> : null}
<StarterPackIcon width={40} gradient="sky" />
<View style={[a.flex_1]}>
<Text
emoji
Expand All @@ -87,7 +70,7 @@ export function Card({
</Text>
</View>
</View>
{!noDescription && record.description ? (
{record.description ? (
<Text emoji numberOfLines={3} style={[a.leading_snug]}>
{record.description}
</Text>
Expand Down
12 changes: 0 additions & 12 deletions src/lib/hooks/useAnimatedValue.ts

This file was deleted.

21 changes: 1 addition & 20 deletions src/lib/hooks/useNotificationHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ import {
type NavigationState,
useNavigation,
} from '@react-navigation/native'
import {useQueryClient} from '@tanstack/react-query'

import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher'
import {logger as notyLogger} from '#/lib/notifications/util'
import {getMessagesNavigationAction} from '#/lib/routes/navigation'
import {type NavigationProp} from '#/lib/routes/types'
import {emitPushNotificationOpened} from '#/state/events'
import {useCurrentConvoId} from '#/state/messages/current-convo-id'
import {RQKEY as RQKEY_NOTIFS} from '#/state/queries/notifications/feed'
import {invalidateCachedUnreadPage} from '#/state/queries/notifications/unread'
import {truncateAndInvalidate} from '#/state/queries/util'
import {useSession} from '#/state/session'
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
import {useCloseAllActiveElements} from '#/state/util'
Expand Down Expand Up @@ -115,7 +111,6 @@ export function useNotificationsHandler() {
const ax = useAnalytics()
// eslint-disable-next-line react-compiler/react-compiler
const logger = ax.logger.useChild(ax.logger.Context.Notifications)
const queryClient = useQueryClient()
const {currentAccount, accounts} = useSession()
const {onPressSwitchAccount} = useAccountSwitcher()
const navigation = useNavigation<NavigationProp>()
Expand Down Expand Up @@ -329,8 +324,6 @@ export function useNotificationsHandler() {
} satisfies Notifications.NotificationBehavior)
}

// Any notification other than a chat message should invalidate the unread page
invalidateCachedUnreadPage()
return Promise.resolve(DEFAULT_HANDLER_OPTIONS)
},
})
Expand Down Expand Up @@ -360,18 +353,7 @@ export function useNotificationsHandler() {
causedBoot: false,
})

invalidateCachedUnreadPage()
void truncateAndInvalidate(queryClient, RQKEY_NOTIFS('all'))

if (
payload.reason === 'mention' ||
payload.reason === 'quote' ||
payload.reason === 'reply'
) {
void truncateAndInvalidate(queryClient, RQKEY_NOTIFS('mentions'))
}

// Notifications v2 refreshes itself, as it decides what's seen
// The Notifications screen refreshes itself, as it decides what's seen
if (!isChatNotificationPayload(payload)) {
emitPushNotificationOpened()
}
Expand Down Expand Up @@ -419,7 +401,6 @@ export function useNotificationsHandler() {
}, [
ax,
logger,
queryClient,
currentAccount,
currentConvoId,
accounts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ import {useDisplayName} from './text'
type ProfileView = app.bsky.actor.defs.ProfileViewBasic

/**
* Each kind's name in the `notifications:bundleExpand` metric. These are the
* names the original notifications screen logs, so that expands on either
* screen can be compared.
* Each kind's name in the `notifications:bundleExpand` metric, the one the
* original notifications screen logged, so expands stay comparable.
*/
const METRIC_NOTIFICATION_TYPES: Record<
GroupNotificationView['type'],
Expand Down
50 changes: 8 additions & 42 deletions src/screens/Notifications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {Trans, useLingui} from '@lingui/react/macro'
import {useFocusEffect, useNavigation} from '@react-navigation/native'
import {useQueryClient} from '@tanstack/react-query'

import {HITSLOP_10} from '#/lib/constants'
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
import {useOpenComposer} from '#/lib/hooks/useOpenComposer'
import {
Expand All @@ -38,7 +37,6 @@ import {
HomeHeaderModeProvider,
useHomeHeaderMode,
} from '#/view/com/util/MainScrollProvider'
import {NotificationsScreen as LegacyNotificationsScreen} from '#/view/screens/Notifications'
import {PageList} from '#/screens/Notifications/components/PageList'
import * as Pager from '#/screens/Notifications/components/PagerView'
import {TabPills} from '#/screens/Notifications/components/TabPills'
Expand All @@ -53,7 +51,6 @@ import {
nextSeenAt,
} from '#/screens/Notifications/unread'
import {atoms as a, useBreakpoints, useTheme, utils} from '#/alf'
import {BetaTag} from '#/components/BetaTag'
import {ButtonIcon} from '#/components/Button'
import {useHeaderOffset} from '#/components/hooks/useHeaderOffset'
import {EditBig_Stroke2_Corner2_Rounded as EditBigIcon} from '#/components/icons/EditBig'
Expand All @@ -62,36 +59,22 @@ import * as Layout from '#/components/Layout'
import {Link} from '#/components/Link'
import {Loader} from '#/components/Loader'
import {type Metrics, useAnalytics} from '#/analytics'
import {Features, isOnForBetaUser} from '#/analytics/features'
import {IS_INTERNAL, IS_NATIVE, IS_WEB} from '#/env'
import {IS_NATIVE, IS_WEB} from '#/env'

type Props = NativeStackScreenProps<
NotificationsTabNavigatorParams,
'Notifications'
>

export function NotificationsScreen(props: Props) {
const ax = useAnalytics()
// Dev and TestFlight builds always get it, so it's dogfooded before rollout
const isNewNotificationsEnabled =
IS_INTERNAL || ax.features.enabled(ax.features.NotificationsV2Enable)

if (isNewNotificationsEnabled) {
return <NewNotificationsScreen {...props} />
}

return <LegacyNotificationsScreen {...props} />
}

export function NewNotificationsScreen({}: Props) {
export function NotificationsScreen({}: Props) {
const {t: l} = useLingui()
const t = useTheme()
const {openComposer} = useOpenComposer()

return (
<Layout.Screen testID="newNotificationsScreen" noInsetTop={IS_NATIVE}>
<Layout.Screen testID="notificationsScreen" noInsetTop={IS_NATIVE}>
<HomeHeaderModeProvider>
<NewNotificationsScreenInner />
<NotificationsScreenInner />
</HomeHeaderModeProvider>
<FAB
testID="composeFAB"
Expand All @@ -105,7 +88,7 @@ export function NewNotificationsScreen({}: Props) {
)
}

function NewNotificationsScreenInner() {
function NotificationsScreenInner() {
const {t: l} = useLingui()
const ax = useAnalytics()
const navigation = useNavigation()
Expand Down Expand Up @@ -657,26 +640,9 @@ function NotificationsHeader({
<Layout.Header.Outer noBottomBorder sticky={false}>
<Layout.Header.MenuButton />
<Layout.Header.Content>
<View style={[a.flex_row, a.align_center, a.gap_sm]}>
<Layout.Header.TitleText>
<Trans>Notifications</Trans>
</Layout.Header.TitleText>
{
/*
* Only for those who have it because they opted in to beta
* features, not internal builds or a wider rollout
*/
isOnForBetaUser(Features.NotificationsV2Enable) && (
<Link
to={{screen: 'BetaFeaturesSettings'}}
label={l`Beta features`}
accessibilityHint={l`Opens your beta features settings`}
hitSlop={HITSLOP_10}>
<BetaTag />
</Link>
)
}
</View>
<Layout.Header.TitleText>
<Trans>Notifications</Trans>
</Layout.Header.TitleText>
</Layout.Header.Content>
<Layout.Header.Slot>
<Link
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Notifications/rowBorders.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Whether Notifications v2 draws hairline borders between rows, under the
* Whether Notifications draws hairline borders between rows, under the
* section headers and above the loading footer, on every platform. This is a
* static flag while the design settles: set it to `false` to go back to rows
* without borders.
Expand Down
6 changes: 1 addition & 5 deletions src/state/cache/post-shadow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {EventEmitter} from 'eventemitter3'
import {batchedUpdates} from '#/lib/batchedUpdates'
import {findAllPostsInQueryData as findAllPostsInBookmarksQueryData} from '#/state/queries/bookmarks/useBookmarksQuery'
import {findAllPostsInQueryData as findAllPostsInExploreFeedPreviewsQueryData} from '#/state/queries/explore-feed-previews'
import {findAllPostsInQueryData as findAllPostsInNotifsQueryData} from '#/state/queries/notifications/feed'
import {findAllPostsInQueryData as findAllPostsInGroupedNotifsQueryData} from '#/state/queries/notifications/grouped'
import {findAllPostsInQueryData as findAllPostsInNotifsQueryData} from '#/state/queries/notifications/grouped'
import {findAllPostsInQueryData as findAllPostsInFeedQueryData} from '#/state/queries/post-feed'
import {findAllPostsInQueryData as findAllPostsInQuoteQueryData} from '#/state/queries/post-quotes'
import {findAllPostsInQueryData as findAllPostsInSearchQueryData} from '#/state/queries/search-posts-v2'
Expand Down Expand Up @@ -192,9 +191,6 @@ function* findPostsInCache(
for (let post of findAllPostsInNotifsQueryData(queryClient, uri)) {
yield post
}
for (let post of findAllPostsInGroupedNotifsQueryData(queryClient, uri)) {
yield post
}
for (let post of findAllPostsInThreadV2QueryData(queryClient, uri)) {
yield post
}
Expand Down
4 changes: 1 addition & 3 deletions src/state/cache/profile-shadow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import {findAllProfilesInQueryData as findAllProfilesInListConvosQueryData} from
import {findAllProfilesInQueryData as findAllProfilesInMessagesQueryData} from '#/state/queries/messages/list-convo-members'
import {findAllProfilesInQueryData as findAllProfilesInMyBlockedAccountsQueryData} from '#/state/queries/my-blocked-accounts'
import {findAllProfilesInQueryData as findAllProfilesInMyMutedAccountsQueryData} from '#/state/queries/my-muted-accounts'
import {findAllProfilesInQueryData as findAllProfilesInNotifsQueryData} from '#/state/queries/notifications/feed'
import {findAllProfilesInQueryData as findAllProfilesInGroupedNotifsQueryData} from '#/state/queries/notifications/grouped'
import {findAllProfilesInQueryData as findAllProfilesInNotifsQueryData} from '#/state/queries/notifications/grouped'
import {
type FeedPage,
findAllProfilesInQueryData as findAllProfilesInFeedsQueryData,
Expand Down Expand Up @@ -334,7 +333,6 @@ function* findProfilesInCache(
yield* findAllProfilesInExploreFeedPreviewsQueryData(queryClient, did)
yield* findAllProfilesInActivitySubscriptionsQueryData(queryClient, did)
yield* findAllProfilesInNotifsQueryData(queryClient, did)
yield* findAllProfilesInGroupedNotifsQueryData(queryClient, did)
yield* findAllProfilesInContactMatchesQueryData(queryClient, did)
yield* findAllProfilesInMessagesQueryData(queryClient, did)
yield* findAllProfilesInGetConvoQueryData(queryClient, did)
Expand Down
Loading
Loading