Try to fix Android storage issue

This commit is contained in:
Zhiyuan Zheng 2022-05-19 00:46:25 +02:00
parent 0479e2fc9f
commit 67b15f75f5
4 changed files with 23 additions and 10 deletions

View File

@ -4,7 +4,7 @@
"native": "220508",
"major": 4,
"minor": 0,
"patch": 2,
"patch": 3,
"expo": "45.0.0"
},
"description": "tooot app for Mastodon",

View File

@ -378,10 +378,7 @@ const ScreenCompose: React.FC<RootStackScreenProps<'Screen-Compose'>> = ({
)
} else {
Sentry.Native.captureMessage('Compose posting', {
contexts: {
errorObject: error,
errorString: error.toString()
}
contexts: { errorObject: error }
})
haptics('Error')
composeDispatch({ type: 'posting', payload: false })

View File

@ -1,4 +1,4 @@
import apiInstance from '@api/instance'
import apiInstance, { InstanceResponse } from '@api/instance'
import { ComposeState } from '@screens/Compose/utils/types'
import { RootStackParamList } from '@utils/navigation/navigators'
import * as Crypto from 'expo-crypto'
@ -6,7 +6,7 @@ import * as Crypto from 'expo-crypto'
const composePost = async (
params: RootStackParamList['Screen-Compose'],
composeState: ComposeState
) => {
): Promise<InstanceResponse<Mastodon.Status>> => {
const formData = new FormData()
if (composeState.replyToStatus) {

View File

@ -8,8 +8,19 @@ import contextsSlice, { ContextsState } from '@utils/slices/contextsSlice'
import instancesSlice, { InstancesState } from '@utils/slices/instancesSlice'
import settingsSlice, { SettingsState } from '@utils/slices/settingsSlice'
import versionSlice from '@utils/slices/versionSlice'
import { Platform } from 'react-native'
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'
import { createMigrate, persistReducer, persistStore } from 'redux-persist'
import {
createMigrate,
FLUSH,
PAUSE,
PERSIST,
persistReducer,
persistStore,
PURGE,
REGISTER,
REHYDRATE
} from 'redux-persist'
const secureStorage = createSecureStore()
@ -27,7 +38,7 @@ const contextsPersistConfig = {
const instancesPersistConfig = {
key: 'instances',
prefix,
storage: secureStorage,
storage: Platform.OS === 'ios' ? secureStorage : AsyncStorage,
version: 9,
// @ts-ignore
migrate: createMigrate(instancesMigration)
@ -61,8 +72,13 @@ const store = configureStore({
middleware: getDefaultMiddleware =>
getDefaultMiddleware({
serializableCheck: {
ignoredActions: ['persist/PERSIST']
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER]
}
}).concat(store => next => action => {
console.log('dispatching', action)
let result = next(action)
console.log('next state', store.getState())
return result
})
})