mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
619 restructure local storage (#628)
* To MMKV migration working * POC migrated font size settings * Moved settings to mmkv * Fix typos * Migrated contexts slice * Migrated app slice * POC instance emoji update * Migrated drafts * Migrated simple instance properties * All migrated! * Re-structure files * Tolerant of undefined settings * Can properly logging in and out including empty state
This commit is contained in:
@ -1,9 +1,14 @@
|
||||
import { ActionSheetOptions } from '@expo/react-native-action-sheet'
|
||||
import { store } from '@root/store'
|
||||
import { getInstanceConfigurationStatusMaxAttachments } from '@utils/slices/instancesSlice'
|
||||
import queryClient from '@utils/queryHooks'
|
||||
import { QueryKeyInstance } from '@utils/queryHooks/instance'
|
||||
import i18next from 'i18next'
|
||||
import { Asset, launchImageLibrary } from 'react-native-image-picker'
|
||||
|
||||
const queryKeyInstance: QueryKeyInstance = ['Instance']
|
||||
export const MAX_MEDIA_ATTACHMENTS: number =
|
||||
queryClient.getQueryData<Mastodon.Instance<any>>(queryKeyInstance)?.configuration?.statuses
|
||||
.max_media_attachments || 4
|
||||
|
||||
export interface Props {
|
||||
mediaType?: 'photo' | 'video'
|
||||
resize?: { width?: number; height?: number }
|
||||
@ -22,7 +27,7 @@ const mediaSelector = async ({
|
||||
indicateMaximum = false,
|
||||
showActionSheetWithOptions
|
||||
}: Props): Promise<Asset[]> => {
|
||||
const _maximum = maximum || getInstanceConfigurationStatusMaxAttachments(store.getState()) || 4
|
||||
const _maximum = maximum || MAX_MEDIA_ATTACHMENTS
|
||||
|
||||
const options = () => {
|
||||
switch (mediaType) {
|
||||
|
Reference in New Issue
Block a user