mirror of
https://github.com/tooot-app/app
synced 2025-04-15 10:47:46 +02:00
MVP last read position
This commit is contained in:
parent
0b4a8ead84
commit
9a41dd2191
@ -25,7 +25,7 @@ import { addScreenshotListener } from 'expo-screen-capture'
|
|||||||
import React, { useCallback, useEffect, useRef } from 'react'
|
import React, { useCallback, useEffect, useRef } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Alert, Platform, StatusBar } from 'react-native'
|
import { Alert, Platform, StatusBar } from 'react-native'
|
||||||
import { onlineManager, useQueryClient } from 'react-query'
|
import { useQueryClient } from 'react-query'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import * as Sentry from 'sentry-expo'
|
import * as Sentry from 'sentry-expo'
|
||||||
|
|
||||||
@ -51,11 +51,9 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
switch (isConnected) {
|
switch (isConnected) {
|
||||||
case true:
|
case true:
|
||||||
onlineManager.setOnline(isConnected)
|
|
||||||
removeMessage()
|
removeMessage()
|
||||||
break
|
break
|
||||||
case false:
|
case false:
|
||||||
onlineManager.setOnline(isConnected)
|
|
||||||
displayMessage({
|
displayMessage({
|
||||||
mode,
|
mode,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import ComponentSeparator from '@components/Separator'
|
import ComponentSeparator from '@components/Separator'
|
||||||
import { useScrollToTop } from '@react-navigation/native'
|
import { useScrollToTop } from '@react-navigation/native'
|
||||||
import { QueryKeyTimeline, useTimelineQuery } from '@utils/queryHooks/timeline'
|
import { QueryKeyTimeline, useTimelineQuery } from '@utils/queryHooks/timeline'
|
||||||
import { getInstanceActive } from '@utils/slices/instancesSlice'
|
import {
|
||||||
|
getInstanceActive,
|
||||||
|
updateInstanceTimelineLookback
|
||||||
|
} from '@utils/slices/instancesSlice'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { RefObject, useCallback, useRef } from 'react'
|
import React, { RefObject, useCallback, useRef } from 'react'
|
||||||
@ -10,13 +13,14 @@ import {
|
|||||||
FlatListProps,
|
FlatListProps,
|
||||||
Platform,
|
Platform,
|
||||||
RefreshControl,
|
RefreshControl,
|
||||||
StyleSheet
|
StyleSheet,
|
||||||
|
ViewabilityConfigCallbackPairs
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import Animated, {
|
import Animated, {
|
||||||
useAnimatedScrollHandler,
|
useAnimatedScrollHandler,
|
||||||
useSharedValue
|
useSharedValue
|
||||||
} from 'react-native-reanimated'
|
} from 'react-native-reanimated'
|
||||||
import { useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import TimelineEmpty from './Timeline/Empty'
|
import TimelineEmpty from './Timeline/Empty'
|
||||||
import TimelineFooter from './Timeline/Footer'
|
import TimelineFooter from './Timeline/Footer'
|
||||||
import TimelineRefresh, {
|
import TimelineRefresh, {
|
||||||
@ -31,6 +35,7 @@ export interface Props {
|
|||||||
queryKey: QueryKeyTimeline
|
queryKey: QueryKeyTimeline
|
||||||
disableRefresh?: boolean
|
disableRefresh?: boolean
|
||||||
disableInfinity?: boolean
|
disableInfinity?: boolean
|
||||||
|
lookback?: Extract<App.Pages, 'Following' | 'Local' | 'LocalPublic'>
|
||||||
customProps: Partial<FlatListProps<any>> &
|
customProps: Partial<FlatListProps<any>> &
|
||||||
Pick<FlatListProps<any>, 'renderItem'>
|
Pick<FlatListProps<any>, 'renderItem'>
|
||||||
}
|
}
|
||||||
@ -40,6 +45,7 @@ const Timeline: React.FC<Props> = ({
|
|||||||
queryKey,
|
queryKey,
|
||||||
disableRefresh = false,
|
disableRefresh = false,
|
||||||
disableInfinity = false,
|
disableInfinity = false,
|
||||||
|
lookback,
|
||||||
customProps
|
customProps
|
||||||
}) => {
|
}) => {
|
||||||
// Switching account update timeline
|
// Switching account update timeline
|
||||||
@ -124,6 +130,27 @@ const Timeline: React.FC<Props> = ({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const dispatch = useDispatch()
|
||||||
|
const viewabilityPairs = useRef<ViewabilityConfigCallbackPairs>([
|
||||||
|
{
|
||||||
|
viewabilityConfig: {
|
||||||
|
minimumViewTime: 10,
|
||||||
|
viewAreaCoveragePercentThreshold: 10
|
||||||
|
},
|
||||||
|
onViewableItemsChanged: ({ viewableItems }) => {
|
||||||
|
lookback &&
|
||||||
|
dispatch(
|
||||||
|
updateInstanceTimelineLookback({
|
||||||
|
[lookback]: {
|
||||||
|
queryKey,
|
||||||
|
ids: viewableItems.map(item => item.key).slice(0, 3)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
useScrollToTop(flRef)
|
useScrollToTop(flRef)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -157,6 +184,9 @@ const Timeline: React.FC<Props> = ({
|
|||||||
maintainVisibleContentPosition={{
|
maintainVisibleContentPosition={{
|
||||||
minIndexForVisible: 0
|
minIndexForVisible: 0
|
||||||
}}
|
}}
|
||||||
|
{...(lookback && {
|
||||||
|
viewabilityConfigCallbackPairs: viewabilityPairs.current
|
||||||
|
})}
|
||||||
{...androidRefreshControl}
|
{...androidRefreshControl}
|
||||||
{...customProps}
|
{...customProps}
|
||||||
/>
|
/>
|
||||||
|
37
src/components/Timeline/Lookback.tsx
Normal file
37
src/components/Timeline/Lookback.tsx
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
|
import React from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { StyleSheet, Text, View } from 'react-native'
|
||||||
|
|
||||||
|
const TimelineLookback = React.memo(
|
||||||
|
() => {
|
||||||
|
const { t } = useTranslation('componentTimeline')
|
||||||
|
const { theme } = useTheme()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={[styles.base, { backgroundColor: theme.backgroundDefault }]}>
|
||||||
|
<Text
|
||||||
|
style={[StyleConstants.FontStyle.S, { color: theme.primaryDefault }]}
|
||||||
|
>
|
||||||
|
{t('lookback.message')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
() => true
|
||||||
|
)
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
base: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'center',
|
||||||
|
padding: StyleConstants.Spacing.S
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
...StyleConstants.FontStyle.S
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default TimelineLookback
|
@ -60,11 +60,9 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
|
|
||||||
const appState = useRef(AppState.currentState)
|
const appState = useRef(AppState.currentState)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
AppState.addEventListener('change', _handleAppStateChange)
|
const appState = AppState.addEventListener('change', _handleAppStateChange)
|
||||||
|
|
||||||
return () => {
|
return () => appState.remove()
|
||||||
AppState.removeEventListener('change', _handleAppStateChange)
|
|
||||||
}
|
|
||||||
}, [])
|
}, [])
|
||||||
const _handleAppStateChange = async (nextAppState: AppStateStatus) => {
|
const _handleAppStateChange = async (nextAppState: AppStateStatus) => {
|
||||||
if (appState.current.match(/active/) && nextAppState.match(/inactive/)) {
|
if (appState.current.match(/active/) && nextAppState.match(/inactive/)) {
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
"end": {
|
"end": {
|
||||||
"message": "The end, what about a cup of <0 />"
|
"message": "The end, what about a cup of <0 />"
|
||||||
},
|
},
|
||||||
|
"lookback": {
|
||||||
|
"message": "Last read at"
|
||||||
|
},
|
||||||
"refresh": {
|
"refresh": {
|
||||||
"fetchPreviousPage": "Newer from here",
|
"fetchPreviousPage": "Newer from here",
|
||||||
"refetch": "To latest"
|
"refetch": "To latest"
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
"end": {
|
"end": {
|
||||||
"message": "居然刷到底了,喝杯 <0 /> 吧"
|
"message": "居然刷到底了,喝杯 <0 /> 吧"
|
||||||
},
|
},
|
||||||
|
"lookback": {
|
||||||
|
"message": "上次阅读至"
|
||||||
|
},
|
||||||
"refresh": {
|
"refresh": {
|
||||||
"fetchPreviousPage": "较新于此的嘟嘟",
|
"fetchPreviousPage": "较新于此的嘟嘟",
|
||||||
"refetch": "最新的嘟嘟"
|
"refetch": "最新的嘟嘟"
|
||||||
|
@ -1,16 +1,21 @@
|
|||||||
import analytics from '@components/analytics'
|
import analytics from '@components/analytics'
|
||||||
import { HeaderCenter, HeaderRight } from '@components/Header'
|
import { HeaderCenter, HeaderRight } from '@components/Header'
|
||||||
|
import ComponentSeparator from '@components/Separator'
|
||||||
import Timeline from '@components/Timeline'
|
import Timeline from '@components/Timeline'
|
||||||
import TimelineDefault from '@components/Timeline/Default'
|
import TimelineDefault from '@components/Timeline/Default'
|
||||||
|
import TimelineLookback from '@components/Timeline/Lookback'
|
||||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
||||||
import {
|
import {
|
||||||
ScreenTabsScreenProps,
|
ScreenTabsScreenProps,
|
||||||
TabLocalStackParamList
|
TabLocalStackParamList
|
||||||
} from '@utils/navigation/navigators'
|
} from '@utils/navigation/navigators'
|
||||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||||
|
import { getInstanceTimelinesLookback } from '@utils/slices/instancesSlice'
|
||||||
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import React, { useCallback, useMemo } from 'react'
|
import React, { useCallback, useMemo } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Platform } from 'react-native'
|
import { Platform } from 'react-native'
|
||||||
|
import { useSelector } from 'react-redux'
|
||||||
import TabSharedRoot from './Shared/Root'
|
import TabSharedRoot from './Shared/Root'
|
||||||
|
|
||||||
const Stack = createNativeStackNavigator<TabLocalStackParamList>()
|
const Stack = createNativeStackNavigator<TabLocalStackParamList>()
|
||||||
@ -43,13 +48,35 @@ const TabLocal = React.memo(
|
|||||||
[i18n.language]
|
[i18n.language]
|
||||||
)
|
)
|
||||||
|
|
||||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Following' }]
|
const timelinesLookback = useSelector(
|
||||||
const renderItem = useCallback(
|
getInstanceTimelinesLookback,
|
||||||
({ item }) => <TimelineDefault item={item} queryKey={queryKey} />,
|
() => true
|
||||||
[]
|
|
||||||
)
|
)
|
||||||
|
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Following' }]
|
||||||
|
const renderItem = useCallback(({ item }) => {
|
||||||
|
if (timelinesLookback?.['Following']?.ids?.[0] === item.id) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TimelineLookback />
|
||||||
|
<ComponentSeparator
|
||||||
|
extraMarginLeft={
|
||||||
|
StyleConstants.Avatar.M + StyleConstants.Spacing.S
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<TimelineDefault item={item} queryKey={queryKey} />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return <TimelineDefault item={item} queryKey={queryKey} />
|
||||||
|
}, [])
|
||||||
const children = useCallback(
|
const children = useCallback(
|
||||||
() => <Timeline queryKey={queryKey} customProps={{ renderItem }} />,
|
() => (
|
||||||
|
<Timeline
|
||||||
|
queryKey={queryKey}
|
||||||
|
lookback='Following'
|
||||||
|
customProps={{ renderItem }}
|
||||||
|
/>
|
||||||
|
),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2,7 +2,10 @@ import { MenuContainer, MenuRow } from '@components/Menu'
|
|||||||
import { useNavigation } from '@react-navigation/native'
|
import { useNavigation } from '@react-navigation/native'
|
||||||
import { useAnnouncementQuery } from '@utils/queryHooks/announcement'
|
import { useAnnouncementQuery } from '@utils/queryHooks/announcement'
|
||||||
import { useListsQuery } from '@utils/queryHooks/lists'
|
import { useListsQuery } from '@utils/queryHooks/lists'
|
||||||
import { getMePage, updateContextMePage } from '@utils/slices/contextsSlice'
|
import {
|
||||||
|
getInstanceMePage,
|
||||||
|
updateInstanceMePage
|
||||||
|
} from '@utils/slices/instancesSlice'
|
||||||
import { getInstancePush } from '@utils/slices/instancesSlice'
|
import { getInstancePush } from '@utils/slices/instancesSlice'
|
||||||
import React, { useEffect } from 'react'
|
import React, { useEffect } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
@ -13,10 +16,7 @@ const Collections: React.FC = () => {
|
|||||||
const navigation = useNavigation<any>()
|
const navigation = useNavigation<any>()
|
||||||
|
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const mePage = useSelector(
|
const mePage = useSelector(getInstanceMePage)
|
||||||
getMePage,
|
|
||||||
(a, b) => a.announcements.unread === b.announcements.unread
|
|
||||||
)
|
|
||||||
|
|
||||||
const listsQuery = useListsQuery({
|
const listsQuery = useListsQuery({
|
||||||
options: {
|
options: {
|
||||||
@ -26,7 +26,7 @@ const Collections: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (listsQuery.isSuccess) {
|
if (listsQuery.isSuccess) {
|
||||||
dispatch(
|
dispatch(
|
||||||
updateContextMePage({
|
updateInstanceMePage({
|
||||||
lists: { shown: listsQuery.data?.length ? true : false }
|
lists: { shown: listsQuery.data?.length ? true : false }
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@ -42,7 +42,7 @@ const Collections: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (announcementsQuery.isSuccess) {
|
if (announcementsQuery.isSuccess) {
|
||||||
dispatch(
|
dispatch(
|
||||||
updateContextMePage({
|
updateInstanceMePage({
|
||||||
announcements: {
|
announcements: {
|
||||||
shown: announcementsQuery.data?.length ? true : false,
|
shown: announcementsQuery.data?.length ? true : false,
|
||||||
unread: announcementsQuery.data.filter(
|
unread: announcementsQuery.data.filter(
|
||||||
|
@ -7,7 +7,7 @@ import { getInstanceActive, getInstances } from '@utils/slices/instancesSlice'
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Text } from 'react-native'
|
import { DevSettings, Text } from 'react-native'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
|
|
||||||
const SettingsDev: React.FC = () => {
|
const SettingsDev: React.FC = () => {
|
||||||
@ -68,7 +68,9 @@ const SettingsDev: React.FC = () => {
|
|||||||
marginBottom: StyleConstants.Spacing.Global.PagePadding
|
marginBottom: StyleConstants.Spacing.Global.PagePadding
|
||||||
}}
|
}}
|
||||||
destructive
|
destructive
|
||||||
onPress={() => persistor.purge()}
|
onPress={() => {
|
||||||
|
persistor.purge().then(() => DevSettings.reload())
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
type='text'
|
type='text'
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import analytics from '@components/analytics'
|
import analytics from '@components/analytics'
|
||||||
import { HeaderRight } from '@components/Header'
|
import { HeaderRight } from '@components/Header'
|
||||||
|
import ComponentSeparator from '@components/Separator'
|
||||||
import Timeline from '@components/Timeline'
|
import Timeline from '@components/Timeline'
|
||||||
import TimelineDefault from '@components/Timeline/Default'
|
import TimelineDefault from '@components/Timeline/Default'
|
||||||
|
import TimelineLookback from '@components/Timeline/Lookback'
|
||||||
import SegmentedControl from '@react-native-community/segmented-control'
|
import SegmentedControl from '@react-native-community/segmented-control'
|
||||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
||||||
import {
|
import {
|
||||||
@ -9,11 +11,14 @@ import {
|
|||||||
TabPublicStackParamList
|
TabPublicStackParamList
|
||||||
} from '@utils/navigation/navigators'
|
} from '@utils/navigation/navigators'
|
||||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||||
|
import { getInstanceTimelinesLookback } from '@utils/slices/instancesSlice'
|
||||||
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useCallback, useMemo, useState } from 'react'
|
import React, { useCallback, useMemo, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Dimensions, StyleSheet } from 'react-native'
|
import { Dimensions, StyleSheet } from 'react-native'
|
||||||
import { TabView } from 'react-native-tab-view'
|
import { TabView } from 'react-native-tab-view'
|
||||||
|
import { useSelector } from 'react-redux'
|
||||||
import TabSharedRoot from './Shared/Root'
|
import TabSharedRoot from './Shared/Root'
|
||||||
|
|
||||||
const Stack = createNativeStackNavigator<TabPublicStackParamList>()
|
const Stack = createNativeStackNavigator<TabPublicStackParamList>()
|
||||||
@ -26,7 +31,7 @@ const TabPublic = React.memo(
|
|||||||
const [segment, setSegment] = useState(0)
|
const [segment, setSegment] = useState(0)
|
||||||
const pages: {
|
const pages: {
|
||||||
title: string
|
title: string
|
||||||
key: App.Pages
|
key: Extract<App.Pages, 'Local' | 'LocalPublic'>
|
||||||
}[] = [
|
}[] = [
|
||||||
{
|
{
|
||||||
title: t('tabs.public.segments.left'),
|
title: t('tabs.public.segments.left'),
|
||||||
@ -70,19 +75,42 @@ const TabPublic = React.memo(
|
|||||||
|
|
||||||
const routes = pages.map(p => ({ key: p.key }))
|
const routes = pages.map(p => ({ key: p.key }))
|
||||||
|
|
||||||
|
const timelinesLookback = useSelector(
|
||||||
|
getInstanceTimelinesLookback,
|
||||||
|
() => true
|
||||||
|
)
|
||||||
const renderScene = useCallback(
|
const renderScene = useCallback(
|
||||||
({
|
({
|
||||||
route: { key: page }
|
route: { key: page }
|
||||||
}: {
|
}: {
|
||||||
route: {
|
route: {
|
||||||
key: App.Pages
|
key: Extract<App.Pages, 'Local' | 'LocalPublic'>
|
||||||
}
|
}
|
||||||
}) => {
|
}) => {
|
||||||
const queryKey: QueryKeyTimeline = ['Timeline', { page }]
|
const queryKey: QueryKeyTimeline = ['Timeline', { page }]
|
||||||
const renderItem = ({ item }: any) => (
|
const renderItem = ({ item }: any) => {
|
||||||
<TimelineDefault item={item} queryKey={queryKey} />
|
if (timelinesLookback?.[page]?.ids?.[0] === item.id) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TimelineLookback />
|
||||||
|
<ComponentSeparator
|
||||||
|
extraMarginLeft={
|
||||||
|
StyleConstants.Avatar.M + StyleConstants.Spacing.S
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<TimelineDefault item={item} queryKey={queryKey} />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return <TimelineDefault item={item} queryKey={queryKey} />
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Timeline
|
||||||
|
queryKey={queryKey}
|
||||||
|
lookback={page}
|
||||||
|
customProps={{ renderItem }}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
return <Timeline queryKey={queryKey} customProps={{ renderItem }} />
|
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
@ -1,63 +1,115 @@
|
|||||||
import apiInstance from '@api/instance'
|
import apiInstance from '@api/instance'
|
||||||
import NetInfo from '@react-native-community/netinfo'
|
import NetInfo from '@react-native-community/netinfo'
|
||||||
import { store } from '@root/store'
|
import { store } from '@root/store'
|
||||||
|
import { prefetchTimelineQuery } from '@utils/queryHooks/timeline'
|
||||||
|
import { getPreviousTab } from '@utils/slices/contextsSlice'
|
||||||
import removeInstance from '@utils/slices/instances/remove'
|
import removeInstance from '@utils/slices/instances/remove'
|
||||||
import {
|
import {
|
||||||
getInstance,
|
getInstance,
|
||||||
updateInstanceAccount
|
updateInstanceAccount
|
||||||
} from '@utils/slices/instancesSlice'
|
} from '@utils/slices/instancesSlice'
|
||||||
|
import { onlineManager } from 'react-query'
|
||||||
import log from './log'
|
import log from './log'
|
||||||
|
|
||||||
const netInfo = async (): Promise<{
|
const netInfo = async (): Promise<{
|
||||||
connected: boolean
|
connected?: boolean
|
||||||
corrupted?: string
|
corrupted?: string
|
||||||
}> => {
|
} | void> => {
|
||||||
log('log', 'netInfo', 'initializing')
|
log('log', 'netInfo', 'initializing')
|
||||||
|
|
||||||
const netInfo = await NetInfo.fetch()
|
const netInfo = await NetInfo.fetch()
|
||||||
const instance = getInstance(store.getState())
|
const instance = getInstance(store.getState())
|
||||||
|
|
||||||
|
onlineManager.setEventListener(setOnline => {
|
||||||
|
return NetInfo.addEventListener(state => {
|
||||||
|
setOnline(
|
||||||
|
typeof state.isConnected === 'boolean' ? state.isConnected : undefined
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
if (netInfo.isConnected) {
|
if (netInfo.isConnected) {
|
||||||
log('log', 'netInfo', 'network connected')
|
log('log', 'netInfo', 'network connected')
|
||||||
if (instance) {
|
if (instance) {
|
||||||
log('log', 'netInfo', 'checking locally stored credentials')
|
log('log', 'netInfo', 'checking locally stored credentials')
|
||||||
return apiInstance<Mastodon.Account>({
|
|
||||||
method: 'get',
|
let resVerify: Mastodon.Account
|
||||||
url: `accounts/verify_credentials`
|
try {
|
||||||
})
|
resVerify = await apiInstance<Mastodon.Account>({
|
||||||
.then(res => {
|
method: 'get',
|
||||||
log('log', 'netInfo', 'local credential check passed')
|
url: `accounts/verify_credentials`
|
||||||
if (res.body.id !== instance.account.id) {
|
}).then(res => res.body)
|
||||||
log('error', 'netInfo', 'local id does not match remote id')
|
} catch (error: any) {
|
||||||
store.dispatch(removeInstance(instance))
|
log('error', 'netInfo', 'local credential check failed')
|
||||||
return Promise.resolve({ connected: true, corruputed: '' })
|
if (error.status && error.status == 401) {
|
||||||
} else {
|
store.dispatch(removeInstance(instance))
|
||||||
store.dispatch(
|
}
|
||||||
updateInstanceAccount({
|
return Promise.resolve({ corrupted: error.data.error })
|
||||||
acct: res.body.acct,
|
}
|
||||||
avatarStatic: res.body.avatar_static
|
|
||||||
})
|
log('log', 'netInfo', 'local credential check passed')
|
||||||
)
|
if (resVerify.id !== instance.account.id) {
|
||||||
return Promise.resolve({ connected: true })
|
log('error', 'netInfo', 'local id does not match remote id')
|
||||||
}
|
store.dispatch(removeInstance(instance))
|
||||||
})
|
return Promise.resolve({ connected: true, corruputed: '' })
|
||||||
.catch(error => {
|
} else {
|
||||||
log('error', 'netInfo', 'local credential check failed')
|
store.dispatch(
|
||||||
if (error.status && error.status == 401) {
|
updateInstanceAccount({
|
||||||
store.dispatch(removeInstance(instance))
|
acct: resVerify.acct,
|
||||||
}
|
avatarStatic: resVerify.avatar_static
|
||||||
return Promise.resolve({
|
|
||||||
connected: true,
|
|
||||||
corrupted: error.data.error
|
|
||||||
})
|
})
|
||||||
})
|
)
|
||||||
|
|
||||||
|
if (instance.timelinesLookback) {
|
||||||
|
const previousTab = getPreviousTab(store.getState())
|
||||||
|
let loadPage: Extract<
|
||||||
|
App.Pages,
|
||||||
|
'Following' | 'Local' | 'LocalPublic'
|
||||||
|
> | void = undefined
|
||||||
|
if (previousTab === 'Tab-Local') {
|
||||||
|
loadPage = 'Following'
|
||||||
|
} else if (previousTab === 'Tab-Public') {
|
||||||
|
loadPage = 'LocalPublic'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loadPage) {
|
||||||
|
if (instance.timelinesLookback?.[loadPage]?.ids.length > 0) {
|
||||||
|
log(
|
||||||
|
'log',
|
||||||
|
'netInfo',
|
||||||
|
`prefetching landing page ${instance.timelinesLookback[loadPage].queryKey[1].page} ids: ${instance.timelinesLookback[loadPage].ids}`
|
||||||
|
)
|
||||||
|
const prefetch = await prefetchTimelineQuery(
|
||||||
|
instance.timelinesLookback[loadPage]
|
||||||
|
)
|
||||||
|
if (prefetch) {
|
||||||
|
log('log', 'netInfo', `prefetched from status id ${prefetch}`)
|
||||||
|
} else {
|
||||||
|
log('error', 'netInfo', 'failed to prefetch')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const page of Object.keys(instance.timelinesLookback)) {
|
||||||
|
if (page !== loadPage) {
|
||||||
|
log(
|
||||||
|
'log',
|
||||||
|
'netInfo',
|
||||||
|
`prefetching other page ${instance.timelinesLookback[page].queryKey[1].page} ids: ${instance.timelinesLookback[page].ids}`
|
||||||
|
)
|
||||||
|
prefetchTimelineQuery(instance.timelinesLookback[page])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.resolve({ connected: true })
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log('log', 'netInfo', 'no local credential found')
|
log('log', 'netInfo', 'no local credential found')
|
||||||
return Promise.resolve({ connected: true })
|
return Promise.resolve()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log('warn', 'netInfo', 'network not connected')
|
log('warn', 'netInfo', 'network not connected')
|
||||||
return Promise.resolve({ connected: true })
|
return Promise.resolve()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ const instancesPersistConfig = {
|
|||||||
key: 'instances',
|
key: 'instances',
|
||||||
prefix,
|
prefix,
|
||||||
storage: secureStorage,
|
storage: secureStorage,
|
||||||
version: 6,
|
version: 7,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
migrate: createMigrate(instancesMigration)
|
migrate: createMigrate(instancesMigration)
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { ContextsV0 } from './v0'
|
import { ContextsV0 } from './v0'
|
||||||
|
import { ContextsV1 } from './v1'
|
||||||
|
|
||||||
const contextsMigration = {
|
const contextsMigration = {
|
||||||
1: (state: ContextsV0) => {
|
1: (state: ContextsV0) => {
|
||||||
@ -10,6 +11,11 @@ const contextsMigration = {
|
|||||||
announcements: { shown: false, unread: 0 }
|
announcements: { shown: false, unread: 0 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
2: (state: ContextsV1) => {
|
||||||
|
// @ts-ignore
|
||||||
|
delete state.mePage
|
||||||
|
return state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
src/utils/migrations/contexts/v1.ts
Normal file
17
src/utils/migrations/contexts/v1.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
export type ContextsV1 = {
|
||||||
|
storeReview: {
|
||||||
|
context: Readonly<number>
|
||||||
|
current: number
|
||||||
|
shown: boolean
|
||||||
|
}
|
||||||
|
publicRemoteNotice: {
|
||||||
|
context: Readonly<number>
|
||||||
|
current: number
|
||||||
|
hidden: boolean
|
||||||
|
}
|
||||||
|
previousTab: 'Tab-Local' | 'Tab-Public' | 'Tab-Notifications' | 'Tab-Me'
|
||||||
|
mePage: {
|
||||||
|
lists: { shown: boolean }
|
||||||
|
announcements: { shown: boolean; unread: number }
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
import { InstanceV3 } from './v3'
|
import { InstanceV3 } from './v3'
|
||||||
import { InstanceV4 } from './v4'
|
import { InstanceV4 } from './v4'
|
||||||
import { InstanceV5 } from './v5'
|
import { InstanceV5 } from './v5'
|
||||||
|
import { InstanceV6 } from './v6'
|
||||||
|
|
||||||
const instancesMigration = {
|
const instancesMigration = {
|
||||||
4: (state: InstanceV3) => {
|
4: (state: InstanceV3) => {
|
||||||
@ -54,6 +55,20 @@ const instancesMigration = {
|
|||||||
return { ...instance, configuration: undefined }
|
return { ...instance, configuration: undefined }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
7: (state: InstanceV6) => {
|
||||||
|
return {
|
||||||
|
instances: state.instances.map(instance => {
|
||||||
|
return {
|
||||||
|
...instance,
|
||||||
|
timelinesLookback: {},
|
||||||
|
mePage: {
|
||||||
|
lists: { shown: false },
|
||||||
|
announcements: { shown: false, unread: 0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
66
src/utils/migrations/instances/v6.ts
Normal file
66
src/utils/migrations/instances/v6.ts
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
import { ComposeStateDraft } from '@screens/Compose/utils/types'
|
||||||
|
|
||||||
|
type Instance = {
|
||||||
|
active: boolean
|
||||||
|
appData: {
|
||||||
|
clientId: string
|
||||||
|
clientSecret: string
|
||||||
|
}
|
||||||
|
url: string
|
||||||
|
token: string
|
||||||
|
uri: Mastodon.Instance['uri']
|
||||||
|
urls: Mastodon.Instance['urls']
|
||||||
|
account: {
|
||||||
|
id: Mastodon.Account['id']
|
||||||
|
acct: Mastodon.Account['acct']
|
||||||
|
avatarStatic: Mastodon.Account['avatar_static']
|
||||||
|
preferences: Mastodon.Preferences
|
||||||
|
}
|
||||||
|
max_toot_chars?: number // To be deprecated in v4
|
||||||
|
configuration?: Mastodon.Instance['configuration']
|
||||||
|
filters: Mastodon.Filter[]
|
||||||
|
notifications_filter: {
|
||||||
|
follow: boolean
|
||||||
|
favourite: boolean
|
||||||
|
reblog: boolean
|
||||||
|
mention: boolean
|
||||||
|
poll: boolean
|
||||||
|
follow_request: boolean
|
||||||
|
}
|
||||||
|
push: {
|
||||||
|
global: { loading: boolean; value: boolean }
|
||||||
|
decode: { loading: boolean; value: boolean }
|
||||||
|
alerts: {
|
||||||
|
follow: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['follow']
|
||||||
|
}
|
||||||
|
favourite: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['favourite']
|
||||||
|
}
|
||||||
|
reblog: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['reblog']
|
||||||
|
}
|
||||||
|
mention: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['mention']
|
||||||
|
}
|
||||||
|
poll: {
|
||||||
|
loading: boolean
|
||||||
|
value: Mastodon.PushSubscription['alerts']['poll']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keys: {
|
||||||
|
auth?: string
|
||||||
|
public?: string // legacy
|
||||||
|
private?: string // legacy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drafts: ComposeStateDraft[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export type InstanceV6 = {
|
||||||
|
instances: Instance[]
|
||||||
|
}
|
@ -2,7 +2,10 @@ import apiInstance, { InstanceResponse } from '@api/instance'
|
|||||||
import haptics from '@components/haptics'
|
import haptics from '@components/haptics'
|
||||||
import queryClient from '@helpers/queryClient'
|
import queryClient from '@helpers/queryClient'
|
||||||
import { store } from '@root/store'
|
import { store } from '@root/store'
|
||||||
import { getInstanceNotificationsFilter } from '@utils/slices/instancesSlice'
|
import {
|
||||||
|
getInstanceNotificationsFilter,
|
||||||
|
updateInstanceTimelineLookback
|
||||||
|
} from '@utils/slices/instancesSlice'
|
||||||
import { AxiosError } from 'axios'
|
import { AxiosError } from 'axios'
|
||||||
import { uniqBy } from 'lodash'
|
import { uniqBy } from 'lodash'
|
||||||
import {
|
import {
|
||||||
@ -194,9 +197,7 @@ const useTimelineQuery = ({
|
|||||||
...queryKeyParams
|
...queryKeyParams
|
||||||
}: QueryKeyTimeline[1] & {
|
}: QueryKeyTimeline[1] & {
|
||||||
options?: UseInfiniteQueryOptions<
|
options?: UseInfiniteQueryOptions<
|
||||||
InstanceResponse<
|
InstanceResponse<Mastodon.Status[]>,
|
||||||
Mastodon.Status[] | Mastodon.Notification[] | Mastodon.Conversation[]
|
|
||||||
>,
|
|
||||||
AxiosError
|
AxiosError
|
||||||
>
|
>
|
||||||
}) => {
|
}) => {
|
||||||
@ -209,6 +210,53 @@ const useTimelineQuery = ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const prefetchTimelineQuery = async ({
|
||||||
|
ids,
|
||||||
|
queryKey
|
||||||
|
}: {
|
||||||
|
ids: Mastodon.Status['id'][]
|
||||||
|
queryKey: QueryKeyTimeline
|
||||||
|
}): Promise<Mastodon.Status['id'] | undefined> => {
|
||||||
|
let page: string = ''
|
||||||
|
let local: boolean = false
|
||||||
|
switch (queryKey[1].page) {
|
||||||
|
case 'Following':
|
||||||
|
page = 'home'
|
||||||
|
break
|
||||||
|
case 'Local':
|
||||||
|
page = 'public'
|
||||||
|
local = true
|
||||||
|
break
|
||||||
|
case 'LocalPublic':
|
||||||
|
page = 'public'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const id of ids) {
|
||||||
|
const statuses = await apiInstance<Mastodon.Status[]>({
|
||||||
|
method: 'get',
|
||||||
|
url: `timelines/${page}`,
|
||||||
|
params: {
|
||||||
|
min_id: id,
|
||||||
|
limit: 1,
|
||||||
|
...(local && { local: 'true' })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (statuses.body.length) {
|
||||||
|
await queryClient.prefetchInfiniteQuery(queryKey, props =>
|
||||||
|
queryFunction({
|
||||||
|
...props,
|
||||||
|
queryKey,
|
||||||
|
pageParam: {
|
||||||
|
max_id: statuses.body[0].id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- Separator ---
|
// --- Separator ---
|
||||||
|
|
||||||
enum MapPropertyToUrl {
|
enum MapPropertyToUrl {
|
||||||
@ -388,4 +436,4 @@ const useTimelineMutation = ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export { useTimelineQuery, useTimelineMutation }
|
export { prefetchTimelineQuery, useTimelineQuery, useTimelineMutation }
|
||||||
|
@ -17,10 +17,6 @@ export type ContextsState = {
|
|||||||
hidden: boolean
|
hidden: boolean
|
||||||
}
|
}
|
||||||
previousTab: 'Tab-Local' | 'Tab-Public' | 'Tab-Notifications' | 'Tab-Me'
|
previousTab: 'Tab-Local' | 'Tab-Public' | 'Tab-Notifications' | 'Tab-Me'
|
||||||
mePage: {
|
|
||||||
lists: { shown: boolean }
|
|
||||||
announcements: { shown: boolean; unread: number }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const contextsInitialState = {
|
export const contextsInitialState = {
|
||||||
@ -36,11 +32,7 @@ export const contextsInitialState = {
|
|||||||
current: 0,
|
current: 0,
|
||||||
hidden: false
|
hidden: false
|
||||||
},
|
},
|
||||||
previousTab: 'Tab-Me',
|
previousTab: 'Tab-Me'
|
||||||
mePage: {
|
|
||||||
lists: { shown: false },
|
|
||||||
announcements: { shown: false, unread: 0 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const contextsSlice = createSlice({
|
const contextsSlice = createSlice({
|
||||||
@ -69,12 +61,6 @@ const contextsSlice = createSlice({
|
|||||||
action: PayloadAction<ContextsState['previousTab']>
|
action: PayloadAction<ContextsState['previousTab']>
|
||||||
) => {
|
) => {
|
||||||
state.previousTab = action.payload
|
state.previousTab = action.payload
|
||||||
},
|
|
||||||
updateContextMePage: (
|
|
||||||
state,
|
|
||||||
action: PayloadAction<Partial<ContextsState['mePage']>>
|
|
||||||
) => {
|
|
||||||
state.mePage = { ...state.mePage, ...action.payload }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -82,13 +68,11 @@ const contextsSlice = createSlice({
|
|||||||
export const getPublicRemoteNotice = (state: RootState) =>
|
export const getPublicRemoteNotice = (state: RootState) =>
|
||||||
state.contexts.publicRemoteNotice
|
state.contexts.publicRemoteNotice
|
||||||
export const getPreviousTab = (state: RootState) => state.contexts.previousTab
|
export const getPreviousTab = (state: RootState) => state.contexts.previousTab
|
||||||
export const getMePage = (state: RootState) => state.contexts.mePage
|
|
||||||
export const getContexts = (state: RootState) => state.contexts
|
export const getContexts = (state: RootState) => state.contexts
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
updateStoreReview,
|
updateStoreReview,
|
||||||
updatePublicRemoteNotice,
|
updatePublicRemoteNotice,
|
||||||
updatePreviousTab,
|
updatePreviousTab
|
||||||
updateContextMePage
|
|
||||||
} = contextsSlice.actions
|
} = contextsSlice.actions
|
||||||
export default contextsSlice.reducer
|
export default contextsSlice.reducer
|
||||||
|
@ -101,6 +101,11 @@ const addInstance = createAsyncThunk(
|
|||||||
},
|
},
|
||||||
keys: { auth: undefined, public: undefined, private: undefined }
|
keys: { auth: undefined, public: undefined, private: undefined }
|
||||||
},
|
},
|
||||||
|
timelinesLookback: {},
|
||||||
|
mePage: {
|
||||||
|
lists: { shown: false },
|
||||||
|
announcements: { shown: false, unread: 0 }
|
||||||
|
},
|
||||||
drafts: []
|
drafts: []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -2,6 +2,7 @@ import analytics from '@components/analytics'
|
|||||||
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
||||||
import { RootState } from '@root/store'
|
import { RootState } from '@root/store'
|
||||||
import { ComposeStateDraft } from '@screens/Compose/utils/types'
|
import { ComposeStateDraft } from '@screens/Compose/utils/types'
|
||||||
|
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||||
import { findIndex } from 'lodash'
|
import { findIndex } from 'lodash'
|
||||||
import addInstance from './instances/add'
|
import addInstance from './instances/add'
|
||||||
import removeInstance from './instances/remove'
|
import removeInstance from './instances/remove'
|
||||||
@ -70,6 +71,16 @@ export type Instance = {
|
|||||||
private?: string // legacy
|
private?: string // legacy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
timelinesLookback?: {
|
||||||
|
[key: string]: {
|
||||||
|
queryKey: QueryKeyTimeline
|
||||||
|
ids: Mastodon.Status['id'][]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mePage: {
|
||||||
|
lists: { shown: boolean }
|
||||||
|
announcements: { shown: boolean; unread: number }
|
||||||
|
}
|
||||||
drafts: ComposeStateDraft[]
|
drafts: ComposeStateDraft[]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +165,26 @@ const instancesSlice = createSlice({
|
|||||||
newInstance.push.global.value = false
|
newInstance.push.global.value = false
|
||||||
return newInstance
|
return newInstance
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
updateInstanceTimelineLookback: (
|
||||||
|
{ instances },
|
||||||
|
action: PayloadAction<Instance['timelinesLookback']>
|
||||||
|
) => {
|
||||||
|
const activeIndex = findInstanceActive(instances)
|
||||||
|
instances[activeIndex].timelinesLookback = {
|
||||||
|
...instances[activeIndex].timelinesLookback,
|
||||||
|
...action.payload
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updateInstanceMePage: (
|
||||||
|
{ instances },
|
||||||
|
action: PayloadAction<Partial<Instance['mePage']>>
|
||||||
|
) => {
|
||||||
|
const activeIndex = findInstanceActive(instances)
|
||||||
|
instances[activeIndex].mePage = {
|
||||||
|
...instances[activeIndex].mePage,
|
||||||
|
...action.payload
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
extraReducers: builder => {
|
extraReducers: builder => {
|
||||||
@ -354,6 +385,13 @@ export const getInstanceNotificationsFilter = ({
|
|||||||
export const getInstancePush = ({ instances: { instances } }: RootState) =>
|
export const getInstancePush = ({ instances: { instances } }: RootState) =>
|
||||||
instances[findInstanceActive(instances)]?.push
|
instances[findInstanceActive(instances)]?.push
|
||||||
|
|
||||||
|
export const getInstanceTimelinesLookback = ({
|
||||||
|
instances: { instances }
|
||||||
|
}: RootState) => instances[findInstanceActive(instances)]?.timelinesLookback
|
||||||
|
|
||||||
|
export const getInstanceMePage = ({ instances: { instances } }: RootState) =>
|
||||||
|
instances[findInstanceActive(instances)]?.mePage
|
||||||
|
|
||||||
export const getInstanceDrafts = ({ instances: { instances } }: RootState) =>
|
export const getInstanceDrafts = ({ instances: { instances } }: RootState) =>
|
||||||
instances[findInstanceActive(instances)]?.drafts
|
instances[findInstanceActive(instances)]?.drafts
|
||||||
|
|
||||||
@ -364,7 +402,9 @@ export const {
|
|||||||
updateInstanceDraft,
|
updateInstanceDraft,
|
||||||
removeInstanceDraft,
|
removeInstanceDraft,
|
||||||
clearPushLoading,
|
clearPushLoading,
|
||||||
disableAllPushes
|
disableAllPushes,
|
||||||
|
updateInstanceTimelineLookback,
|
||||||
|
updateInstanceMePage
|
||||||
} = instancesSlice.actions
|
} = instancesSlice.actions
|
||||||
|
|
||||||
export default instancesSlice.reducer
|
export default instancesSlice.reducer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user