mirror of https://github.com/tooot-app/app
Fixed #452
Unfortunately iOS does not display RTL languages automatically like Android does, so some simple JS library is needed
This commit is contained in:
parent
4a35e910c1
commit
c90c8ee8d4
|
@ -2,6 +2,8 @@ Enjoy toooting! This version includes following improvements and fixes:
|
||||||
- Automatic setting detected language when tooting
|
- Automatic setting detected language when tooting
|
||||||
- Remember public timeline type selection
|
- Remember public timeline type selection
|
||||||
- Show diffing of edit history
|
- Show diffing of edit history
|
||||||
|
- Allow hiding boosts and replies in home timeline
|
||||||
|
- Support toot in RTL languages
|
||||||
- Added notification for admins
|
- Added notification for admins
|
||||||
- Fix whole word filter matching
|
- Fix whole word filter matching
|
||||||
- Fix tablet cannot delete toot drafts
|
- Fix tablet cannot delete toot drafts
|
|
@ -2,6 +2,8 @@ toooting愉快!此版本包括以下改进和修复:
|
||||||
- 自动识别发嘟语言
|
- 自动识别发嘟语言
|
||||||
- 记住上次公共时间轴选项
|
- 记住上次公共时间轴选项
|
||||||
- 显示编辑历史的差异
|
- 显示编辑历史的差异
|
||||||
|
- 关注列表可隐藏转嘟和回复
|
||||||
- 新增管理员推送通知
|
- 新增管理员推送通知
|
||||||
|
- 支持嘟文右到左文字
|
||||||
- 修复过滤整词功能
|
- 修复过滤整词功能
|
||||||
- 修复平板不能删除草稿
|
- 修复平板不能删除草稿
|
|
@ -93,6 +93,7 @@
|
||||||
"react-redux": "^8.0.5",
|
"react-redux": "^8.0.5",
|
||||||
"redux-persist": "^6.0.0",
|
"redux-persist": "^6.0.0",
|
||||||
"rn-placeholder": "^3.0.3",
|
"rn-placeholder": "^3.0.3",
|
||||||
|
"rtl-detect": "^1.0.4",
|
||||||
"valid-url": "^1.0.9",
|
"valid-url": "^1.0.9",
|
||||||
"zeego": "^0.5.0"
|
"zeego": "^0.5.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,7 @@ declare module 'htmlparser2-without-node-native'
|
||||||
declare module 'react-native-feather'
|
declare module 'react-native-feather'
|
||||||
declare module 'react-native-htmlview'
|
declare module 'react-native-htmlview'
|
||||||
declare module 'react-native-toast-message'
|
declare module 'react-native-toast-message'
|
||||||
|
declare module 'rtl-detect'
|
||||||
|
|
||||||
declare module '@helpers/features' {
|
declare module '@helpers/features' {
|
||||||
const features: { feature: string; version: number; reference?: string }[]
|
const features: { feature: string; version: number; reference?: string }[]
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import React, { useCallback, useState } from 'react'
|
import React, { useCallback, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Platform, Pressable, View } from 'react-native'
|
import { Platform, Pressable, TextStyleIOS, View } from 'react-native'
|
||||||
import HTMLView from 'react-native-htmlview'
|
import HTMLView from 'react-native-htmlview'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
|
|
||||||
|
@ -154,6 +154,7 @@ const renderNode = ({
|
||||||
export interface Props {
|
export interface Props {
|
||||||
content: string
|
content: string
|
||||||
size?: 'S' | 'M' | 'L'
|
size?: 'S' | 'M' | 'L'
|
||||||
|
textStyles?: TextStyleIOS
|
||||||
adaptiveSize?: boolean
|
adaptiveSize?: boolean
|
||||||
emojis?: Mastodon.Emoji[]
|
emojis?: Mastodon.Emoji[]
|
||||||
mentions?: Mastodon.Mention[]
|
mentions?: Mastodon.Mention[]
|
||||||
|
@ -171,6 +172,7 @@ const ParseHTML = React.memo(
|
||||||
({
|
({
|
||||||
content,
|
content,
|
||||||
size = 'M',
|
size = 'M',
|
||||||
|
textStyles,
|
||||||
adaptiveSize = false,
|
adaptiveSize = false,
|
||||||
emojis,
|
emojis,
|
||||||
mentions,
|
mentions,
|
||||||
|
@ -294,6 +296,7 @@ const ParseHTML = React.memo(
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
|
...textStyles,
|
||||||
height: numberOfLines === 1 && !expanded ? 0 : undefined
|
height: numberOfLines === 1 && !expanded ? 0 : undefined
|
||||||
}}
|
}}
|
||||||
numberOfLines={
|
numberOfLines={
|
||||||
|
|
|
@ -2,7 +2,9 @@ import { ParseHTML } from '@components/Parse'
|
||||||
import { getInstanceAccount } from '@utils/slices/instancesSlice'
|
import { getInstanceAccount } from '@utils/slices/instancesSlice'
|
||||||
import React, { useContext } from 'react'
|
import React, { useContext } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { Platform } from 'react-native'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
|
import { isRtlLang } from 'rtl-detect'
|
||||||
import StatusContext from './Context'
|
import StatusContext from './Context'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
@ -31,6 +33,11 @@ const TimelineContent: React.FC<Props> = ({ notificationOwnToot = false, setSpoi
|
||||||
numberOfLines={999}
|
numberOfLines={999}
|
||||||
highlighted={highlighted}
|
highlighted={highlighted}
|
||||||
disableDetails={disableDetails}
|
disableDetails={disableDetails}
|
||||||
|
textStyles={
|
||||||
|
Platform.OS === 'ios' && status.language && isRtlLang(status.language)
|
||||||
|
? { writingDirection: 'rtl' }
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<ParseHTML
|
<ParseHTML
|
||||||
content={status.content}
|
content={status.content}
|
||||||
|
@ -50,6 +57,11 @@ const TimelineContent: React.FC<Props> = ({ notificationOwnToot = false, setSpoi
|
||||||
setSpoilerExpanded={setSpoilerExpanded}
|
setSpoilerExpanded={setSpoilerExpanded}
|
||||||
highlighted={highlighted}
|
highlighted={highlighted}
|
||||||
disableDetails={disableDetails}
|
disableDetails={disableDetails}
|
||||||
|
textStyles={
|
||||||
|
Platform.OS === 'ios' && status.language && isRtlLang(status.language)
|
||||||
|
? { writingDirection: 'rtl' }
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
@ -62,6 +74,11 @@ const TimelineContent: React.FC<Props> = ({ notificationOwnToot = false, setSpoi
|
||||||
tags={status.tags}
|
tags={status.tags}
|
||||||
numberOfLines={highlighted || inThread ? 999 : notificationOwnToot ? 2 : undefined}
|
numberOfLines={highlighted || inThread ? 999 : notificationOwnToot ? 2 : undefined}
|
||||||
disableDetails={disableDetails}
|
disableDetails={disableDetails}
|
||||||
|
textStyles={
|
||||||
|
Platform.OS === 'ios' && status.language && isRtlLang(status.language)
|
||||||
|
? { writingDirection: 'rtl' }
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -11339,7 +11339,7 @@ router-ips@^1.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/router-ips/-/router-ips-1.0.0.tgz#44e00858ebebc0133d58e40b2cd8a1fbb04203f5"
|
resolved "https://registry.yarnpkg.com/router-ips/-/router-ips-1.0.0.tgz#44e00858ebebc0133d58e40b2cd8a1fbb04203f5"
|
||||||
integrity sha512-yBo6F52Un/WYioXbedBGvrKIiofbwt+4cUhdqDb9fNMJBI4D4jOy7jlxxaRVEvICPKU7xMmJDtDFR6YswX/sFQ==
|
integrity sha512-yBo6F52Un/WYioXbedBGvrKIiofbwt+4cUhdqDb9fNMJBI4D4jOy7jlxxaRVEvICPKU7xMmJDtDFR6YswX/sFQ==
|
||||||
|
|
||||||
rtl-detect@^1.0.2:
|
rtl-detect@^1.0.2, rtl-detect@^1.0.4:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/rtl-detect/-/rtl-detect-1.0.4.tgz#40ae0ea7302a150b96bc75af7d749607392ecac6"
|
resolved "https://registry.yarnpkg.com/rtl-detect/-/rtl-detect-1.0.4.tgz#40ae0ea7302a150b96bc75af7d749607392ecac6"
|
||||||
integrity sha512-EBR4I2VDSSYr7PkBmFy04uhycIpDKp+21p/jARYXlCSjQksTBQcJ0HFUPOO79EPPH5JS6VAhiIQbycf0O3JAxQ==
|
integrity sha512-EBR4I2VDSSYr7PkBmFy04uhycIpDKp+21p/jARYXlCSjQksTBQcJ0HFUPOO79EPPH5JS6VAhiIQbycf0O3JAxQ==
|
||||||
|
|
Loading…
Reference in New Issue