diff --git a/App.tsx b/App.tsx index 008dbb87..404584c3 100644 --- a/App.tsx +++ b/App.tsx @@ -1,3 +1,4 @@ +import NetInfo from '@react-native-community/netinfo' import client from '@root/api/client' import { Index } from '@root/Index' import { persistor, store } from '@root/store' @@ -6,7 +7,7 @@ import ThemeManager from '@utils/styles/ThemeManager' import * as SplashScreen from 'expo-splash-screen' import React, { useCallback, useEffect, useState } from 'react' import { enableScreens } from 'react-native-screens' -import { QueryClient, QueryClientProvider } from 'react-query' +import { onlineManager, QueryClient, QueryClientProvider } from 'react-query' import { Provider } from 'react-redux' import { PersistGate } from 'redux-persist/integration/react' import * as Sentry from 'sentry-expo' @@ -19,6 +20,12 @@ if (__DEV__) { }) } +// onlineManager.setEventListener(setOnline => { +// return NetInfo.addEventListener(state => { +// setOnline(state.isConnected) +// }) +// }) + Sentry.init({ dsn: 'https://c9e29aa05f774aca8f36def98244ce04@o389581.ingest.sentry.io/5571975', @@ -30,7 +37,15 @@ const queryClient = new QueryClient() enableScreens() +NetInfo.fetch().then(state => { + console.log('Connection type', state.type) + console.log('Is connected?', state.isConnected) + console.log('Is internet', state.isInternetReachable) + console.log('Details', state.details) +}) + const App: React.FC = () => { + useEffect(() => onlineManager.setOnline(false), []) const [appLoaded, setAppLoaded] = useState(false) const [startVerification, setStartVerification] = useState(false) const [localCorrupt, setLocalCorrupt] = useState(false) diff --git a/package.json b/package.json index 0e4c0864..c63b81a8 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "@expo/vector-icons": "^12.0.0", "@react-native-community/masked-view": "0.1.10", + "@react-native-community/netinfo": "^5.9.9", "@react-native-community/segmented-control": "2.2.1", "@react-native-community/slider": "3.0.3", "@react-navigation/bottom-tabs": "^5.11.2", @@ -112,4 +113,4 @@ ] }, "private": true -} \ No newline at end of file +} diff --git a/src/components/Header/Right.tsx b/src/components/Header/Right.tsx index 660fbf0b..06a73956 100644 --- a/src/components/Header/Right.tsx +++ b/src/components/Header/Right.tsx @@ -71,8 +71,9 @@ const HeaderRight: React.FC = ({ return ( = ({ [] ) return ( - + {item.reblog ? ( ) : pinnedLength && index < pinnedLength ? ( diff --git a/src/components/Timelines/Timeline/Shared/Actions.tsx b/src/components/Timelines/Timeline/Shared/Actions.tsx index 9bf43f8f..89b61905 100644 --- a/src/components/Timelines/Timeline/Shared/Actions.tsx +++ b/src/components/Timelines/Timeline/Shared/Actions.tsx @@ -125,26 +125,28 @@ const TimelineActions: React.FC = ({ queryKey, status, reblog }) => { } }) - const onPressReply = useCallback(() => { - navigation.navigate(getCurrentTab(navigation), { - screen: 'Screen-Shared-Compose', - params: { - type: 'reply', - incomingStatus: status, - visibilityLock: status.visibility === 'direct' - } - }) - }, []) - const onPressReblog = useCallback(() => { - if (status.visibility !== 'private' && status.visibility !== 'direct') { + const onPressReply = useCallback( + () => + navigation.navigate(getCurrentTab(navigation), { + screen: 'Screen-Shared-Compose', + params: { + type: 'reply', + incomingStatus: status, + visibilityLock: status.visibility === 'direct' + } + }), + [] + ) + const onPressReblog = useCallback( + () => mutate({ id: status.id, type: 'reblog', stateKey: 'reblogged', prevState: status.reblogged - }) - } - }, [status.reblogged]) + }), + [status.reblogged] + ) const onPressFavourite = useCallback( () => mutate({ @@ -264,6 +266,9 @@ const TimelineActions: React.FC = ({ queryKey, status, reblog }) => { style={styles.action} onPress={onPressReblog} children={childrenReblog} + disabled={ + status.visibility === 'private' || status.visibility === 'direct' + } /> = ({ status, contentWidth }) => { ) return ( - + {attachments} {status.sensitive && @@ -150,8 +145,13 @@ const styles = StyleSheet.create({ flex: 1, flexDirection: 'row', flexWrap: 'wrap', + justifyContent: 'center', alignContent: 'stretch' }, + container: { + flexBasis: '50%', + aspectRatio: 16 / 9 + }, sensitiveBlur: { position: 'absolute', width: '100%', diff --git a/src/components/Timelines/Timeline/Shared/Attachment/Audio.tsx b/src/components/Timelines/Timeline/Shared/Attachment/Audio.tsx index 3541b614..1e929205 100644 --- a/src/components/Timelines/Timeline/Shared/Attachment/Audio.tsx +++ b/src/components/Timelines/Timeline/Shared/Attachment/Audio.tsx @@ -44,7 +44,7 @@ const AttachmentAudio: React.FC = ({ sensitiveShown, audio }) => { }, [audioPlayer]) return ( - <> + {sensitiveShown ? ( audio.blurhash && ( @@ -67,8 +67,9 @@ const AttachmentAudio: React.FC = ({ sensitiveShown, audio }) => { )}