mirror of
https://github.com/tooot-app/app
synced 2025-05-02 19:08:58 +02:00
Test updates (#323)
* New translations actions.json (German) * New translations actions.json (Korean) * New translations actions.json (Chinese Simplified) * New translations actions.json (Chinese Traditional) * New translations actions.json (Vietnamese) * New translations actions.json (Italian) * New translations actions.json (Portuguese, Brazilian) * Bump packages * New translations actions.json (Chinese Simplified) * Fixed #108 * Fixed #117 * Fixed #137 * Fix badge not cleared on app launch * Update Expo workflow * Update build.yml * New context menu largely working * Fixed #158 * File format changes by `expo prebuild` * Update .gitignore * Try out notification sound * Bump packages * New Crowdin updates (#319) * New translations actions.json (Portuguese, Brazilian) * New translations timeline.json (Portuguese, Brazilian) * New translations actions.json (Portuguese, Brazilian) * New translations compose.json (Portuguese, Brazilian) * New translations tabs.json (Portuguese, Brazilian) * New translations actions.json (Vietnamese) * New translations timeline.json (German) * New translations mediaSelector.json (Italian) * New translations contextMenu.json (Vietnamese) * New translations contextMenu.json (Chinese Traditional) * New translations contextMenu.json (Chinese Simplified) * New translations contextMenu.json (Korean) * New translations contextMenu.json (Italian) * New translations contextMenu.json (German) * New translations mediaSelector.json (Portuguese, Brazilian) * New translations timeline.json (Portuguese, Brazilian) * New translations timeline.json (Italian) * New translations mediaSelector.json (German) * New translations mediaSelector.json (Vietnamese) * New translations mediaSelector.json (Chinese Traditional) * New translations mediaSelector.json (Chinese Simplified) * New translations mediaSelector.json (Korean) * New translations timeline.json (Chinese Traditional) * New translations timeline.json (Vietnamese) * New translations timeline.json (Chinese Simplified) * New translations timeline.json (Korean) * New translations contextMenu.json (Portuguese, Brazilian) * New translations mediaSelector.json (Vietnamese) * New translations contextMenu.json (Vietnamese) * New translations contextMenu.json (Vietnamese) * New translations mediaSelector.json (Chinese Simplified) * New translations contextMenu.json (German) * New translations contextMenu.json (Italian) * New translations contextMenu.json (Korean) * New translations contextMenu.json (Chinese Simplified) * New translations contextMenu.json (Portuguese, Brazilian) * Fixed #321 * Refine photo upload messaging * Prefer local language detection
This commit is contained in:
parent
55053e73f8
commit
a70e1af535
@ -408,6 +408,8 @@ PODS:
|
||||
- React-Core
|
||||
- react-native-context-menu-view (1.5.4):
|
||||
- React
|
||||
- react-native-language-detection (0.1.0):
|
||||
- React
|
||||
- react-native-netinfo (9.0.0):
|
||||
- React-Core
|
||||
- react-native-pager-view (5.4.11):
|
||||
@ -640,6 +642,7 @@ DEPENDENCIES:
|
||||
- react-native-blurhash (from `../node_modules/react-native-blurhash`)
|
||||
- "react-native-cameraroll (from `../node_modules/@react-native-community/cameraroll`)"
|
||||
- react-native-context-menu-view (from `../node_modules/react-native-context-menu-view`)
|
||||
- react-native-language-detection (from `../node_modules/react-native-language-detection`)
|
||||
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
|
||||
- react-native-pager-view (from `../node_modules/react-native-pager-view`)
|
||||
- "react-native-paste-input (from `../node_modules/@mattermost/react-native-paste-input`)"
|
||||
@ -794,6 +797,8 @@ EXTERNAL SOURCES:
|
||||
:path: "../node_modules/@react-native-community/cameraroll"
|
||||
react-native-context-menu-view:
|
||||
:path: "../node_modules/react-native-context-menu-view"
|
||||
react-native-language-detection:
|
||||
:path: "../node_modules/react-native-language-detection"
|
||||
react-native-netinfo:
|
||||
:path: "../node_modules/@react-native-community/netinfo"
|
||||
react-native-pager-view:
|
||||
@ -916,6 +921,7 @@ SPEC CHECKSUMS:
|
||||
react-native-blurhash: add4df9a937b4e021a24bc67a0714f13e0bd40b7
|
||||
react-native-cameraroll: 2957f2bce63ae896a848fbe0d5352c1bd4d20866
|
||||
react-native-context-menu-view: b0beca02aad4bd9f9d7d932bf437e0a03baa69ef
|
||||
react-native-language-detection: 0e43195ad014974f1b7a31b64820eff34a243f2d
|
||||
react-native-netinfo: 5b664b2945a8f02102b296f0f812bddd6827ed9c
|
||||
react-native-pager-view: 7f00d63688f7df9fad86dfb0154814419cc5eb8d
|
||||
react-native-paste-input: efbf0b08fa1673f0e3131da6ea01678c1bb8003e
|
||||
|
@ -86,6 +86,7 @@
|
||||
"react-native-gesture-handler": "2.4.2",
|
||||
"react-native-htmlview": "0.16.0",
|
||||
"react-native-image-crop-picker": "^0.37.3",
|
||||
"react-native-language-detection": "^0.1.0",
|
||||
"react-native-pager-view": "5.4.11",
|
||||
"react-native-reanimated": "2.8.0",
|
||||
"react-native-safe-area-context": "4.3.1",
|
||||
|
@ -5,18 +5,11 @@ import { getInstanceActive } from '@utils/slices/instancesSlice'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
import React, { RefObject, useCallback, useRef } from 'react'
|
||||
import {
|
||||
FlatList,
|
||||
FlatListProps,
|
||||
Platform,
|
||||
RefreshControl,
|
||||
StyleSheet
|
||||
} from 'react-native'
|
||||
import { FlatList, FlatListProps, Platform, RefreshControl } from 'react-native'
|
||||
import Animated, {
|
||||
useAnimatedScrollHandler,
|
||||
useSharedValue
|
||||
} from 'react-native-reanimated'
|
||||
import { useQueryClient } from 'react-query'
|
||||
import { useSelector } from 'react-redux'
|
||||
import TimelineEmpty from './Timeline/Empty'
|
||||
import TimelineFooter from './Timeline/Footer'
|
||||
@ -149,7 +142,6 @@ const Timeline: React.FC<Props> = ({
|
||||
data={flattenData}
|
||||
initialNumToRender={6}
|
||||
maxToRenderPerBatch={3}
|
||||
style={styles.flatList}
|
||||
onEndReached={onEndReached}
|
||||
onEndReachedThreshold={0.75}
|
||||
ListFooterComponent={
|
||||
@ -160,9 +152,13 @@ const Timeline: React.FC<Props> = ({
|
||||
}
|
||||
ListEmptyComponent={<TimelineEmpty queryKey={queryKey} />}
|
||||
ItemSeparatorComponent={ItemSeparatorComponent}
|
||||
maintainVisibleContentPosition={{
|
||||
minIndexForVisible: 0
|
||||
}}
|
||||
maintainVisibleContentPosition={
|
||||
isFetching
|
||||
? {
|
||||
minIndexForVisible: 0
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
{...androidRefreshControl}
|
||||
{...customProps}
|
||||
/>
|
||||
@ -170,10 +166,4 @@ const Timeline: React.FC<Props> = ({
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
flatList: {
|
||||
minHeight: '100%'
|
||||
}
|
||||
})
|
||||
|
||||
export default Timeline
|
||||
|
@ -6,10 +6,11 @@ import { getSettingsLanguage } from '@utils/slices/settingsSlice'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
import * as Localization from 'expo-localization'
|
||||
import React, { useState } from 'react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Pressable } from 'react-native'
|
||||
import { Circle } from 'react-native-animated-spinkit'
|
||||
import detectLanguage from 'react-native-language-detection'
|
||||
import { useSelector } from 'react-redux'
|
||||
|
||||
export interface Props {
|
||||
@ -32,17 +33,6 @@ const TimelineTranslate = React.memo(
|
||||
const { t } = useTranslation('componentTimeline')
|
||||
const { colors } = useTheme()
|
||||
|
||||
const tootLanguage = status.language.slice(0, 2)
|
||||
|
||||
const settingsLanguage = useSelector(getSettingsLanguage)
|
||||
|
||||
if (Localization.locale.includes(tootLanguage)) {
|
||||
return null
|
||||
}
|
||||
if (settingsLanguage?.includes(tootLanguage)) {
|
||||
return null
|
||||
}
|
||||
|
||||
let text = status.spoiler_text
|
||||
? [status.spoiler_text, status.content]
|
||||
: [status.content]
|
||||
@ -53,14 +43,39 @@ const TimelineTranslate = React.memo(
|
||||
}
|
||||
}
|
||||
|
||||
const [detectedLanguage, setDetectedLanguage] = useState<string>('')
|
||||
useEffect(() => {
|
||||
if (!status.language) {
|
||||
return
|
||||
}
|
||||
|
||||
const detect = async () => {
|
||||
const result = await detectLanguage(text.join(`\n`))
|
||||
setDetectedLanguage(result.detected.slice(0, 2))
|
||||
}
|
||||
detect()
|
||||
}, [])
|
||||
|
||||
const settingsLanguage = useSelector(getSettingsLanguage)
|
||||
|
||||
const [enabled, setEnabled] = useState(false)
|
||||
const { refetch, data, isLoading, isSuccess, isError } = useTranslateQuery({
|
||||
source: status.language,
|
||||
source: detectedLanguage,
|
||||
target: Localization.locale || settingsLanguage || 'en',
|
||||
text,
|
||||
options: { enabled }
|
||||
})
|
||||
|
||||
if (!detectedLanguage) {
|
||||
return null
|
||||
}
|
||||
if (Localization.locale.includes(detectedLanguage)) {
|
||||
return null
|
||||
}
|
||||
if (settingsLanguage?.includes(detectedLanguage)) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Pressable
|
||||
|
@ -82,7 +82,7 @@ export const uploadAttachment = async ({
|
||||
break
|
||||
}
|
||||
|
||||
const uploadFailed = () => {
|
||||
const uploadFailed = (message?: string) => {
|
||||
composeDispatch({
|
||||
type: 'attachment/upload/fail',
|
||||
payload: hash
|
||||
@ -91,7 +91,7 @@ export const uploadAttachment = async ({
|
||||
i18next.t(
|
||||
'screenCompose:content.root.actions.attachment.failed.alert.title'
|
||||
),
|
||||
undefined,
|
||||
message,
|
||||
[
|
||||
{
|
||||
text: i18next.t(
|
||||
@ -126,8 +126,12 @@ export const uploadAttachment = async ({
|
||||
uploadFailed()
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
uploadFailed()
|
||||
.catch((err: any) => {
|
||||
uploadFailed(
|
||||
err?.message && typeof err?.message === 'string'
|
||||
? err?.message.slice(0, 50)
|
||||
: undefined
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@ -141,6 +145,7 @@ const chooseAndUploadAttachment = async ({
|
||||
})
|
||||
for (const media of result) {
|
||||
uploadAttachment({ composeDispatch, media })
|
||||
await new Promise(res => setTimeout(res, 500))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7531,6 +7531,11 @@ react-native-iphone-x-helper@^1.3.1:
|
||||
resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz#20c603e9a0e765fd6f97396638bdeb0e5a60b010"
|
||||
integrity sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==
|
||||
|
||||
react-native-language-detection@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-language-detection/-/react-native-language-detection-0.1.0.tgz#06b5d20bffb60dbbd599c8e62b6acf500952afa8"
|
||||
integrity sha512-26CLndVMmMbVp40Y9Herza73nfR08JFTcYkJ3MX5MIQbGRoqgNAG89z8pA1y7dPHHK1Nfa6AWKAYpNv7tMRCaw==
|
||||
|
||||
react-native-pager-view@5.4.11:
|
||||
version "5.4.11"
|
||||
resolved "https://registry.yarnpkg.com/react-native-pager-view/-/react-native-pager-view-5.4.11.tgz#677540293c7b4e0e022efb45727ef9b4efa35409"
|
||||
|
Loading…
x
Reference in New Issue
Block a user