From b9cf0ceb6b9a027e085dbd3fcffa9f5ec90ed4a0 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 9 Jul 2022 11:40:48 +0200 Subject: [PATCH] Fixed #352 --- src/i18n/de/screens/tabs.json | 2 - src/i18n/en/screens/tabs.json | 2 - src/i18n/it/screens/tabs.json | 2 - src/i18n/ko/screens/tabs.json | 2 - src/i18n/pt_BR/screens/tabs.json | 2 - src/i18n/vi/screens/tabs.json | 2 - src/i18n/zh-Hans/screens/tabs.json | 2 - src/i18n/zh-Hant/screens/tabs.json | 2 - .../Compose/Root/Header/SpoilerInput.tsx | 17 +++++- src/screens/Compose/Root/Header/TextInput.tsx | 16 ++++- src/screens/Tabs/Me/SettingsFontsize.tsx | 61 +++++++------------ 11 files changed, 53 insertions(+), 57 deletions(-) diff --git a/src/i18n/de/screens/tabs.json b/src/i18n/de/screens/tabs.json index 185cd5fd..b7971c2c 100644 --- a/src/i18n/de/screens/tabs.json +++ b/src/i18n/de/screens/tabs.json @@ -78,9 +78,7 @@ } }, "fontSize": { - "showcase": "Beispieltröt", "demo": "

Dies ist ein Beispieltröt😊. Du kannst aus mehreren der unteren Möglichkeiten auswählen.

Diese Einstellung betrifft ausschließlich die Haupteinstellungen, nicht die Schriftgröße in anderen Bereichen der App.

", - "availableSizes": "Verfügbare Größen", "sizes": { "S": "S", "M": "M – Standard", diff --git a/src/i18n/en/screens/tabs.json b/src/i18n/en/screens/tabs.json index c797bf01..33a37a35 100644 --- a/src/i18n/en/screens/tabs.json +++ b/src/i18n/en/screens/tabs.json @@ -78,9 +78,7 @@ } }, "fontSize": { - "showcase": "Example toot", "demo": "

This is a demo toot😊. You can choose from several options from below.

This setting only affects the main content of toots, but not other font sizes.

", - "availableSizes": "Available sizes", "sizes": { "S": "S", "M": "M - Default", diff --git a/src/i18n/it/screens/tabs.json b/src/i18n/it/screens/tabs.json index 02414793..c8af9115 100644 --- a/src/i18n/it/screens/tabs.json +++ b/src/i18n/it/screens/tabs.json @@ -78,9 +78,7 @@ } }, "fontSize": { - "showcase": "Toot di esempio", "demo": "

Questo toot è un esempio 😺️. Puoi scegliere diverse opzioni di grandezza del testo qui sotto.

Questa impostazione si applica solo al testo dei toot, non anche agli altri testi della app.

", - "availableSizes": "Dimensioni testo", "sizes": { "S": "S", "M": "M - Predefinito", diff --git a/src/i18n/ko/screens/tabs.json b/src/i18n/ko/screens/tabs.json index fdb34a76..8125b158 100644 --- a/src/i18n/ko/screens/tabs.json +++ b/src/i18n/ko/screens/tabs.json @@ -78,9 +78,7 @@ } }, "fontSize": { - "showcase": "예시 툿", "demo": "

데모 툿이에요😊. 아래의 여러 옵션 중에서 선택할 수 있어요.

이 설정은 툿의 메인 내용에만 적용되고, 다른 폰트 크기에 영향을 미치지 않아요.

", - "availableSizes": "사용할 수 있는 크기", "sizes": { "S": "작게", "M": "중간 - 기본값", diff --git a/src/i18n/pt_BR/screens/tabs.json b/src/i18n/pt_BR/screens/tabs.json index 8581178c..1bc5d5b8 100644 --- a/src/i18n/pt_BR/screens/tabs.json +++ b/src/i18n/pt_BR/screens/tabs.json @@ -78,9 +78,7 @@ } }, "fontSize": { - "showcase": "Exemplo de toot", "demo": "

Esta é uma demonstração também😊. Você pode escolher entre várias opções abaixo.

Esta configuração afeta apenas o conteúdo principal dos toots, mas não os tamanhos de outra fonte.

", - "availableSizes": "Tamanhos disponíveis", "sizes": { "S": "P", "M": "M - Padrão", diff --git a/src/i18n/vi/screens/tabs.json b/src/i18n/vi/screens/tabs.json index 166c2188..2549f011 100644 --- a/src/i18n/vi/screens/tabs.json +++ b/src/i18n/vi/screens/tabs.json @@ -78,9 +78,7 @@ } }, "fontSize": { - "showcase": "Xem trước", "demo": "

Đây là một tút mẫu 😊 Bạn có thể chọn một trong nhiều lựa chọn bên dưới.

