This commit is contained in:
xmflsct 2022-11-22 22:00:33 +01:00
parent 9b40a605b4
commit a0c440be5e
4 changed files with 67 additions and 56 deletions

View File

@ -64,7 +64,7 @@ const AttachmentVideo: React.FC<Props> = ({
}, [])
const _handleAppStateChange = async (nextAppState: AppStateStatus) => {
if (appState.current.match(/active/) && nextAppState.match(/inactive/)) {
await videoPlayer.current?.stopAsync()
// await videoPlayer.current?.stopAsync()
} else if (gifv && appState.current.match(/background/) && nextAppState.match(/active/)) {
await videoPlayer.current?.setIsMutedAsync(true)
await videoPlayer.current?.playAsync()

View File

@ -4,7 +4,7 @@ import { AnyAction, configureStore, Reducer } from '@reduxjs/toolkit'
import contextsMigration from '@utils/migrations/contexts/migration'
import instancesMigration from '@utils/migrations/instances/migration'
import settingsMigration from '@utils/migrations/settings/migration'
import appSlice from '@utils/slices/appSlice'
import appSlice, { AppState } from '@utils/slices/appSlice'
import contextsSlice, { ContextsState } from '@utils/slices/contextsSlice'
import instancesSlice, { InstancesState } from '@utils/slices/instancesSlice'
import settingsSlice, { SettingsState } from '@utils/slices/settingsSlice'
@ -26,6 +26,13 @@ const secureStorage = createSecureStore()
const prefix = 'tooot'
const appPersistConfig = {
key: 'app',
prefix,
storage: AsyncStorage,
version: 0
}
const contextsPersistConfig = {
key: 'contexts',
prefix,
@ -55,19 +62,19 @@ const settingsPersistConfig = {
const store = configureStore({
reducer: {
app: persistReducer(appPersistConfig, appSlice) as Reducer<AppState, AnyAction>,
contexts: persistReducer(contextsPersistConfig, contextsSlice) as Reducer<
ContextsState,
AnyAction
>,
instances: persistReducer(
instancesPersistConfig,
instancesSlice
) as Reducer<InstancesState, AnyAction>,
instances: persistReducer(instancesPersistConfig, instancesSlice) as Reducer<
InstancesState,
AnyAction
>,
settings: persistReducer(settingsPersistConfig, settingsSlice) as Reducer<
SettingsState,
AnyAction
>,
app: appSlice
>
},
middleware: getDefaultMiddleware =>
getDefaultMiddleware({

View File

@ -0,0 +1,4 @@
export type AppV0 = {
expoToken?: string
versionUpdate: boolean
}

View File

@ -33,7 +33,9 @@ const pushUseConnect = ({ t, instances }: Params) => {
method: 'get',
url: `push/connect/${expoToken}`,
sentry: true
}).catch(error => {
})
.then(() => Notifications.setBadgeCountAsync(0))
.catch(error => {
Sentry.setExtras({
API: 'tooot',
...(error?.response && { response: error.response }),
@ -89,7 +91,6 @@ const pushUseConnect = ({ t, instances }: Params) => {
if (expoToken && pushEnabled.length && state === 'active') {
Notifications.getBadgeCountAsync().then(count => {
if (count > 0) {
Notifications.setBadgeCountAsync(0)
connect()
}
})
@ -102,7 +103,6 @@ const pushUseConnect = ({ t, instances }: Params) => {
}, [expoToken, pushEnabled.length])
return useEffect(() => {
Notifications.setBadgeCountAsync(0)
if (expoToken && pushEnabled.length) {
connect()
}