mirror of
https://github.com/tooot-app/app
synced 2025-04-24 15:08:51 +02:00
Persistant 🪜 setting
This commit is contained in:
parent
63c4ffbabf
commit
48e51530b1
@ -36,15 +36,12 @@ const SettingsApp: React.FC = () => {
|
|||||||
.catch(() => {
|
.catch(() => {
|
||||||
if (connect) {
|
if (connect) {
|
||||||
GLOBAL.connect = false
|
GLOBAL.connect = false
|
||||||
setConnect(false)
|
|
||||||
} else {
|
} else {
|
||||||
setShowConnect(false)
|
setShowConnect(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const [clearingCache, setClearingCache] = useState(false)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuContainer>
|
<MenuContainer>
|
||||||
<MenuRow
|
<MenuRow
|
||||||
@ -175,7 +172,7 @@ const SettingsApp: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
{showConnect ? (
|
{showConnect ? (
|
||||||
<MenuRow
|
<MenuRow
|
||||||
title='使用代理'
|
title='使用免费🪜'
|
||||||
switchValue={connect || false}
|
switchValue={connect || false}
|
||||||
switchOnValueChange={() => {
|
switchOnValueChange={() => {
|
||||||
GLOBAL.connect = !connect
|
GLOBAL.connect = !connect
|
||||||
|
@ -11,6 +11,7 @@ import React, { useContext, useState } from 'react'
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Pressable, TextInput, View } from 'react-native'
|
import { Pressable, TextInput, View } from 'react-native'
|
||||||
import AccountContext from '../Context'
|
import AccountContext from '../Context'
|
||||||
|
import haptics from '@components/haptics'
|
||||||
|
|
||||||
const AccountInformationPrivateNote: React.FC = () => {
|
const AccountInformationPrivateNote: React.FC = () => {
|
||||||
const { relationship, pageMe } = useContext(AccountContext)
|
const { relationship, pageMe } = useContext(AccountContext)
|
||||||
@ -24,6 +25,7 @@ const AccountInformationPrivateNote: React.FC = () => {
|
|||||||
const queryKey: QueryKeyRelationship = ['Relationship', { id: relationship?.id }]
|
const queryKey: QueryKeyRelationship = ['Relationship', { id: relationship?.id }]
|
||||||
const mutation = useRelationshipMutation({
|
const mutation = useRelationshipMutation({
|
||||||
onMutate: async vars => {
|
onMutate: async vars => {
|
||||||
|
haptics('Light')
|
||||||
await queryClient.cancelQueries({ queryKey })
|
await queryClient.cancelQueries({ queryKey })
|
||||||
queryClient.setQueryData<Mastodon.Relationship[]>(queryKey, old => {
|
queryClient.setQueryData<Mastodon.Relationship[]>(queryKey, old => {
|
||||||
return old
|
return old
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { mapEnvironment } from '@utils/helpers/checkEnvironment'
|
import { mapEnvironment } from '@utils/helpers/checkEnvironment'
|
||||||
import { GLOBAL } from '@utils/storage'
|
import { GLOBAL } from '@utils/storage'
|
||||||
import { setGlobalStorage } from '@utils/storage/actions'
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import * as Linking from 'expo-linking'
|
import * as Linking from 'expo-linking'
|
||||||
import { userAgent } from '.'
|
import { userAgent } from '.'
|
||||||
@ -119,6 +118,5 @@ export const connectVerify = () =>
|
|||||||
headers: { ...userAgent }
|
headers: { ...userAgent }
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
GLOBAL.connect = false
|
GLOBAL.connect = false
|
||||||
setGlobalStorage('app.connect', false)
|
|
||||||
return Promise.reject(err)
|
return Promise.reject(err)
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import * as Sentry from '@sentry/react-native'
|
import * as Sentry from '@sentry/react-native'
|
||||||
import { GLOBAL } from '@utils/storage'
|
import { GLOBAL } from '@utils/storage'
|
||||||
import { setGlobalStorage } from '@utils/storage/actions'
|
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import Constants from 'expo-constants'
|
import Constants from 'expo-constants'
|
||||||
import * as Linking from 'expo-linking'
|
import * as Linking from 'expo-linking'
|
||||||
@ -23,7 +22,6 @@ const handleError =
|
|||||||
if (GLOBAL.connect) {
|
if (GLOBAL.connect) {
|
||||||
if (error?.response?.status == 403 && error?.response?.data == 'connect_blocked') {
|
if (error?.response?.status == 403 && error?.response?.data == 'connect_blocked') {
|
||||||
GLOBAL.connect = false
|
GLOBAL.connect = false
|
||||||
setGlobalStorage('app.connect', false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const shouldReportToSentry = config && (config.captureRequest || config.captureResponse)
|
const shouldReportToSentry = config && (config.captureRequest || config.captureResponse)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user