diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index 518d40ef1..2d19b18f0 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -414,7 +414,12 @@ const getFeatures = (instance: Instance) => { * Can display a timeline of statuses from instances selected by instance admin. * @see GET /api/v1/timelines/bubble */ - bubbleTimeline: instance.api_versions['bubble_timeline.pleroma.pl-api'] >= 1, + bubbleTimeline: any([ + instance.api_versions['bubble_timeline.pleroma.pl-api'] >= 1, + v.software === ICESHRIMP_NET, + ]), + + bubbleTimelineStreaming: v.software === ICESHRIMP_NET, /** * Pleroma chats API. diff --git a/packages/pl-fe/src/api/hooks/streaming/use-bubble-stream.ts b/packages/pl-fe/src/api/hooks/streaming/use-bubble-stream.ts new file mode 100644 index 000000000..7415abc46 --- /dev/null +++ b/packages/pl-fe/src/api/hooks/streaming/use-bubble-stream.ts @@ -0,0 +1,11 @@ +import { useTimelineStream } from './use-timeline-stream'; + +interface UseBubbleStreamOpts { + onlyMedia?: boolean; + enabled?: boolean; +} + +const useBubbleStream = ({ onlyMedia, enabled }: UseBubbleStreamOpts = {}) => + useTimelineStream(`bubble${onlyMedia ? ':media' : ''}`, {}, enabled); + +export { useBubbleStream }; diff --git a/packages/pl-fe/src/features/bubble-timeline/index.tsx b/packages/pl-fe/src/features/bubble-timeline/index.tsx index 74b63b168..e2babe414 100644 --- a/packages/pl-fe/src/features/bubble-timeline/index.tsx +++ b/packages/pl-fe/src/features/bubble-timeline/index.tsx @@ -2,6 +2,7 @@ import React, { useEffect } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { fetchBubbleTimeline } from 'pl-fe/actions/timelines'; +import { useBubbleStream } from 'pl-fe/api/hooks/streaming/use-bubble-stream'; import PullToRefresh from 'pl-fe/components/pull-to-refresh'; import Column from 'pl-fe/components/ui/column'; import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; @@ -32,6 +33,8 @@ const BubbleTimeline = () => { const handleRefresh = () => dispatch(fetchBubbleTimeline({ onlyMedia }, true)); + useBubbleStream({ onlyMedia }); + useEffect(() => { dispatch(fetchBubbleTimeline({ onlyMedia })); }, [onlyMedia]);