Merge pull request #434 from tooot-app/main

Test v4.5.1
This commit is contained in:
xmflsct 2022-11-05 01:56:17 +01:00 committed by GitHub
commit abff63eef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 74 additions and 65 deletions

View File

@ -25,7 +25,7 @@ jobs:
run: bundle install
- name: -- Step 5 -- Run fastlane
env:
DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer
ENVIRONMENT: ${{ steps.branch.outputs.branch }}
SENTRY_ENVIRONMENT: ${{ steps.branch.outputs.branch }}
LC_ALL: en_US.UTF-8

View File

@ -23,4 +23,6 @@ Please **do not** create a pull request to update translation. tooot's translati
[@duy@mas.to](https://mas.to/@duy) for Vietnamese translation
[@jimmyorz](https://github.com/jimmyorz) for Traditional Chinese translation
[@jk@mastodon.social](https://mastodon.social/@jk) for the famous Mastodon boop sound

View File

@ -1,6 +1,6 @@
{
"name": "tooot",
"version": "4.5.0",
"version": "4.5.1",
"description": "tooot for Mastodon",
"author": "xmflsct <me@xmflsct.com>",
"license": "GPL-3.0-or-later",

View File

@ -1,4 +1,5 @@
import { ActionSheetProvider } from '@expo/react-native-action-sheet'
import getLanguage from '@helpers/getLanguage'
import queryClient from '@helpers/queryClient'
import i18n from '@root/i18n/i18n'
import Screens from '@root/Screens'
@ -12,7 +13,7 @@ import timezone from '@root/startup/timezone'
import { persistor, store } from '@root/store'
import * as Sentry from '@sentry/react-native'
import AccessibilityManager from '@utils/accessibility/AccessibilityManager'
import { changeLanguage, getSettingsLanguage } from '@utils/slices/settingsSlice'
import { changeLanguage } from '@utils/slices/settingsSlice'
import ThemeManager from '@utils/styles/ThemeManager'
import * as Localization from 'expo-localization'
import * as SplashScreen from 'expo-splash-screen'
@ -83,10 +84,7 @@ const App: React.FC = () => {
if (bootstrapped) {
log('log', 'App', 'loading actual app :)')
log('log', 'App', `Locale: ${Localization.locale}`)
const language =
Platform.OS === 'ios'
? Localization.locale
: getSettingsLanguage(store.getState())
const language = getLanguage()
if (!language) {
if (Platform.OS !== 'ios') {
store.dispatch(changeLanguage('en'))

View File

@ -1,6 +1,6 @@
import axios from 'axios'
import Constants from 'expo-constants'
import handleError, { ctx } from './handleError'
import { userAgent } from './helpers'
export type Params = {
method: 'get' | 'post' | 'put' | 'delete'
@ -44,8 +44,8 @@ const apiGeneral = async <T = unknown>({
body && body instanceof FormData
? 'multipart/form-data'
: 'application/json',
'User-Agent': `tooot/${Constants.expoConfig?.version}`,
Accept: '*/*',
...userAgent,
...headers
},
...(body && { data: body })

6
src/api/helpers/index.ts Normal file
View File

@ -0,0 +1,6 @@
import Constants from "expo-constants"
import { Platform } from "react-native"
const userAgent = { 'User-Agent': `tooot/${Constants.expoConfig?.version} ${Platform.OS}/${Platform.Version}` }
export { userAgent }

View File

@ -1,8 +1,8 @@
import { RootState } from '@root/store'
import axios, { AxiosRequestConfig } from 'axios'
import Constants from 'expo-constants'
import li from 'li'
import handleError, { ctx } from './handleError'
import { userAgent } from './helpers'
export type Params = {
method: 'get' | 'post' | 'put' | 'delete' | 'patch'
@ -53,13 +53,13 @@ const apiInstance = async <T = unknown>({
console.log(
ctx.bgGreen.bold(' API instance ') +
' ' +
domain +
' ' +
method +
ctx.green(' -> ') +
`/${url}` +
(params ? ctx.green(' -> ') : ''),
' ' +
domain +
' ' +
method +
ctx.green(' -> ') +
`/${url}` +
(params ? ctx.green(' -> ') : ''),
params ? params : ''
)
@ -74,8 +74,8 @@ const apiInstance = async <T = unknown>({
body && body instanceof FormData
? 'multipart/form-data'
: 'application/json',
'User-Agent': `tooot/${Constants.expoConfig?.version}`,
Accept: '*/*',
...userAgent,
...headers,
...(token && {
Authorization: `Bearer ${token}`

View File

@ -1,8 +1,8 @@
import * as Sentry from '@sentry/react-native'
import { mapEnvironment } from '@utils/checkEnvironment'
import axios from 'axios'
import Constants from 'expo-constants'
import handleError, { ctx } from './handleError'
import { userAgent } from './helpers'
export type Params = {
method: 'get' | 'post' | 'put' | 'delete'
@ -50,13 +50,11 @@ const apiTooot = async <T = unknown>({
body && body instanceof FormData
? 'multipart/form-data'
: 'application/json',
'User-Agent': `tooot/${Constants.expoConfig?.version}`,
Accept: '*/*',
...userAgent,
...headers
},
...(body && { data: body }),
validateStatus: status =>
url.includes('translate') ? status < 500 : status === 200
...(body && { data: body })
})
.then(response => {
return Promise.resolve({

View File

@ -174,6 +174,12 @@ const contextMenuAccount = ({
id: accountId,
payload: { property: 'reports' }
})
mutation.mutate({
type: 'updateAccountProperty',
queryKey,
id: accountId,
payload: { property: 'block', currentValue: false }
})
}
}
}

View File

@ -1,8 +1,8 @@
import analytics from '@components/analytics'
import { ParseHTML } from '@components/Parse'
import CustomText from '@components/Text'
import getLanguage from '@helpers/getLanguage'
import { useTranslateQuery } from '@utils/queryHooks/translate'
import { getSettingsLanguage } from '@utils/slices/settingsSlice'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import * as Localization from 'expo-localization'
@ -11,14 +11,10 @@ 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 {
highlighted: boolean
status: Pick<
Mastodon.Status,
'language' | 'spoiler_text' | 'content' | 'emojis'
>
status: Pick<Mastodon.Status, 'language' | 'spoiler_text' | 'content' | 'emojis'>
}
const TimelineTranslate = React.memo(
@ -30,9 +26,7 @@ const TimelineTranslate = React.memo(
const { t } = useTranslation('componentTimeline')
const { colors } = useTheme()
const text = status.spoiler_text
? [status.spoiler_text, status.content]
: [status.content]
const text = status.spoiler_text ? [status.spoiler_text, status.content] : [status.content]
for (const i in text) {
for (const emoji of status.emojis) {
@ -56,7 +50,7 @@ const TimelineTranslate = React.memo(
detect()
}, [])
const settingsLanguage = useSelector(getSettingsLanguage)
const settingsLanguage = getLanguage()
const targetLanguage = settingsLanguage?.startsWith('en')
? Localization.locale || settingsLanguage || 'en'
: settingsLanguage || Localization.locale || 'en'
@ -107,12 +101,7 @@ const TimelineTranslate = React.memo(
<CustomText
fontStyle='M'
style={{
color:
isLoading || isSuccess
? colors.secondary
: isError
? colors.red
: colors.blue
color: isLoading || isSuccess ? colors.secondary : isError ? colors.red : colors.blue
}}
>
{isError
@ -127,9 +116,7 @@ const TimelineTranslate = React.memo(
: t('shared.translate.default')}
</CustomText>
<CustomText>
{__DEV__
? ` Source: ${detectedLanguage}; Target: ${targetLanguage}`
: undefined}
{__DEV__ ? ` Source: ${detectedLanguage}; Target: ${targetLanguage}` : undefined}
</CustomText>
{isLoading ? (
<Circle

View File

@ -0,0 +1,12 @@
import { store } from '@root/store'
import { getSettingsLanguage } from '@utils/slices/settingsSlice'
import * as Localization from 'expo-localization'
import { Platform } from "react-native"
const getLanguage = (): string => {
return Platform.OS === 'ios'
? Localization.locale
: getSettingsLanguage(store.getState())
}
export default getLanguage

View File

@ -2,7 +2,7 @@
"HTML": {
"accessibilityHint": "Nhấn để mở rộng hoặc thu gọn nội dung",
"expanded": "{{hint}}{{moreLines}}",
"moreLines": "",
"moreLines": " ({{count}} dòng nữa)",
"defaultHint": "Tút dài"
}
}

View File

@ -40,9 +40,9 @@
"accessibilityLabel": "Đăng lại tút này",
"function": "Đăng lại tút",
"options": {
"title": "",
"public": "",
"unlisted": ""
"title": "Kiểu đăng lại",
"public": "Đăng lại công khai",
"unlisted": "Đăng lại hạn chế"
}
},
"favourited": {

View File

@ -14,13 +14,13 @@
"base": "將使用系統內建的瀏覽器來登入tooot 無法讀取您的帳號資訊。"
},
"terms": {
"base": "登入則表示您同意<0>隱私條款</0>和<1>服務條款</1>。"
"base": "登入則表示您同意<0>隱私政策</0>和<1>使用條款</1>。"
}
},
"update": {
"alert": {
"title": "已登入站點",
"message": "您可以多登入其他的帳號,已登入的帳號會被保留",
"message": "您可以登入其它的帳號,已登入的帳號會被保留",
"buttons": {
"cancel": "$t(common:buttons.cancel)",
"continue": "繼續"

View File

@ -1,10 +1,10 @@
{
"title": "選擇媒體來源",
"message": "媒體 EXIF 資料不會被上傳",
"message": "媒體 Exif 資訊不會被上傳",
"options": {
"image": "上傳圖片",
"image_max": "上傳圖片(最多 {{max}}",
"image_max": "上傳圖片(最多 {{max}}",
"video": "上傳影片",
"video_max": "上傳影片(最多 {{max}}"
"video_max": "上傳影片(最多 {{max}}"
}
}

View File

@ -22,9 +22,9 @@
"actioned": {
"pinned": "置頂",
"favourite": "{{name}} 把您的嘟文加入了最愛",
"status": "{{name}} 正發了嘟",
"follow": "{{name}} 追隨您了",
"follow_request": "{{name}} 要求您允許他的追隨",
"status": "{{name}} 剛剛嘟文",
"follow": "{{name}} 跟隨了您",
"follow_request": "{{name}} 要求跟隨您",
"poll": "您曾投過的投票已經結束",
"reblog": {
"default": "{{name}} 轉嘟了",

View File

@ -1,7 +1,7 @@
{
"tabs": {
"local": {
"name": "隨中"
"name": "隨中"
},
"public": {
"name": "",
@ -47,16 +47,16 @@
"name": "語言"
},
"lists": {
"name": "清單"
"name": "列表"
},
"list": {
"name": "清單: {{list}}"
"name": "列表:{{list}}"
},
"push": {
"name": "推播通知"
},
"profile": {
"name": "編輯個人資料"
"name": "編輯個人檔案"
},
"profileName": {
"name": "編輯顯示名稱"
@ -71,20 +71,20 @@
"name": "App 設定"
},
"webSettings": {
"name": "更多帳號設定"
"name": "更多帳號設定"
},
"switch": {
"name": "切換帳號"
}
},
"fontSize": {
"demo": "<p>這是一條測試用的嘟文😊。以下是可供選擇的字體大小,從小超大。<br /><br />這個設定僅會調整嘟文本身字體大小,不影響其它字體大小。</p>",
"demo": "<p>這是一條測試用的嘟文😊。以下是可供選擇的字體大小,從小超大。<br /><br />這個設定僅會調整嘟文本身字體大小,不影響其它介面的字體大小。</p>",
"sizes": {
"S": "小",
"M": "M - 預設",
"M": "中 (預設)",
"L": "大",
"XL": "大",
"XXL": "大"
"XL": "大",
"XXL": "大"
}
},
"profile": {
@ -277,7 +277,7 @@
},
"analytics": {
"heading": "幫助我們改善",
"description": "僅收集不與使用者關聯的資料"
"description": "僅收集不與使用者關聯的資料"
},
"version": "Version v{{version}}",
"instanceVersion": "Mastodon version v{{version}}"

View File

@ -387,7 +387,7 @@ const mutationFunction = async (params: MutationVarsTimeline) => {
url: `statuses/${params.id}/${
params.payload.currentValue ? 'un' : ''
}${MapPropertyToUrl[params.payload.property]}`,
body
...(params.payload.property === 'reblogged' && { body })
})
}
case 'updateAccountProperty':