1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Basic new react-navigation types

This commit is contained in:
Zhiyuan Zheng
2021-08-29 15:25:38 +02:00
parent 6575a787f6
commit 122dae7404
68 changed files with 1099 additions and 1064 deletions

View File

@ -54,6 +54,13 @@ const addInstance = createAsyncThunk(
headers: { Authorization: `Bearer ${token}` }
})
const { body: filters } = await apiGeneral<Mastodon.Filter[]>({
method: 'get',
domain,
url: `api/v1/filters`,
headers: { Authorization: `Bearer ${token}` }
})
return Promise.resolve({
type,
data: {
@ -70,6 +77,7 @@ const addInstance = createAsyncThunk(
avatarStatic: avatar_static,
preferences
},
filters,
notifications_filter: {
follow: true,
favourite: true,

View File

@ -12,7 +12,7 @@ export const updateInstancePushDecode = createAsyncThunk(
async (
disable: boolean,
{ getState }
): Promise<Instance['push']['decode']['value']> => {
): Promise<{ disable: Instance['push']['decode']['value'] }> => {
const state = getState() as RootState
const instance = getInstance(state)
if (!instance?.url || !instance.account.id || !instance.push.keys) {
@ -89,6 +89,6 @@ export const updateInstancePushDecode = createAsyncThunk(
}
}
return Promise.resolve(disable)
return Promise.resolve({ disable })
}
)

View File

@ -274,7 +274,7 @@ const instancesSlice = createSlice({
.addCase(updateInstancePushDecode.fulfilled, (state, action) => {
const activeIndex = findInstanceActive(state.instances)
state.instances[activeIndex].push.decode.loading = false
state.instances[activeIndex].push.decode.value = action.payload
state.instances[activeIndex].push.decode.value = action.payload.disable
})
.addCase(updateInstancePushDecode.rejected, state => {
const activeIndex = findInstanceActive(state.instances)

View File

@ -13,7 +13,7 @@ export const changeAnalytics = createAsyncThunk(
'settings/changeAnalytics',
async (newValue: SettingsState['analytics']) => {
await Analytics.setAnalyticsCollectionEnabled(newValue)
return newValue
return { newValue }
}
)
@ -75,7 +75,7 @@ const settingsSlice = createSlice({
},
extraReducers: builder => {
builder.addCase(changeAnalytics.fulfilled, (state, action) => {
state.analytics = action.payload
state.analytics = action.payload.newValue
})
}
})

View File

@ -29,7 +29,7 @@ const versionSlice = createSlice({
reducers: {},
extraReducers: builder => {
builder.addCase(retriveVersionLatest.fulfilled, (state, action) => {
if (action.payload && Constants.manifest.version) {
if (action.payload && Constants.manifest?.version) {
if (parseInt(action.payload) > parseInt(Constants.manifest.version)) {
state.update = true
}