diff --git a/src/App.tsx b/src/App.tsx index 32072655..89748fed 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,6 +11,7 @@ import log from '@utils/startup/log' import netInfo from '@utils/startup/netInfo' import push from '@utils/startup/push' import sentry from '@utils/startup/sentry' +import { GLOBAL } from '@utils/storage' import { getGlobalStorage, setAccount, setGlobalStorage } from '@utils/storage/actions' import { migrateFromAsyncStorage, versionStorageGlobal } from '@utils/storage/migrations/toMMKV' import ThemeManager from '@utils/styles/ThemeManager' @@ -24,10 +25,6 @@ import { enableFreeze } from 'react-native-screens' import i18n from './i18n' import Screens from './screens' -export const GLOBAL: { connect?: boolean } = { - connect: undefined -} - Platform.select({ android: LogBox.ignoreLogs(['Setting a timer for a long period of time']) }) diff --git a/src/components/GracefullyImage.tsx b/src/components/GracefullyImage.tsx index e161e9ce..23ce899f 100644 --- a/src/components/GracefullyImage.tsx +++ b/src/components/GracefullyImage.tsx @@ -63,9 +63,10 @@ const GracefullyImage = ({ {...(onPress ? (hidden ? { disabled: true } : { onPress }) : { disabled: true })} > { if (setImageDimensions && event.source) { diff --git a/src/components/Instance/index.tsx b/src/components/Instance/index.tsx index f4fba00f..d9997133 100644 --- a/src/components/Instance/index.tsx +++ b/src/components/Instance/index.tsx @@ -19,8 +19,8 @@ import { import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import * as AuthSession from 'expo-auth-session' +import * as Crypto from 'expo-crypto' import { Image } from 'expo-image' -import * as Random from 'expo-random' import * as WebBrowser from 'expo-web-browser' import { debounce } from 'lodash' import React, { RefObject, useCallback, useState } from 'react' @@ -162,7 +162,7 @@ const ComponentInstance: React.FC = ({ 'admin.sign_up': false, 'admin.report': false }, - key: fromByteArray(Random.getRandomBytes(16)) + key: fromByteArray(Crypto.getRandomBytes(16)) }, page_local: { showBoosts: true, @@ -233,7 +233,7 @@ const ComponentInstance: React.FC = ({ ) : null} diff --git a/src/components/Timeline/index.tsx b/src/components/Timeline/index.tsx index 9319852c..13ff0573 100644 --- a/src/components/Timeline/index.tsx +++ b/src/components/Timeline/index.tsx @@ -134,15 +134,6 @@ const Timeline: React.FC = ({ { onScroll: ({ contentOffset: { y } }) => { scrollY.value = y - if ( - y < 300 && - !isFetchingPrev.value && - fetchingType.value === 0 && - shouldAutoFetch.value && - Platform.OS === 'ios' - ) { - fetchingType.value = 1 - } }, onEndDrag: ({ contentOffset: { y } }) => { if (!disableRefresh && !isFetching) { @@ -157,6 +148,21 @@ const Timeline: React.FC = ({ }, [isFetching] ) + useAnimatedReaction( + () => scrollY.value < 600, + (curr, prev) => { + if ( + curr === true && + prev === false && + !isFetchingPrev.value && + fetchingType.value === 0 && + shouldAutoFetch.value && + Platform.OS === 'ios' + ) { + fetchingType.value = 1 + } + } + ) const latestMarker = useRef() const updateMarkers = useCallback( diff --git a/src/screens/ImageViewer/index.tsx b/src/screens/ImageViewer/index.tsx index 2831b24f..5438b16e 100644 --- a/src/screens/ImageViewer/index.tsx +++ b/src/screens/ImageViewer/index.tsx @@ -194,9 +194,9 @@ const ScreenImagesViewer = ({ > { // Fix a bug for some users of v4.8.0 let authKey = push.key if (push.key?.length <= 10) { - authKey = fromByteArray(Random.getRandomBytes(16)) + authKey = fromByteArray(Crypto.getRandomBytes(16)) } // Turning on const randomPath = (Math.random() + 1).toString(36).substring(2) diff --git a/src/screens/Tabs/Me/Settings/App.tsx b/src/screens/Tabs/Me/Settings/App.tsx index 82584399..642dee40 100644 --- a/src/screens/Tabs/Me/Settings/App.tsx +++ b/src/screens/Tabs/Me/Settings/App.tsx @@ -5,13 +5,13 @@ import { LOCALES } from '@i18n/locales' import { useNavigation } from '@react-navigation/native' import { connectVerify } from '@utils/api/helpers/connect' import { androidActionSheetStyles } from '@utils/helpers/androidActionSheetStyles' +import { GLOBAL } from '@utils/storage' import { useGlobalStorage } from '@utils/storage/actions' import { useTheme } from '@utils/styles/ThemeManager' import * as Localization from 'expo-localization' import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { Linking, Platform } from 'react-native' -import { GLOBAL } from '../../../../App' import { mapFontsizeToName } from '../SettingsFontsize' const SettingsApp: React.FC = () => { diff --git a/src/screens/Tabs/index.tsx b/src/screens/Tabs/index.tsx index 0d5b4499..77700c5d 100644 --- a/src/screens/Tabs/index.tsx +++ b/src/screens/Tabs/index.tsx @@ -52,6 +52,7 @@ const ScreenTabs = () => { return (