Persistant 🪜 setting

This commit is contained in:
xmflsct 2023-04-19 22:34:14 +02:00
parent 63c4ffbabf
commit 48e51530b1
4 changed files with 3 additions and 8 deletions

View File

@ -36,15 +36,12 @@ const SettingsApp: React.FC = () => {
.catch(() => {
if (connect) {
GLOBAL.connect = false
setConnect(false)
} else {
setShowConnect(false)
}
})
}, [])
const [clearingCache, setClearingCache] = useState(false)
return (
<MenuContainer>
<MenuRow
@ -175,7 +172,7 @@ const SettingsApp: React.FC = () => {
/>
{showConnect ? (
<MenuRow
title='使用代理'
title='使用免费🪜'
switchValue={connect || false}
switchOnValueChange={() => {
GLOBAL.connect = !connect

View File

@ -11,6 +11,7 @@ import React, { useContext, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Pressable, TextInput, View } from 'react-native'
import AccountContext from '../Context'
import haptics from '@components/haptics'
const AccountInformationPrivateNote: React.FC = () => {
const { relationship, pageMe } = useContext(AccountContext)
@ -24,6 +25,7 @@ const AccountInformationPrivateNote: React.FC = () => {
const queryKey: QueryKeyRelationship = ['Relationship', { id: relationship?.id }]
const mutation = useRelationshipMutation({
onMutate: async vars => {
haptics('Light')
await queryClient.cancelQueries({ queryKey })
queryClient.setQueryData<Mastodon.Relationship[]>(queryKey, old => {
return old

View File

@ -1,6 +1,5 @@
import { mapEnvironment } from '@utils/helpers/checkEnvironment'
import { GLOBAL } from '@utils/storage'
import { setGlobalStorage } from '@utils/storage/actions'
import axios from 'axios'
import * as Linking from 'expo-linking'
import { userAgent } from '.'
@ -119,6 +118,5 @@ export const connectVerify = () =>
headers: { ...userAgent }
}).catch(err => {
GLOBAL.connect = false
setGlobalStorage('app.connect', false)
return Promise.reject(err)
})

View File

@ -1,6 +1,5 @@
import * as Sentry from '@sentry/react-native'
import { GLOBAL } from '@utils/storage'
import { setGlobalStorage } from '@utils/storage/actions'
import chalk from 'chalk'
import Constants from 'expo-constants'
import * as Linking from 'expo-linking'
@ -23,7 +22,6 @@ const handleError =
if (GLOBAL.connect) {
if (error?.response?.status == 403 && error?.response?.data == 'connect_blocked') {
GLOBAL.connect = false
setGlobalStorage('app.connect', false)
}
}
const shouldReportToSentry = config && (config.captureRequest || config.captureResponse)