Tùy chọn này chỉ áp dụng cho nội dung tút chứ không ảnh hưởng những phần tử khác của app.

", - "availableSizes": "Kích cỡ", "sizes": { "S": "S", "M": "M - Mặc định", diff --git a/src/i18n/zh-Hans/screens/tabs.json b/src/i18n/zh-Hans/screens/tabs.json index 1f968e41..db82db98 100644 --- a/src/i18n/zh-Hans/screens/tabs.json +++ b/src/i18n/zh-Hans/screens/tabs.json @@ -78,9 +78,7 @@ } }, "fontSize": { - "showcase": "嘟文示例", "demo": "

这是一条测试用的嘟文😊。以下是可供选择的字号,从小号至超大号。

这个设置仅会调整嘟文的正文字号,不影响其它字号。

", - "availableSizes": "可选字号", "sizes": { "S": "小号", "M": "默认", diff --git a/src/i18n/zh-Hant/screens/tabs.json b/src/i18n/zh-Hant/screens/tabs.json index bf70a873..634a671f 100644 --- a/src/i18n/zh-Hant/screens/tabs.json +++ b/src/i18n/zh-Hant/screens/tabs.json @@ -78,9 +78,7 @@ } }, "fontSize": { - "showcase": "嘟文範例", "demo": "", - "availableSizes": "", "sizes": { "S": "", "M": "", diff --git a/src/screens/Compose/Root/Header/SpoilerInput.tsx b/src/screens/Compose/Root/Header/SpoilerInput.tsx index 231d7db5..e5794fda 100644 --- a/src/screens/Compose/Root/Header/SpoilerInput.tsx +++ b/src/screens/Compose/Root/Header/SpoilerInput.tsx @@ -1,9 +1,12 @@ import CustomText from '@components/Text' +import { getSettingsFontsize } from '@utils/slices/settingsSlice' 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 { TextInput } from 'react-native' +import { useSelector } from 'react-redux' import formatText from '../../formatText' import ComposeContext from '../../utils/createContext' @@ -12,6 +15,16 @@ const ComposeSpoilerInput: React.FC = () => { const { t } = useTranslation('screenCompose') const { colors, mode } = useTheme() + const adaptiveFontsize = useSelector(getSettingsFontsize) + const adaptedFontsize = adaptiveScale( + StyleConstants.Font.Size.M, + adaptiveFontsize + ) + const adaptedLineheight = adaptiveScale( + StyleConstants.Font.LineHeight.M, + adaptiveFontsize + ) + return ( { marginRight: StyleConstants.Spacing.Global.PagePadding, borderBottomWidth: 0.5, color: colors.primaryDefault, - borderBottomColor: colors.border + borderBottomColor: colors.border, + fontSize: adaptedFontsize, + lineHeight: adaptedLineheight }} autoCapitalize='none' autoCorrect={false} diff --git a/src/screens/Compose/Root/Header/TextInput.tsx b/src/screens/Compose/Root/Header/TextInput.tsx index e148cbca..aa0ed691 100644 --- a/src/screens/Compose/Root/Header/TextInput.tsx +++ b/src/screens/Compose/Root/Header/TextInput.tsx @@ -1,7 +1,9 @@ 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 { 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' @@ -21,6 +23,16 @@ const ComposeTextInput: React.FC = () => { () => true ) + const adaptiveFontsize = useSelector(getSettingsFontsize) + const adaptedFontsize = adaptiveScale( + StyleConstants.Font.Size.M, + adaptiveFontsize + ) + const adaptedLineheight = adaptiveScale( + StyleConstants.Font.LineHeight.M, + adaptiveFontsize + ) + return ( { marginLeft: StyleConstants.Spacing.Global.PagePadding, marginRight: StyleConstants.Spacing.Global.PagePadding, color: colors.primaryDefault, - borderBottomColor: colors.border + borderBottomColor: colors.border, + fontSize: adaptedFontsize, + lineHeight: adaptedLineheight }} autoFocus enablesReturnKeyAutomatically diff --git a/src/screens/Tabs/Me/SettingsFontsize.tsx b/src/screens/Tabs/Me/SettingsFontsize.tsx index be55858f..43c6e046 100644 --- a/src/screens/Tabs/Me/SettingsFontsize.tsx +++ b/src/screens/Tabs/Me/SettingsFontsize.tsx @@ -102,49 +102,12 @@ const TabMeSettingsFontsize: React.FC< return ( - - {t('me.fontSize.showcase')} - - - - - - - - {t('me.fontSize.availableSizes')} - {sizesDemo} @@ -185,6 +148,26 @@ const TabMeSettingsFontsize: React.FC< style={{ marginHorizontal: StyleConstants.Spacing.S }} /> + + + + + ) }