Merge pull request #330 from tooot-app/main

Another test
This commit is contained in:
xmflsct 2022-06-10 20:53:31 +02:00 committed by GitHub
commit 4d003de83f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 97 additions and 49 deletions

View File

@ -1,6 +1,5 @@
import Button from '@components/Button'
import Icon from '@components/Icon'
import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
import { useAppsQuery } from '@utils/queryHooks/apps'
import { useInstanceQuery } from '@utils/queryHooks/instance'
import { getInstances } from '@utils/slices/instancesSlice'
@ -9,7 +8,7 @@ import { useTheme } from '@utils/styles/ThemeManager'
import * as WebBrowser from 'expo-web-browser'
import { debounce } from 'lodash'
import React, { RefObject, useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Trans, useTranslation } from 'react-i18next'
import {
Alert,
Image,
@ -39,7 +38,6 @@ const ComponentInstance: React.FC<Props> = ({
}) => {
const { t } = useTranslation('componentInstance')
const { colors, mode } = useTheme()
const { screenReaderEnabled } = useAccessibility()
const instances = useSelector(getInstances, () => true)
const [domain, setDomain] = useState<string>()
@ -247,7 +245,7 @@ const ComponentInstance: React.FC<Props> = ({
style={{
flexDirection: 'row',
marginHorizontal: StyleConstants.Spacing.Global.PagePadding,
marginVertical: StyleConstants.Spacing.M
marginTop: StyleConstants.Spacing.M
}}
>
<Icon
@ -265,29 +263,59 @@ const ComponentInstance: React.FC<Props> = ({
<CustomText
fontStyle='S'
style={{ flex: 1, color: colors.secondary }}
accessibilityRole='link'
onPress={() => {
if (screenReaderEnabled) {
analytics('view_privacy')
WebBrowser.openBrowserAsync(
'https://tooot.app/privacy-policy'
)
}
}}
>
{t('server.disclaimer.base')}
<CustomText
accessible
style={{ color: colors.blue }}
onPress={() => {
analytics('view_privacy')
WebBrowser.openBrowserAsync(
'https://tooot.app/privacy-policy'
)
}}
>
{t('server.disclaimer.privacy')}
</CustomText>
</CustomText>
</View>
<View
style={{
flexDirection: 'row',
marginHorizontal: StyleConstants.Spacing.Global.PagePadding,
marginBottom: StyleConstants.Spacing.M
}}
>
<Icon
name='CheckSquare'
size={StyleConstants.Font.Size.S}
color={colors.secondary}
style={{
marginTop:
(StyleConstants.Font.LineHeight.S -
StyleConstants.Font.Size.S) /
2,
marginRight: StyleConstants.Spacing.XS
}}
/>
<CustomText
fontStyle='S'
style={{ flex: 1, color: colors.secondary }}
accessibilityRole='link'
>
<Trans
i18nKey='componentInstance:server.terms.base'
components={[
<CustomText
accessible
style={{ color: colors.blue }}
onPress={() => {
analytics('view_privacy')
WebBrowser.openBrowserAsync(
'https://tooot.app/privacy-policy'
)
}}
/>,
<CustomText
accessible
style={{ color: colors.blue }}
onPress={() => {
analytics('view_tos')
WebBrowser.openBrowserAsync(
'https://tooot.app/terms-of-service'
)
}}
/>
]}
/>
</CustomText>
</View>
</View>

View File

@ -30,35 +30,41 @@ const TimelineTranslate = React.memo(
const { t } = useTranslation('componentTimeline')
const { colors } = useTheme()
let text = status.spoiler_text
const text = status.spoiler_text
? [status.spoiler_text, status.content]
: [status.content]
for (const i in text) {
for (const emoji of status.emojis) {
text[i] = text[i].replaceAll(`:${emoji.shortcode}:`, '')
text[i] = text[i].replaceAll(`:${emoji.shortcode}:`, ' ')
}
text[i] = text[i]
.replace(/(<([^>]+)>)/gi, ' ')
.replace(/@.*? /gi, ' ')
.replace(/#.*? /gi, ' ')
.replace(/http(s):\/\/.*? /gi, ' ')
}
const [detectedLanguage, setDetectedLanguage] = useState<string>('')
useEffect(() => {
const detect = async () => {
const result = await detectLanguage(text.join(`\n`))
const result = await detectLanguage(text.join(`\n\n`))
setDetectedLanguage(result.detected.slice(0, 2))
}
detect()
}, [])
const settingsLanguage = useSelector(getSettingsLanguage)
const targetLanguage = settingsLanguage || Localization.locale || 'en'
const [enabled, setEnabled] = useState(false)
const { refetch, data, isLoading, isSuccess, isError } = useTranslateQuery({
source: detectedLanguage,
target: Localization.locale || settingsLanguage || 'en',
target: targetLanguage,
text,
options: { enabled }
})
console.log('detectedLanguage', detectedLanguage)
if (!detectedLanguage) {
return null
}
@ -118,9 +124,7 @@ const TimelineTranslate = React.memo(
</CustomText>
<CustomText>
{__DEV__
? ` Source: ${detectedLanguage}; Target: ${
Localization.locale || settingsLanguage || 'en'
}`
? ` Source: ${detectedLanguage}; Target: ${targetLanguage}`
: undefined}
</CustomText>
{isLoading ? (

View File

@ -11,8 +11,10 @@
"domains": "Domains"
},
"disclaimer": {
"base": "Der Login erfolgt über den Browser, so dass Ihre Kontoinformationen für die Toot-App nicht sichtbar sind. Weitere Informationen",
"privacy": "Datenschutzbestimmungen"
"base": "Der Login erfolgt über den Browser, so dass Ihre Kontoinformationen für die Toot-App nicht sichtbar sind."
},
"terms": {
"base": ""
}
},
"update": {

View File

@ -11,8 +11,10 @@
"domains": "Universes"
},
"disclaimer": {
"base": "Logging in process uses system broswer that, your account information won't be visible to tooot app. Read more ",
"privacy": "privacy policy"
"base": "Logging in process uses system broswer that, your account information won't be visible to tooot app."
},
"terms": {
"base": "By logging in, you agree to the <0>privacy policy</0> and <1>terms of service</1>."
}
},
"update": {

View File

@ -11,8 +11,10 @@
"domains": "Universi"
},
"disclaimer": {
"base": "Per accedere, verrà aperta una pagina del browser di sistema. I dati di accesso del tuo account sono protetti. Leggi di più:",
"privacy": "politica sulla privacy"
"base": "Per accedere, verrà aperta una pagina del browser di sistema. I dati di accesso del tuo account sono protetti."
},
"terms": {
"base": ""
}
},
"update": {

View File

@ -11,8 +11,10 @@
"domains": "연합"
},
"disclaimer": {
"base": "로그인 과정에서는 시스템 브라우저를 사용해, tooot 앱이 당신의 계정 정보를 볼 수 없어요.\n더 알아보기 ",
"privacy": "개인정보 정책"
"base": "로그인 과정에서는 시스템 브라우저를 사용해, tooot 앱이 당신의 계정 정보를 볼 수 없어요."
},
"terms": {
"base": ""
}
},
"update": {

View File

@ -11,8 +11,10 @@
"domains": "Universo"
},
"disclaimer": {
"base": "O processo de login usa o navegador do sistema e as informações da sua conta não estarão visíveis para o aplicativo Tooot. Consulte Mais informação ",
"privacy": "política de privacidade"
"base": "O processo de login usa o navegador do sistema e as informações da sua conta não estarão visíveis para o aplicativo Tooot."
},
"terms": {
"base": "Ao fazer o login, você concorda com a <0>política de privacidade</0> e os <1>termos de serviço</1>."
}
},
"update": {

View File

@ -11,8 +11,10 @@
"domains": "Liên hợp"
},
"disclaimer": {
"base": "tooot sẽ không thấy được thông tin tài khoản của bạn. Tìm hiểu thêm ",
"privacy": "Bảo mật"
"base": "tooot sẽ không thấy được thông tin tài khoản của bạn."
},
"terms": {
"base": ""
}
},
"update": {

View File

@ -11,8 +11,10 @@
"domains": "连结总数"
},
"disclaimer": {
"base": "登录过程将使用系统浏览器你的账号登录信息tooot应用无法读取。详见 ",
"privacy": "隐私条款"
"base": "登录过程将使用系统浏览器你的账号登录信息tooot应用无法读取。"
},
"terms": {
"base": "登录即表示您同意<0>隐私政策</0>和<1>服务条款</1>。"
}
},
"update": {

View File

@ -11,8 +11,10 @@
"domains": "串聯宇宙"
},
"disclaimer": {
"base": "將使用系統內建的瀏覽器來登入tooot app 無法讀取您的帳號資訊;詳見 ",
"privacy": "隱私權政策"
"base": ""
},
"terms": {
"base": ""
}
},
"update": {