1
0
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:
xmflsct
2022-12-28 23:41:36 +01:00
committed by GitHub
parent 71ccb4a93c
commit 1ea6aff328
214 changed files with 2151 additions and 3694 deletions

View File

@ -1,14 +1,13 @@
import { MAX_MEDIA_ATTACHMENTS } from '@components/mediaSelector'
import CustomText from '@components/Text'
import PasteInput, { PastedFile } from '@mattermost/react-native-paste-input'
import { getInstanceConfigurationStatusMaxAttachments } from '@utils/slices/instancesSlice'
import { getSettingsFontsize } from '@utils/slices/settingsSlice'
import { useGlobalStorage } from '@utils/storage/actions'
import { StyleConstants } from '@utils/styles/constants'
import { adaptiveScale } from '@utils/styles/scaling'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { Alert } from 'react-native'
import { useSelector } from 'react-redux'
import ComposeContext from '../../utils/createContext'
import { formatText } from '../../utils/processText'
import { uploadAttachment } from '../Footer/addAttachment'
@ -18,9 +17,7 @@ const ComposeTextInput: React.FC = () => {
const { t } = useTranslation(['common', 'screenCompose'])
const { colors, mode } = useTheme()
const maxAttachments = useSelector(getInstanceConfigurationStatusMaxAttachments, () => true)
const adaptiveFontsize = useSelector(getSettingsFontsize)
const [adaptiveFontsize] = useGlobalStorage.number('app.font_size')
const adaptedFontsize = adaptiveScale(StyleConstants.Font.Size.M, adaptiveFontsize)
const adaptedLineheight = adaptiveScale(StyleConstants.Font.LineHeight.M, adaptiveFontsize)
@ -72,7 +69,7 @@ const ComposeTextInput: React.FC = () => {
scrollEnabled={false}
disableCopyPaste={false}
onPaste={(error: string | null | undefined, files: PastedFile[]) => {
if (composeState.attachments.uploads.length + files.length > maxAttachments) {
if (composeState.attachments.uploads.length + files.length > MAX_MEDIA_ATTACHMENTS) {
Alert.alert(
t('screenCompose:content.root.header.textInput.keyboardImage.exceedMaximum.title'),
undefined,