1
.github/workflows/build.yml
vendored
@ -28,7 +28,6 @@ jobs:
|
|||||||
- name: -- Step 4 -- Install node dependencies
|
- name: -- Step 4 -- Install node dependencies
|
||||||
run: yarn install
|
run: yarn install
|
||||||
- name: -- Step 5 -- Install native dependencies
|
- name: -- Step 5 -- Install native dependencies
|
||||||
if: github.ref != 'refs/heads/main'
|
|
||||||
run: npx pod-install
|
run: npx pod-install
|
||||||
- name: -- Step 6 -- Install ruby dependencies
|
- name: -- Step 6 -- Install ruby dependencies
|
||||||
run: bundle install
|
run: bundle install
|
||||||
|
@ -26,7 +26,7 @@ public class MainActivity extends ReactActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(null);
|
||||||
// SplashScreen.show(...) has to be called after super.onCreate(...)
|
// SplashScreen.show(...) has to be called after super.onCreate(...)
|
||||||
// Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
|
// Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
|
||||||
SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
|
SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
|
||||||
|
3
fastlane/.gitignore
vendored
@ -5,5 +5,4 @@
|
|||||||
|
|
||||||
/README.md
|
/README.md
|
||||||
/report.xml
|
/report.xml
|
||||||
Preview.html
|
Preview.html
|
||||||
screenshots
|
|
17
fastlane/Deliverfile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
languages(['zh-Hans'])
|
||||||
|
|
||||||
|
name({
|
||||||
|
'default' => "tooot"
|
||||||
|
})
|
||||||
|
keywords({
|
||||||
|
'default' => "Mastodon,tooot,social,decentralized,长毛象,社交,去中心"
|
||||||
|
})
|
||||||
|
privacy_url({
|
||||||
|
'default' => "https://tooot.app/privacy-policy"
|
||||||
|
})
|
||||||
|
support_url({
|
||||||
|
'default' => "https://tooot.app"
|
||||||
|
})
|
||||||
|
|
||||||
|
copyright("#{Time.now.year} ©️ xmflsct")
|
||||||
|
primary_category("SOCIAL_NETWORKING")
|
@ -57,7 +57,7 @@ private_lane :github_release do |options|
|
|||||||
description: "No changelog provided",
|
description: "No changelog provided",
|
||||||
commitish: git_branch,
|
commitish: git_branch,
|
||||||
is_prerelease: options[:prerelease],
|
is_prerelease: options[:prerelease],
|
||||||
upload_assets: ["#{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"]
|
upload_assets: options[:prerelease] ? nil : ["#{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -69,6 +69,8 @@ end
|
|||||||
desc "Build and deploy iOS app"
|
desc "Build and deploy iOS app"
|
||||||
private_lane :build_ios do
|
private_lane :build_ios do
|
||||||
BUILD_DIRECTORY = "./ios/build"
|
BUILD_DIRECTORY = "./ios/build"
|
||||||
|
IPA_FILE = "#{BUILD_DIRECTORY}/tooot.ipa"
|
||||||
|
DSYM_FILE = "#{BUILD_DIRECTORY}/tooot.app.dSYM.zip"
|
||||||
|
|
||||||
update_expo_ios
|
update_expo_ios
|
||||||
setup_ci
|
setup_ci
|
||||||
@ -77,17 +79,39 @@ private_lane :build_ios do
|
|||||||
when "candidate"
|
when "candidate"
|
||||||
prepare_appstore_ios
|
prepare_appstore_ios
|
||||||
match( type: "appstore", readonly: true )
|
match( type: "appstore", readonly: true )
|
||||||
build_ios_app( export_method: "app-store", include_symbols: true, include_bitcode: true, silent: true )
|
build_ios_app(
|
||||||
|
export_method: "app-store",
|
||||||
|
include_symbols: true,
|
||||||
|
output_directory: BUILD_DIRECTORY,
|
||||||
|
silent: true
|
||||||
|
)
|
||||||
|
sentry_upload_dsym(
|
||||||
|
org_slug: ENV["SENTRY_ORGANIZATION"],
|
||||||
|
project_slug: ENV["SENTRY_PROJECT"],
|
||||||
|
dsym_path: DSYM_FILE
|
||||||
|
)
|
||||||
upload_to_testflight(
|
upload_to_testflight(
|
||||||
|
ipa: IPA_FILE,
|
||||||
demo_account_required: true,
|
demo_account_required: true,
|
||||||
distribute_external: true,
|
distribute_external: true,
|
||||||
groups: "测试用户",
|
groups: "测试用户",
|
||||||
changelog: "Ready for testing"
|
changelog: "感谢帮忙测试 tooot 🙏"
|
||||||
)
|
)
|
||||||
when "release"
|
when "release"
|
||||||
prepare_appstore_ios
|
prepare_appstore_ios
|
||||||
match( type: "appstore", readonly: true )
|
match( type: "appstore", readonly: true )
|
||||||
build_ios_app( export_method: "app-store", include_bitcode: true, silent: true )
|
build_ios_app(
|
||||||
|
export_method: "app-store",
|
||||||
|
include_bitcode: true,
|
||||||
|
output_directory: BUILD_DIRECTORY,
|
||||||
|
silent: true
|
||||||
|
)
|
||||||
|
upload_to_app_store(
|
||||||
|
force: true,
|
||||||
|
ipa: IPA_FILE,
|
||||||
|
submit_for_review: true,
|
||||||
|
automatic_release: false
|
||||||
|
)
|
||||||
else
|
else
|
||||||
if !is_ci
|
if !is_ci
|
||||||
match( type: "development", readonly: true )
|
match( type: "development", readonly: true )
|
||||||
@ -126,6 +150,27 @@ private_lane :build_android do
|
|||||||
skip_upload_images: true,
|
skip_upload_images: true,
|
||||||
skip_upload_screenshots: true
|
skip_upload_screenshots: true
|
||||||
)
|
)
|
||||||
|
when "release"
|
||||||
|
prepare_playstore_android
|
||||||
|
build_android_app(
|
||||||
|
task: 'clean bundle',
|
||||||
|
build_type: 'release',
|
||||||
|
project_dir: "./android",
|
||||||
|
print_command: false,
|
||||||
|
print_command_output: false,
|
||||||
|
properties: {
|
||||||
|
"expoSDK" => VERSIONS[:expo],
|
||||||
|
"releaseChannel" => RELEASE_CHANNEL,
|
||||||
|
"android.injected.signing.store.file" => "#{File.expand_path('..', Dir.pwd)}/android/tooot.jks",
|
||||||
|
"android.injected.signing.store.password" => ENV["ANDROID_KEYSTORE_PASSWORD"],
|
||||||
|
"android.injected.signing.key.alias" => ENV["ANDROID_KEYSTORE_ALIAS"],
|
||||||
|
"android.injected.signing.key.password" => ENV["ANDROID_KEYSTORE_KEY_PASSWORD"],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
upload_to_play_store(
|
||||||
|
track: "production",
|
||||||
|
skip_upload_changelogs: true
|
||||||
|
)
|
||||||
build_android_app(
|
build_android_app(
|
||||||
task: 'assemble',
|
task: 'assemble',
|
||||||
build_type: 'release',
|
build_type: 'release',
|
||||||
@ -142,7 +187,6 @@ private_lane :build_android do
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
sh "mv #{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]} #{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"
|
sh "mv #{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]} #{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"
|
||||||
when "release"
|
|
||||||
else
|
else
|
||||||
if !is_ci
|
if !is_ci
|
||||||
build_android_app(
|
build_android_app(
|
||||||
|
1
fastlane/metadata/android/en-US/full_description.txt
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../default/description.txt
|
1
fastlane/metadata/android/en-US/images/phoneScreenshots/0_65.png
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../../../screenshots/en_US/0_65.png
|
1
fastlane/metadata/android/en-US/images/phoneScreenshots/1_65.png
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../../../screenshots/en_US/1_65.png
|
1
fastlane/metadata/android/en-US/images/phoneScreenshots/2_65.png
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../../../screenshots/en_US/2_65.png
|
1
fastlane/metadata/android/en-US/images/phoneScreenshots/3_65.png
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../../../screenshots/en_US/3_65.png
|
1
fastlane/metadata/android/en-US/short_description.txt
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../default/subtitle.txt
|
1
fastlane/metadata/android/zh-CN/full_description.txt
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../zh-Hans/description.txt
|
BIN
fastlane/metadata/android/zh-CN/images/featureGraphic.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
fastlane/metadata/android/zh-CN/images/icon.png
Normal file
After Width: | Height: | Size: 14 KiB |
1
fastlane/metadata/android/zh-CN/images/phoneScreenshots/0_65.png
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../../../screenshots/zh-Hans/0_65.png
|
1
fastlane/metadata/android/zh-CN/images/phoneScreenshots/1_65.png
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../../../screenshots/zh-Hans/1_65.png
|
1
fastlane/metadata/android/zh-CN/images/phoneScreenshots/2_65.png
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../../../screenshots/zh-Hans/2_65.png
|
1
fastlane/metadata/android/zh-CN/images/phoneScreenshots/3_65.png
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../../../screenshots/zh-Hans/3_65.png
|
1
fastlane/metadata/android/zh-CN/short_description.txt
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../zh-Hans/subtitle.txt
|
1
fastlane/metadata/android/zh-CN/title.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
tooot
|
5
fastlane/metadata/default/description.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
tooot is an open source, simple yet elegant Mastodon mobile client.
|
||||||
|
|
||||||
|
A Mastodon (https://joinmastodon.org/) account is required to use this app.
|
||||||
|
|
||||||
|
If you have suggestions, please reach out to @tooot@xmflsct.com or support@tooot.ap.
|
1
fastlane/metadata/default/release_notes.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
1
fastlane/metadata/default/subtitle.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Open source Mastodon client
|
10
fastlane/metadata/zh-Hans/description.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
tooot是一个专门为中文用户社区所打造的开源、简洁长毛象客户端。使用此客户端需要已经拥有一个长毛象(https://joinmastodon.org/)账号。
|
||||||
|
|
||||||
|
tooot支持:
|
||||||
|
- 多账号登录
|
||||||
|
- 黑暗或自适应模式
|
||||||
|
- 可调整正文字体大小
|
||||||
|
- 消息推送
|
||||||
|
等功能。
|
||||||
|
|
||||||
|
如有使用建议或意见,请联系@tooot@xmflsct.com或者support@tooot.app。
|
1
fastlane/metadata/zh-Hans/release_notes.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
1
fastlane/metadata/zh-Hans/subtitle.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
开源长毛象客户端
|
BIN
fastlane/screenshots/en_US/0_55.png
Normal file
After Width: | Height: | Size: 560 KiB |
BIN
fastlane/screenshots/en_US/0_65.png
Normal file
After Width: | Height: | Size: 723 KiB |
BIN
fastlane/screenshots/en_US/1_55.png
Normal file
After Width: | Height: | Size: 356 KiB |
BIN
fastlane/screenshots/en_US/1_65.png
Normal file
After Width: | Height: | Size: 462 KiB |
BIN
fastlane/screenshots/en_US/2_55.png
Normal file
After Width: | Height: | Size: 388 KiB |
BIN
fastlane/screenshots/en_US/2_65.png
Normal file
After Width: | Height: | Size: 450 KiB |
BIN
fastlane/screenshots/en_US/3_55.png
Normal file
After Width: | Height: | Size: 385 KiB |
BIN
fastlane/screenshots/en_US/3_65.png
Normal file
After Width: | Height: | Size: 476 KiB |
BIN
fastlane/screenshots/zh-Hans/0_55.png
Normal file
After Width: | Height: | Size: 562 KiB |
BIN
fastlane/screenshots/zh-Hans/0_65.png
Normal file
After Width: | Height: | Size: 723 KiB |
BIN
fastlane/screenshots/zh-Hans/1_55.png
Normal file
After Width: | Height: | Size: 368 KiB |
BIN
fastlane/screenshots/zh-Hans/1_65.png
Normal file
After Width: | Height: | Size: 475 KiB |
BIN
fastlane/screenshots/zh-Hans/2_55.png
Normal file
After Width: | Height: | Size: 393 KiB |
BIN
fastlane/screenshots/zh-Hans/2_65.png
Normal file
After Width: | Height: | Size: 457 KiB |
BIN
fastlane/screenshots/zh-Hans/3_55.png
Normal file
After Width: | Height: | Size: 391 KiB |
BIN
fastlane/screenshots/zh-Hans/3_65.png
Normal file
After Width: | Height: | Size: 481 KiB |
@ -31,6 +31,7 @@ const ComponentAccount: React.FC<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityRole='button'
|
||||||
style={[styles.itemDefault, styles.itemAccount]}
|
style={[styles.itemDefault, styles.itemAccount]}
|
||||||
onPress={customOnPress || onPress}
|
onPress={customOnPress || onPress}
|
||||||
>
|
>
|
||||||
|
@ -4,6 +4,7 @@ import layoutAnimation from '@utils/styles/layoutAnimation'
|
|||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useEffect, useMemo, useRef } from 'react'
|
import React, { useEffect, useMemo, useRef } from 'react'
|
||||||
import {
|
import {
|
||||||
|
AccessibilityProps,
|
||||||
Pressable,
|
Pressable,
|
||||||
StyleProp,
|
StyleProp,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
@ -14,15 +15,18 @@ import {
|
|||||||
import { Flow } from 'react-native-animated-spinkit'
|
import { Flow } from 'react-native-animated-spinkit'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
accessibilityLabel?: AccessibilityProps['accessibilityLabel']
|
||||||
|
accessibilityHint?: AccessibilityProps['accessibilityHint']
|
||||||
|
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
|
|
||||||
type: 'icon' | 'text'
|
type: 'icon' | 'text'
|
||||||
content: string
|
content: string
|
||||||
|
|
||||||
|
selected?: boolean
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
destructive?: boolean
|
destructive?: boolean
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
active?: boolean
|
|
||||||
|
|
||||||
strokeWidth?: number
|
strokeWidth?: number
|
||||||
size?: 'S' | 'M' | 'L'
|
size?: 'S' | 'M' | 'L'
|
||||||
@ -34,13 +38,15 @@ export interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Button: React.FC<Props> = ({
|
const Button: React.FC<Props> = ({
|
||||||
|
accessibilityLabel,
|
||||||
|
accessibilityHint,
|
||||||
style: customStyle,
|
style: customStyle,
|
||||||
type,
|
type,
|
||||||
content,
|
content,
|
||||||
|
selected,
|
||||||
loading = false,
|
loading = false,
|
||||||
destructive = false,
|
destructive = false,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
active = false,
|
|
||||||
strokeWidth,
|
strokeWidth,
|
||||||
size = 'M',
|
size = 'M',
|
||||||
spacing = 'S',
|
spacing = 'S',
|
||||||
@ -57,7 +63,7 @@ const Button: React.FC<Props> = ({
|
|||||||
} else {
|
} else {
|
||||||
mounted.current = true
|
mounted.current = true
|
||||||
}
|
}
|
||||||
}, [content, loading, disabled, active])
|
}, [content, loading, disabled])
|
||||||
|
|
||||||
const loadingSpinkit = useMemo(
|
const loadingSpinkit = useMemo(
|
||||||
() => (
|
() => (
|
||||||
@ -68,40 +74,22 @@ const Button: React.FC<Props> = ({
|
|||||||
[mode]
|
[mode]
|
||||||
)
|
)
|
||||||
|
|
||||||
const colorContent = useMemo(() => {
|
const mainColor = useMemo(() => {
|
||||||
if (active) {
|
if (selected) {
|
||||||
return theme.blue
|
return theme.blue
|
||||||
|
} else if (overlay) {
|
||||||
|
return theme.primaryOverlay
|
||||||
|
} else if (disabled || loading) {
|
||||||
|
return theme.disabled
|
||||||
} else {
|
} else {
|
||||||
if (overlay) {
|
if (destructive) {
|
||||||
return theme.primaryOverlay
|
return theme.red
|
||||||
} else {
|
} else {
|
||||||
if (disabled) {
|
return theme.primaryDefault
|
||||||
return theme.secondary
|
|
||||||
} else {
|
|
||||||
if (destructive) {
|
|
||||||
return theme.red
|
|
||||||
} else {
|
|
||||||
return theme.primaryDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [mode, disabled])
|
}, [mode, disabled, loading, selected])
|
||||||
const colorBorder = useMemo(() => {
|
|
||||||
if (active) {
|
|
||||||
return theme.blue
|
|
||||||
} else {
|
|
||||||
if (disabled || loading) {
|
|
||||||
return theme.secondary
|
|
||||||
} else {
|
|
||||||
if (destructive) {
|
|
||||||
return theme.red
|
|
||||||
} else {
|
|
||||||
return theme.primaryDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [mode, loading, disabled])
|
|
||||||
const colorBackground = useMemo(() => {
|
const colorBackground = useMemo(() => {
|
||||||
if (overlay) {
|
if (overlay) {
|
||||||
return theme.backgroundOverlayInvert
|
return theme.backgroundOverlayInvert
|
||||||
@ -117,7 +105,7 @@ const Button: React.FC<Props> = ({
|
|||||||
<>
|
<>
|
||||||
<Icon
|
<Icon
|
||||||
name={content}
|
name={content}
|
||||||
color={colorContent}
|
color={mainColor}
|
||||||
strokeWidth={strokeWidth}
|
strokeWidth={strokeWidth}
|
||||||
style={{ opacity: loading ? 0 : 1 }}
|
style={{ opacity: loading ? 0 : 1 }}
|
||||||
size={StyleConstants.Font.Size[size] * (size === 'L' ? 1.25 : 1)}
|
size={StyleConstants.Font.Size[size] * (size === 'L' ? 1.25 : 1)}
|
||||||
@ -130,7 +118,7 @@ const Button: React.FC<Props> = ({
|
|||||||
<>
|
<>
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
color: colorContent,
|
color: mainColor,
|
||||||
fontSize:
|
fontSize:
|
||||||
StyleConstants.Font.Size[size] * (size === 'L' ? 1.25 : 1),
|
StyleConstants.Font.Size[size] * (size === 'L' ? 1.25 : 1),
|
||||||
fontWeight: destructive
|
fontWeight: destructive
|
||||||
@ -145,7 +133,7 @@ const Button: React.FC<Props> = ({
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}, [mode, content, loading, disabled, active])
|
}, [mode, content, loading, disabled])
|
||||||
|
|
||||||
enum spacingMapping {
|
enum spacingMapping {
|
||||||
XS = 'S',
|
XS = 'S',
|
||||||
@ -156,11 +144,20 @@ const Button: React.FC<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessible
|
||||||
|
accessibilityLabel={accessibilityLabel}
|
||||||
|
accessibilityHint={accessibilityHint}
|
||||||
|
accessibilityRole='button'
|
||||||
|
accessibilityState={{
|
||||||
|
selected,
|
||||||
|
disabled: disabled || selected,
|
||||||
|
busy: loading
|
||||||
|
}}
|
||||||
style={[
|
style={[
|
||||||
styles.button,
|
styles.button,
|
||||||
{
|
{
|
||||||
borderWidth: overlay ? 0 : 1,
|
borderWidth: overlay ? 0 : 1,
|
||||||
borderColor: colorBorder,
|
borderColor: mainColor,
|
||||||
backgroundColor: colorBackground,
|
backgroundColor: colorBackground,
|
||||||
paddingVertical: StyleConstants.Spacing[spacing],
|
paddingVertical: StyleConstants.Spacing[spacing],
|
||||||
paddingHorizontal:
|
paddingHorizontal:
|
||||||
@ -171,7 +168,7 @@ const Button: React.FC<Props> = ({
|
|||||||
testID='base'
|
testID='base'
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
children={children}
|
children={children}
|
||||||
disabled={disabled || active || loading}
|
disabled={selected || disabled || loading}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useCallback, useMemo, useRef, useState } from 'react'
|
import React, { useCallback, useMemo, useRef, useState } from 'react'
|
||||||
import {
|
import {
|
||||||
|
AccessibilityProps,
|
||||||
Image,
|
Image,
|
||||||
ImageStyle,
|
ImageStyle,
|
||||||
Pressable,
|
Pressable,
|
||||||
StyleProp,
|
StyleProp,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
|
View,
|
||||||
ViewStyle
|
ViewStyle
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import { Blurhash } from 'react-native-blurhash'
|
import { Blurhash } from 'react-native-blurhash'
|
||||||
@ -17,6 +19,9 @@ import { Blurhash } from 'react-native-blurhash'
|
|||||||
// preview, original, remote -> first show preview, then original, if original failed, then remote
|
// preview, original, remote -> first show preview, then original, if original failed, then remote
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
accessibilityLabel?: AccessibilityProps['accessibilityLabel']
|
||||||
|
accessibilityHint?: AccessibilityProps['accessibilityHint']
|
||||||
|
|
||||||
hidden?: boolean
|
hidden?: boolean
|
||||||
uri: { preview?: string; original?: string; remote?: string }
|
uri: { preview?: string; original?: string; remote?: string }
|
||||||
blurhash?: string
|
blurhash?: string
|
||||||
@ -35,6 +40,8 @@ export interface Props {
|
|||||||
|
|
||||||
const GracefullyImage = React.memo(
|
const GracefullyImage = React.memo(
|
||||||
({
|
({
|
||||||
|
accessibilityLabel,
|
||||||
|
accessibilityHint,
|
||||||
hidden = false,
|
hidden = false,
|
||||||
uri,
|
uri,
|
||||||
blurhash,
|
blurhash,
|
||||||
@ -94,13 +101,30 @@ const GracefullyImage = React.memo(
|
|||||||
[source]
|
[source]
|
||||||
)
|
)
|
||||||
const blurhashView = useMemo(() => {
|
const blurhashView = useMemo(() => {
|
||||||
return blurhash && (hidden || !imageLoaded) ? (
|
if (hidden || !imageLoaded) {
|
||||||
<Blurhash decodeAsync blurhash={blurhash} style={styles.blurhash} />
|
if (blurhash) {
|
||||||
) : null
|
return (
|
||||||
|
<Blurhash decodeAsync blurhash={blurhash} style={styles.blurhash} />
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={[styles.blurhash, { backgroundColor: theme.disabled }]}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
}, [hidden, imageLoaded])
|
}, [hidden, imageLoaded])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
{...(onPress
|
||||||
|
? { accessibilityRole: 'imagebutton' }
|
||||||
|
: { accessibilityRole: 'image' })}
|
||||||
|
accessibilityLabel={accessibilityLabel}
|
||||||
|
accessibilityHint={accessibilityHint}
|
||||||
style={[style, dimension, { backgroundColor: theme.shimmerDefault }]}
|
style={[style, dimension, { backgroundColor: theme.shimmerDefault }]}
|
||||||
{...(onPress
|
{...(onPress
|
||||||
? hidden
|
? hidden
|
||||||
|
@ -28,7 +28,11 @@ const ComponentHashtag: React.FC<Props> = ({
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable style={styles.itemDefault} onPress={customOnPress || onPress}>
|
<Pressable
|
||||||
|
accessibilityRole='button'
|
||||||
|
style={styles.itemDefault}
|
||||||
|
onPress={customOnPress || onPress}
|
||||||
|
>
|
||||||
<Text style={[styles.itemHashtag, { color: theme.primaryDefault }]}>
|
<Text style={[styles.itemHashtag, { color: theme.primaryDefault }]}>
|
||||||
#{hashtag.name}
|
#{hashtag.name}
|
||||||
</Text>
|
</Text>
|
||||||
|
@ -2,10 +2,20 @@ import Icon from '@components/Icon'
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useMemo } from 'react'
|
import React, { useMemo } from 'react'
|
||||||
import { Pressable, StyleSheet, Text, View } from 'react-native'
|
import {
|
||||||
|
AccessibilityProps,
|
||||||
|
Pressable,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
View
|
||||||
|
} from 'react-native'
|
||||||
import { Flow } from 'react-native-animated-spinkit'
|
import { Flow } from 'react-native-animated-spinkit'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
accessibilityLabel?: string
|
||||||
|
accessibilityHint?: string
|
||||||
|
accessibilityState?: AccessibilityProps['accessibilityState']
|
||||||
|
|
||||||
type?: 'icon' | 'text'
|
type?: 'icon' | 'text'
|
||||||
content: string
|
content: string
|
||||||
native?: boolean
|
native?: boolean
|
||||||
@ -18,6 +28,11 @@ export interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const HeaderRight: React.FC<Props> = ({
|
const HeaderRight: React.FC<Props> = ({
|
||||||
|
// Accessibility - Start
|
||||||
|
accessibilityLabel,
|
||||||
|
accessibilityHint,
|
||||||
|
accessibilityState,
|
||||||
|
// Accessibility - End
|
||||||
type = 'icon',
|
type = 'icon',
|
||||||
content,
|
content,
|
||||||
native = true,
|
native = true,
|
||||||
@ -75,6 +90,10 @@ const HeaderRight: React.FC<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityLabel={accessibilityLabel}
|
||||||
|
accessibilityHint={accessibilityHint}
|
||||||
|
accessibilityRole='button'
|
||||||
|
accessibilityState={accessibilityState}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
children={children}
|
children={children}
|
||||||
disabled={disabled || loading}
|
disabled={disabled || loading}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import React, { createElement } from 'react'
|
import React, { createElement } from 'react'
|
||||||
import { StyleProp, View, ViewStyle } from 'react-native'
|
import { AccessibilityProps, StyleProp, View, ViewStyle } from 'react-native'
|
||||||
import * as FeatherIcon from 'react-native-feather'
|
import * as FeatherIcon from 'react-native-feather'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
accessibilityLabel?: AccessibilityProps['accessibilityLabel']
|
||||||
|
|
||||||
name: string
|
name: string
|
||||||
size: number
|
size: number
|
||||||
color: string
|
color: string
|
||||||
@ -12,6 +14,7 @@ export interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Icon: React.FC<Props> = ({
|
const Icon: React.FC<Props> = ({
|
||||||
|
accessibilityLabel,
|
||||||
name,
|
name,
|
||||||
size,
|
size,
|
||||||
color,
|
color,
|
||||||
@ -21,6 +24,7 @@ const Icon: React.FC<Props> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
accessibilityLabel={accessibilityLabel}
|
||||||
style={[
|
style={[
|
||||||
style,
|
style,
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import Button from '@components/Button'
|
import Button from '@components/Button'
|
||||||
import Icon from '@components/Icon'
|
import Icon from '@components/Icon'
|
||||||
|
import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
|
||||||
import { useAppsQuery } from '@utils/queryHooks/apps'
|
import { useAppsQuery } from '@utils/queryHooks/apps'
|
||||||
import { useInstanceQuery } from '@utils/queryHooks/instance'
|
import { useInstanceQuery } from '@utils/queryHooks/instance'
|
||||||
import { getInstances } from '@utils/slices/instancesSlice'
|
import { getInstances } from '@utils/slices/instancesSlice'
|
||||||
@ -7,7 +8,7 @@ import { StyleConstants } from '@utils/styles/constants'
|
|||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import * as WebBrowser from 'expo-web-browser'
|
import * as WebBrowser from 'expo-web-browser'
|
||||||
import { debounce } from 'lodash'
|
import { debounce } from 'lodash'
|
||||||
import React, { useCallback, useMemo, useState } from 'react'
|
import React, { RefObject, useCallback, useMemo, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
@ -19,6 +20,7 @@ import {
|
|||||||
TextInput,
|
TextInput,
|
||||||
View
|
View
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
|
import { ScrollView } from 'react-native-gesture-handler'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
import { Placeholder } from 'rn-placeholder'
|
import { Placeholder } from 'rn-placeholder'
|
||||||
import analytics from './analytics'
|
import analytics from './analytics'
|
||||||
@ -26,16 +28,19 @@ import InstanceAuth from './Instance/Auth'
|
|||||||
import InstanceInfo from './Instance/Info'
|
import InstanceInfo from './Instance/Info'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
scrollViewRef?: RefObject<ScrollView>
|
||||||
disableHeaderImage?: boolean
|
disableHeaderImage?: boolean
|
||||||
goBack?: boolean
|
goBack?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const ComponentInstance: React.FC<Props> = ({
|
const ComponentInstance: React.FC<Props> = ({
|
||||||
|
scrollViewRef,
|
||||||
disableHeaderImage,
|
disableHeaderImage,
|
||||||
goBack = false
|
goBack = false
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation('componentInstance')
|
const { t } = useTranslation('componentInstance')
|
||||||
const { mode, theme } = useTheme()
|
const { mode, theme } = useTheme()
|
||||||
|
const { screenReaderEnabled } = useAccessibility()
|
||||||
|
|
||||||
const instances = useSelector(getInstances, () => true)
|
const instances = useSelector(getInstances, () => true)
|
||||||
const [domain, setDomain] = useState<string>()
|
const [domain, setDomain] = useState<string>()
|
||||||
@ -139,6 +144,8 @@ const ComponentInstance: React.FC<Props> = ({
|
|||||||
<View style={styles.base}>
|
<View style={styles.base}>
|
||||||
<View style={styles.inputRow}>
|
<View style={styles.inputRow}>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
accessible={false}
|
||||||
|
accessibilityRole='none'
|
||||||
style={[
|
style={[
|
||||||
styles.prefix,
|
styles.prefix,
|
||||||
{
|
{
|
||||||
@ -148,12 +155,8 @@ const ComponentInstance: React.FC<Props> = ({
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
editable={false}
|
editable={false}
|
||||||
children={
|
placeholder='https://'
|
||||||
<Text
|
placeholderTextColor={theme.primaryDefault}
|
||||||
style={{ color: theme.primaryDefault }}
|
|
||||||
children='https://'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={[
|
style={[
|
||||||
@ -172,10 +175,14 @@ const ComponentInstance: React.FC<Props> = ({
|
|||||||
keyboardType='url'
|
keyboardType='url'
|
||||||
textContentType='URL'
|
textContentType='URL'
|
||||||
onSubmitEditing={onSubmitEditing}
|
onSubmitEditing={onSubmitEditing}
|
||||||
placeholder={t('server.textInput.placeholder')}
|
placeholder={' ' + t('server.textInput.placeholder')}
|
||||||
placeholderTextColor={theme.secondary}
|
placeholderTextColor={theme.secondary}
|
||||||
returnKeyType='go'
|
returnKeyType='go'
|
||||||
keyboardAppearance={mode}
|
keyboardAppearance={mode}
|
||||||
|
{...(scrollViewRef && {
|
||||||
|
onFocus: () =>
|
||||||
|
setTimeout(() => scrollViewRef.current?.scrollToEnd(), 150)
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
type='text'
|
type='text'
|
||||||
@ -229,9 +236,21 @@ const ComponentInstance: React.FC<Props> = ({
|
|||||||
color={theme.secondary}
|
color={theme.secondary}
|
||||||
style={styles.disclaimerIcon}
|
style={styles.disclaimerIcon}
|
||||||
/>
|
/>
|
||||||
<Text style={[styles.disclaimerText, { color: theme.secondary }]}>
|
<Text
|
||||||
|
style={[styles.disclaimerText, { color: theme.secondary }]}
|
||||||
|
accessibilityRole='link'
|
||||||
|
onPress={() => {
|
||||||
|
if (screenReaderEnabled) {
|
||||||
|
analytics('view_privacy')
|
||||||
|
WebBrowser.openBrowserAsync(
|
||||||
|
'https://tooot.app/privacy-policy'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
{t('server.disclaimer.base')}
|
{t('server.disclaimer.base')}
|
||||||
<Text
|
<Text
|
||||||
|
accessible
|
||||||
style={{ color: theme.blue }}
|
style={{ color: theme.blue }}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
analytics('view_privacy')
|
analytics('view_privacy')
|
||||||
@ -265,8 +284,7 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
prefix: {
|
prefix: {
|
||||||
borderBottomWidth: 1,
|
borderBottomWidth: 1,
|
||||||
...StyleConstants.FontStyle.M,
|
...StyleConstants.FontStyle.M
|
||||||
paddingRight: StyleConstants.Spacing.XS
|
|
||||||
},
|
},
|
||||||
textInput: {
|
textInput: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
@ -16,8 +16,10 @@ const InstanceInfo = React.memo(
|
|||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.base, style]}>
|
<View style={[styles.base, style]} accessible>
|
||||||
<Text style={[styles.header, { color: theme.primaryDefault }]}>{header}</Text>
|
<Text style={[styles.header, { color: theme.primaryDefault }]}>
|
||||||
|
{header}
|
||||||
|
</Text>
|
||||||
{content ? (
|
{content ? (
|
||||||
<Text style={[styles.content, { color: theme.primaryDefault }]}>
|
<Text style={[styles.content, { color: theme.primaryDefault }]}>
|
||||||
{content}
|
{content}
|
||||||
|
@ -7,7 +7,11 @@ export interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MenuContainer: React.FC<Props> = ({ children }) => {
|
const MenuContainer: React.FC<Props> = ({ children }) => {
|
||||||
return <View style={styles.base}>{children}</View>
|
return (
|
||||||
|
<View style={styles.base}>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import Icon from '@components/Icon'
|
import Icon from '@components/Icon'
|
||||||
|
import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import { ColorDefinitions } from '@utils/styles/themes'
|
import { ColorDefinitions } from '@utils/styles/themes'
|
||||||
@ -41,6 +42,7 @@ const MenuRow: React.FC<Props> = ({
|
|||||||
onPress
|
onPress
|
||||||
}) => {
|
}) => {
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
const { screenReaderEnabled } = useAccessibility()
|
||||||
|
|
||||||
const loadingSpinkit = useMemo(
|
const loadingSpinkit = useMemo(
|
||||||
() => (
|
() => (
|
||||||
@ -55,11 +57,22 @@ const MenuRow: React.FC<Props> = ({
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.base}>
|
<View
|
||||||
|
style={styles.base}
|
||||||
|
accessible
|
||||||
|
accessibilityRole={switchValue ? 'switch' : 'button'}
|
||||||
|
accessibilityState={switchValue ? { checked: switchValue } : undefined}
|
||||||
|
>
|
||||||
<TapGestureHandler
|
<TapGestureHandler
|
||||||
onHandlerStateChange={({ nativeEvent }) =>
|
onHandlerStateChange={async ({ nativeEvent }) => {
|
||||||
nativeEvent.state === State.ACTIVE && !loading && onPress && onPress()
|
if (nativeEvent.state === State.ACTIVE && !loading) {
|
||||||
}
|
if (screenReaderEnabled && switchOnValueChange) {
|
||||||
|
switchOnValueChange()
|
||||||
|
} else {
|
||||||
|
if (onPress) onPress()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<View style={styles.core}>
|
<View style={styles.core}>
|
||||||
<View style={styles.front}>
|
<View style={styles.front}>
|
||||||
|
@ -3,6 +3,7 @@ import { StyleConstants } from '@utils/styles/constants'
|
|||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import { getTheme } from '@utils/styles/themes'
|
import { getTheme } from '@utils/styles/themes'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { AccessibilityInfo } from 'react-native'
|
||||||
import FlashMessage, {
|
import FlashMessage, {
|
||||||
hideMessage,
|
hideMessage,
|
||||||
showMessage
|
showMessage
|
||||||
@ -36,6 +37,8 @@ const displayMessage = ({
|
|||||||
mode: 'light' | 'dark'
|
mode: 'light' | 'dark'
|
||||||
type: 'success' | 'error' | 'warning'
|
type: 'success' | 'error' | 'warning'
|
||||||
}) => {
|
}) => {
|
||||||
|
AccessibilityInfo.announceForAccessibility(message + '.' + description)
|
||||||
|
|
||||||
enum iconMapping {
|
enum iconMapping {
|
||||||
success = 'CheckCircle',
|
success = 'CheckCircle',
|
||||||
error = 'XCircle',
|
error = 'XCircle',
|
||||||
@ -98,7 +101,10 @@ const Message = React.memo(
|
|||||||
...StyleConstants.FontStyle.M,
|
...StyleConstants.FontStyle.M,
|
||||||
fontWeight: StyleConstants.Font.Weight.Bold
|
fontWeight: StyleConstants.Font.Weight.Bold
|
||||||
}}
|
}}
|
||||||
textStyle={{ color: theme.primaryDefault, ...StyleConstants.FontStyle.S }}
|
textStyle={{
|
||||||
|
color: theme.primaryDefault,
|
||||||
|
...StyleConstants.FontStyle.S
|
||||||
|
}}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
textProps={{ numberOfLines: 2 }}
|
textProps={{ numberOfLines: 2 }}
|
||||||
/>
|
/>
|
||||||
|
@ -4,6 +4,7 @@ import { StyleConstants } from '@utils/styles/constants'
|
|||||||
import { adaptiveScale } from '@utils/styles/scaling'
|
import { adaptiveScale } from '@utils/styles/scaling'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useMemo } from 'react'
|
import React, { useMemo } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
import { StyleSheet, Text } from 'react-native'
|
import { StyleSheet, Text } from 'react-native'
|
||||||
import FastImage from 'react-native-fast-image'
|
import FastImage from 'react-native-fast-image'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
@ -27,6 +28,7 @@ const ParseEmojis = React.memo(
|
|||||||
adaptiveSize = false,
|
adaptiveSize = false,
|
||||||
fontBold = false
|
fontBold = false
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
|
const { t } = useTranslation('componentParse')
|
||||||
const { reduceMotionEnabled } = useAccessibility()
|
const { reduceMotionEnabled } = useAccessibility()
|
||||||
|
|
||||||
const adaptiveFontsize = useSelector(getSettingsFontsize)
|
const adaptiveFontsize = useSelector(getSettingsFontsize)
|
||||||
@ -69,10 +71,10 @@ const ParseEmojis = React.memo(
|
|||||||
return emojiShortcode === `:${emoji.shortcode}:`
|
return emojiShortcode === `:${emoji.shortcode}:`
|
||||||
})
|
})
|
||||||
if (emojiIndex === -1) {
|
if (emojiIndex === -1) {
|
||||||
return <Text>{emojiShortcode}</Text>
|
return <Text key={emojiShortcode + i}>{emojiShortcode}</Text>
|
||||||
} else {
|
} else {
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
return <Text key={emojiShortcode}> </Text>
|
return <Text key={emojiShortcode + i}> </Text>
|
||||||
} else {
|
} else {
|
||||||
const uri = reduceMotionEnabled
|
const uri = reduceMotionEnabled
|
||||||
? emojis[emojiIndex].static_url
|
? emojis[emojiIndex].static_url
|
||||||
@ -80,7 +82,7 @@ const ParseEmojis = React.memo(
|
|||||||
if (validUrl.isHttpsUri(uri)) {
|
if (validUrl.isHttpsUri(uri)) {
|
||||||
return (
|
return (
|
||||||
<FastImage
|
<FastImage
|
||||||
key={emojiShortcode}
|
key={emojiShortcode + i}
|
||||||
source={{ uri }}
|
source={{ uri }}
|
||||||
style={styles.image}
|
style={styles.image}
|
||||||
/>
|
/>
|
||||||
@ -91,7 +93,7 @@ const ParseEmojis = React.memo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return <Text key={str}>{str}</Text>
|
return <Text key={i}>{str}</Text>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
) : (
|
) : (
|
||||||
|
@ -53,6 +53,7 @@ const renderNode = ({
|
|||||||
: true
|
: true
|
||||||
return (
|
return (
|
||||||
<Text
|
<Text
|
||||||
|
accessible
|
||||||
key={index}
|
key={index}
|
||||||
style={{
|
style={{
|
||||||
color: theme.blue,
|
color: theme.blue,
|
||||||
@ -235,7 +236,10 @@ const ParseHTML = React.memo(
|
|||||||
const [expanded, setExpanded] = useState(false)
|
const [expanded, setExpanded] = useState(false)
|
||||||
|
|
||||||
const onTextLayout = useCallback(({ nativeEvent }) => {
|
const onTextLayout = useCallback(({ nativeEvent }) => {
|
||||||
if (nativeEvent.lines.length >= numberOfLines + 5) {
|
if (
|
||||||
|
numberOfLines === 0 ||
|
||||||
|
nativeEvent.lines.length >= numberOfLines + 5
|
||||||
|
) {
|
||||||
setExpandAllow(true)
|
setExpandAllow(true)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
@ -251,6 +255,7 @@ const ParseHTML = React.memo(
|
|||||||
/>
|
/>
|
||||||
{expandAllow ? (
|
{expandAllow ? (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityLabel=''
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
analytics('status_readmore', { allow: expandAllow, expanded })
|
analytics('status_readmore', { allow: expandAllow, expanded })
|
||||||
layoutAnimation()
|
layoutAnimation()
|
||||||
|
@ -62,6 +62,7 @@ const TimelineDefault: React.FC<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessible={highlighted ? false : true}
|
||||||
style={[
|
style={[
|
||||||
styles.statusView,
|
styles.statusView,
|
||||||
{
|
{
|
||||||
@ -84,6 +85,7 @@ const TimelineDefault: React.FC<Props> = ({
|
|||||||
<TimelineAvatar
|
<TimelineAvatar
|
||||||
queryKey={disableOnPress ? undefined : queryKey}
|
queryKey={disableOnPress ? undefined : queryKey}
|
||||||
account={actualStatus.account}
|
account={actualStatus.account}
|
||||||
|
highlighted={highlighted}
|
||||||
/>
|
/>
|
||||||
<TimelineHeaderDefault
|
<TimelineHeaderDefault
|
||||||
queryKey={disableOnPress ? undefined : queryKey}
|
queryKey={disableOnPress ? undefined : queryKey}
|
||||||
|
@ -84,7 +84,11 @@ const TimelineNotifications: React.FC<Props> = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<TimelineAvatar queryKey={queryKey} account={actualAccount} />
|
<TimelineAvatar
|
||||||
|
queryKey={queryKey}
|
||||||
|
account={actualAccount}
|
||||||
|
highlighted={highlighted}
|
||||||
|
/>
|
||||||
<TimelineHeaderNotification
|
<TimelineHeaderNotification
|
||||||
queryKey={queryKey}
|
queryKey={queryKey}
|
||||||
notification={notification}
|
notification={notification}
|
||||||
|
@ -269,12 +269,28 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
>
|
>
|
||||||
<View style={styles.actions}>
|
<View style={styles.actions}>
|
||||||
<Pressable
|
<Pressable
|
||||||
|
{...(highlighted
|
||||||
|
? {
|
||||||
|
accessibilityLabel: t(
|
||||||
|
'shared.actions.reply.accessibilityLabel'
|
||||||
|
),
|
||||||
|
accessibilityRole: 'button'
|
||||||
|
}
|
||||||
|
: { accessibilityLabel: '' })}
|
||||||
style={styles.action}
|
style={styles.action}
|
||||||
onPress={onPressReply}
|
onPress={onPressReply}
|
||||||
children={childrenReply}
|
children={childrenReply}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Pressable
|
<Pressable
|
||||||
|
{...(highlighted
|
||||||
|
? {
|
||||||
|
accessibilityLabel: t(
|
||||||
|
'shared.actions.reblogged.accessibilityLabel'
|
||||||
|
),
|
||||||
|
accessibilityRole: 'button'
|
||||||
|
}
|
||||||
|
: { accessibilityLabel: '' })}
|
||||||
style={styles.action}
|
style={styles.action}
|
||||||
onPress={onPressReblog}
|
onPress={onPressReblog}
|
||||||
children={childrenReblog}
|
children={childrenReblog}
|
||||||
@ -284,12 +300,28 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Pressable
|
<Pressable
|
||||||
|
{...(highlighted
|
||||||
|
? {
|
||||||
|
accessibilityLabel: t(
|
||||||
|
'shared.actions.favourited.accessibilityLabel'
|
||||||
|
),
|
||||||
|
accessibilityRole: 'button'
|
||||||
|
}
|
||||||
|
: { accessibilityLabel: '' })}
|
||||||
style={styles.action}
|
style={styles.action}
|
||||||
onPress={onPressFavourite}
|
onPress={onPressFavourite}
|
||||||
children={childrenFavourite}
|
children={childrenFavourite}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Pressable
|
<Pressable
|
||||||
|
{...(highlighted
|
||||||
|
? {
|
||||||
|
accessibilityLabel: t(
|
||||||
|
'shared.actions.bookmarked.accessibilityLabel'
|
||||||
|
),
|
||||||
|
accessibilityRole: 'button'
|
||||||
|
}
|
||||||
|
: { accessibilityLabel: '' })}
|
||||||
style={styles.action}
|
style={styles.action}
|
||||||
onPress={onPressBookmark}
|
onPress={onPressBookmark}
|
||||||
children={childrenBookmark}
|
children={childrenBookmark}
|
||||||
|
@ -28,6 +28,16 @@ const TimelineActionsUsers = React.memo(
|
|||||||
<View style={styles.base}>
|
<View style={styles.base}>
|
||||||
{status.reblogs_count > 0 ? (
|
{status.reblogs_count > 0 ? (
|
||||||
<Text
|
<Text
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'shared.actionsUsers.reblogged_by.accessibilityLabel',
|
||||||
|
{
|
||||||
|
count: status.reblogs_count
|
||||||
|
}
|
||||||
|
)}
|
||||||
|
accessibilityHint={t(
|
||||||
|
'shared.actionsUsers.reblogged_by.accessibilityHint'
|
||||||
|
)}
|
||||||
|
accessibilityRole='button'
|
||||||
style={[styles.text, { color: theme.secondary }]}
|
style={[styles.text, { color: theme.secondary }]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
analytics('timeline_shared_actionsusers_press_boosted', {
|
analytics('timeline_shared_actionsusers_press_boosted', {
|
||||||
@ -41,13 +51,23 @@ const TimelineActionsUsers = React.memo(
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('shared.actionsUsers.reblogged_by', {
|
{t('shared.actionsUsers.reblogged_by.text', {
|
||||||
count: status.reblogs_count
|
count: status.reblogs_count
|
||||||
})}
|
})}
|
||||||
</Text>
|
</Text>
|
||||||
) : null}
|
) : null}
|
||||||
{status.favourites_count > 0 ? (
|
{status.favourites_count > 0 ? (
|
||||||
<Text
|
<Text
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'shared.actionsUsers.favourited_by.accessibilityLabel',
|
||||||
|
{
|
||||||
|
count: status.reblogs_count
|
||||||
|
}
|
||||||
|
)}
|
||||||
|
accessibilityHint={t(
|
||||||
|
'shared.actionsUsers.favourited_by.accessibilityHint'
|
||||||
|
)}
|
||||||
|
accessibilityRole='button'
|
||||||
style={[styles.text, { color: theme.secondary }]}
|
style={[styles.text, { color: theme.secondary }]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
analytics('timeline_shared_actionsusers_press_boosted', {
|
analytics('timeline_shared_actionsusers_press_boosted', {
|
||||||
@ -61,7 +81,7 @@ const TimelineActionsUsers = React.memo(
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('shared.actionsUsers.favourited_by', {
|
{t('shared.actionsUsers.favourited_by.text', {
|
||||||
count: status.favourites_count
|
count: status.favourites_count
|
||||||
})}
|
})}
|
||||||
</Text>
|
</Text>
|
||||||
|
@ -52,6 +52,7 @@ const AttachmentAudio: React.FC<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
accessibilityLabel={audio.description}
|
||||||
style={[
|
style={[
|
||||||
styles.base,
|
styles.base,
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@ const AttachmentImage = React.memo(
|
|||||||
return (
|
return (
|
||||||
<View style={styles.base}>
|
<View style={styles.base}>
|
||||||
<GracefullyImage
|
<GracefullyImage
|
||||||
|
accessibilityLabel={image.description}
|
||||||
hidden={sensitiveShown}
|
hidden={sensitiveShown}
|
||||||
uri={{ original: image.preview_url, remote: image.remote_url }}
|
uri={{ original: image.preview_url, remote: image.remote_url }}
|
||||||
blurhash={image.blurhash}
|
blurhash={image.blurhash}
|
||||||
|
@ -47,7 +47,11 @@ const AttachmentUnsupported: React.FC<Props> = ({
|
|||||||
<Text
|
<Text
|
||||||
style={[
|
style={[
|
||||||
styles.text,
|
styles.text,
|
||||||
{ color: attachment.blurhash ? theme.backgroundDefault : theme.primaryDefault }
|
{
|
||||||
|
color: attachment.blurhash
|
||||||
|
? theme.backgroundDefault
|
||||||
|
: theme.primaryDefault
|
||||||
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{t('shared.attachment.unsupported.text')}
|
{t('shared.attachment.unsupported.text')}
|
||||||
@ -58,9 +62,9 @@ const AttachmentUnsupported: React.FC<Props> = ({
|
|||||||
content={t('shared.attachment.unsupported.button')}
|
content={t('shared.attachment.unsupported.button')}
|
||||||
size='S'
|
size='S'
|
||||||
overlay
|
overlay
|
||||||
onPress={async () => {
|
onPress={() => {
|
||||||
analytics('timeline_shared_attachment_unsupported_press')
|
analytics('timeline_shared_attachment_unsupported_press')
|
||||||
attachment.remote_url && (await openLink(attachment.remote_url))
|
attachment.remote_url && openLink(attachment.remote_url)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
@ -62,6 +62,7 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Video
|
<Video
|
||||||
|
accessibilityLabel={video.description}
|
||||||
ref={videoPlayer}
|
ref={videoPlayer}
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
@ -5,14 +5,17 @@ import { StackNavigationProp } from '@react-navigation/stack'
|
|||||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import React, { useCallback } from 'react'
|
import React, { useCallback } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
queryKey?: QueryKeyTimeline
|
queryKey?: QueryKeyTimeline
|
||||||
account: Mastodon.Account
|
account: Mastodon.Account
|
||||||
|
highlighted: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const TimelineAvatar = React.memo(
|
const TimelineAvatar = React.memo(
|
||||||
({ queryKey, account }: Props) => {
|
({ queryKey, account, highlighted }: Props) => {
|
||||||
|
const { t } = useTranslation('componentTimeline')
|
||||||
const navigation = useNavigation<
|
const navigation = useNavigation<
|
||||||
StackNavigationProp<Nav.TabLocalStackParamList>
|
StackNavigationProp<Nav.TabLocalStackParamList>
|
||||||
>()
|
>()
|
||||||
@ -26,6 +29,14 @@ const TimelineAvatar = React.memo(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GracefullyImage
|
<GracefullyImage
|
||||||
|
{...(highlighted && {
|
||||||
|
accessibilityLabel: t('shared.avatar.accessibilityLabel', {
|
||||||
|
name: account.display_name
|
||||||
|
}),
|
||||||
|
accessibilityHint: t('shared.avatar.accessibilityHint', {
|
||||||
|
name: account.display_name
|
||||||
|
})
|
||||||
|
})}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
uri={{ original: account.avatar_static }}
|
uri={{ original: account.avatar_static }}
|
||||||
dimension={{
|
dimension={{
|
||||||
@ -35,8 +46,7 @@ const TimelineAvatar = React.memo(
|
|||||||
style={{
|
style={{
|
||||||
borderRadius: StyleConstants.Avatar.M,
|
borderRadius: StyleConstants.Avatar.M,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
marginRight: StyleConstants.Spacing.S,
|
marginRight: StyleConstants.Spacing.S
|
||||||
backgroundColor: 'red'
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
@ -18,6 +18,8 @@ const TimelineCard = React.memo(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessible
|
||||||
|
accessibilityRole='link'
|
||||||
style={[styles.card, { borderColor: theme.border }]}
|
style={[styles.card, { borderColor: theme.border }]}
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
analytics('timeline_shared_card_press')
|
analytics('timeline_shared_card_press')
|
||||||
|
@ -39,7 +39,7 @@ const TimelineContent = React.memo(
|
|||||||
emojis={status.emojis}
|
emojis={status.emojis}
|
||||||
mentions={status.mentions}
|
mentions={status.mentions}
|
||||||
tags={status.tags}
|
tags={status.tags}
|
||||||
numberOfLines={1}
|
numberOfLines={0}
|
||||||
expandHint={t('shared.content.expandHint')}
|
expandHint={t('shared.content.expandHint')}
|
||||||
disableDetails={disableDetails}
|
disableDetails={disableDetails}
|
||||||
/>
|
/>
|
||||||
|
@ -4,6 +4,7 @@ import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Pressable, StyleSheet, View } from 'react-native'
|
import { Pressable, StyleSheet, View } from 'react-native'
|
||||||
import HeaderSharedAccount from './HeaderShared/Account'
|
import HeaderSharedAccount from './HeaderShared/Account'
|
||||||
import HeaderSharedApplication from './HeaderShared/Application'
|
import HeaderSharedApplication from './HeaderShared/Application'
|
||||||
@ -19,6 +20,7 @@ export interface Props {
|
|||||||
|
|
||||||
const TimelineHeaderDefault = React.memo(
|
const TimelineHeaderDefault = React.memo(
|
||||||
({ queryKey, rootQueryKey, status }: Props) => {
|
({ queryKey, rootQueryKey, status }: Props) => {
|
||||||
|
const { t } = useTranslation('componentTimeline')
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation()
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
|
||||||
@ -36,6 +38,7 @@ const TimelineHeaderDefault = React.memo(
|
|||||||
|
|
||||||
{queryKey ? (
|
{queryKey ? (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityHint={t('shared.header.actions.accessibilityHint')}
|
||||||
style={styles.action}
|
style={styles.action}
|
||||||
onPress={() =>
|
onPress={() =>
|
||||||
navigation.navigate('Screen-Actions', {
|
navigation.navigate('Screen-Actions', {
|
||||||
|
@ -2,6 +2,7 @@ import { ParseEmojis } from '@root/components/Parse'
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
import { StyleSheet, Text, View } from 'react-native'
|
import { StyleSheet, Text, View } from 'react-native'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@ -11,12 +12,19 @@ export interface Props {
|
|||||||
|
|
||||||
const HeaderSharedAccount = React.memo(
|
const HeaderSharedAccount = React.memo(
|
||||||
({ account, withoutName = false }: Props) => {
|
({ account, withoutName = false }: Props) => {
|
||||||
|
const { t } = useTranslation('componentTimeline')
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.base}>
|
<View style={styles.base}>
|
||||||
{withoutName ? null : (
|
{withoutName ? null : (
|
||||||
<Text style={styles.name} numberOfLines={1}>
|
<Text
|
||||||
|
accessibilityHint={t(
|
||||||
|
'shared.header.shared.account.name.accessibilityHint'
|
||||||
|
)}
|
||||||
|
style={styles.name}
|
||||||
|
numberOfLines={1}
|
||||||
|
>
|
||||||
<ParseEmojis
|
<ParseEmojis
|
||||||
content={account.display_name || account.username}
|
content={account.display_name || account.username}
|
||||||
emojis={account.emojis}
|
emojis={account.emojis}
|
||||||
@ -25,6 +33,9 @@ const HeaderSharedAccount = React.memo(
|
|||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
<Text
|
<Text
|
||||||
|
accessibilityHint={t(
|
||||||
|
'shared.header.shared.account.account.accessibilityHint'
|
||||||
|
)}
|
||||||
style={[styles.acct, { color: theme.secondary }]}
|
style={[styles.acct, { color: theme.secondary }]}
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
>
|
>
|
||||||
|
@ -17,6 +17,7 @@ const HeaderSharedApplication = React.memo(
|
|||||||
|
|
||||||
return application && application.name !== 'Web' ? (
|
return application && application.name !== 'Web' ? (
|
||||||
<Text
|
<Text
|
||||||
|
accessibilityRole='link'
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
analytics('timeline_shared_header_application_press', {
|
analytics('timeline_shared_header_application_press', {
|
||||||
application
|
application
|
||||||
|
@ -2,6 +2,7 @@ import Icon from '@components/Icon'
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
import { StyleSheet } from 'react-native'
|
import { StyleSheet } from 'react-native'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@ -10,10 +11,12 @@ export interface Props {
|
|||||||
|
|
||||||
const HeaderSharedMuted = React.memo(
|
const HeaderSharedMuted = React.memo(
|
||||||
({ muted }: Props) => {
|
({ muted }: Props) => {
|
||||||
|
const { t } = useTranslation('componentTimeline')
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
|
||||||
return muted ? (
|
return muted ? (
|
||||||
<Icon
|
<Icon
|
||||||
|
accessibilityLabel={t('shared.header.shared.muted.accessibilityLabel')}
|
||||||
name='VolumeX'
|
name='VolumeX'
|
||||||
size={StyleConstants.Font.Size.S}
|
size={StyleConstants.Font.Size.S}
|
||||||
color={theme.secondary}
|
color={theme.secondary}
|
||||||
|
@ -2,6 +2,7 @@ import Icon from '@components/Icon'
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
import { StyleSheet } from 'react-native'
|
import { StyleSheet } from 'react-native'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@ -10,12 +11,16 @@ export interface Props {
|
|||||||
|
|
||||||
const HeaderSharedVisibility = React.memo(
|
const HeaderSharedVisibility = React.memo(
|
||||||
({ visibility }: Props) => {
|
({ visibility }: Props) => {
|
||||||
|
const { t } = useTranslation('componentTimeline')
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
|
||||||
switch (visibility) {
|
switch (visibility) {
|
||||||
case 'private':
|
case 'private':
|
||||||
return (
|
return (
|
||||||
<Icon
|
<Icon
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'shared.header.shared.visibility.private.accessibilityLabel'
|
||||||
|
)}
|
||||||
name='Lock'
|
name='Lock'
|
||||||
size={StyleConstants.Font.Size.S}
|
size={StyleConstants.Font.Size.S}
|
||||||
color={theme.secondary}
|
color={theme.secondary}
|
||||||
@ -25,6 +30,9 @@ const HeaderSharedVisibility = React.memo(
|
|||||||
case 'direct':
|
case 'direct':
|
||||||
return (
|
return (
|
||||||
<Icon
|
<Icon
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'shared.header.shared.visibility.direct.accessibilityLabel'
|
||||||
|
)}
|
||||||
name='Mail'
|
name='Mail'
|
||||||
size={StyleConstants.Font.Size.S}
|
size={StyleConstants.Font.Size.S}
|
||||||
color={theme.secondary}
|
color={theme.secondary}
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
"apply": "Apply",
|
"apply": "Apply",
|
||||||
"cancel": "Cancel"
|
"cancel": "Cancel"
|
||||||
},
|
},
|
||||||
|
"customEmoji": {
|
||||||
|
"accessibilityLabel": "Custom emoji {{emoji}}"
|
||||||
|
},
|
||||||
"message": {
|
"message": {
|
||||||
"success": {
|
"success": {
|
||||||
"message": "{{function}} succeed"
|
"message": "{{function}} succeed"
|
||||||
|
@ -29,19 +29,33 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"favourited": {
|
"reply": {
|
||||||
"function": "Favourite toot"
|
"accessibilityLabel": "Reply to this toot"
|
||||||
},
|
},
|
||||||
"reblogged": {
|
"reblogged": {
|
||||||
|
"accessibilityLabel": "Boost this toot",
|
||||||
"function": "Boost toot"
|
"function": "Boost toot"
|
||||||
},
|
},
|
||||||
|
"favourited": {
|
||||||
|
"accessibilityLabel": "Add this toot to favourites",
|
||||||
|
"function": "Favourite toot"
|
||||||
|
},
|
||||||
"bookmarked": {
|
"bookmarked": {
|
||||||
|
"accessibilityLabel": "Add this toot to bookmarks",
|
||||||
"function": "Bookmark toot"
|
"function": "Bookmark toot"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"actionsUsers": {
|
"actionsUsers": {
|
||||||
"reblogged_by": "$t(screenTabs:shared.users.statuses.reblogged_by)",
|
"reblogged_by": {
|
||||||
"favourited_by": "$t(screenTabs:shared.users.statuses.favourited_by)"
|
"accessibilityLabel": "{{count}} users have boosted this toot",
|
||||||
|
"accessibilityHint": "Tap to know the users",
|
||||||
|
"text": "$t(screenTabs:shared.users.statuses.reblogged_by)"
|
||||||
|
},
|
||||||
|
"favourited_by": {
|
||||||
|
"accessibilityLabel": "{{count}} users have favourited this toot",
|
||||||
|
"accessibilityHint": "Tap to know the users",
|
||||||
|
"text": "$t(screenTabs:shared.users.statuses.favourited_by)"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"attachment": {
|
"attachment": {
|
||||||
"sensitive": {
|
"sensitive": {
|
||||||
@ -52,13 +66,36 @@
|
|||||||
"button": "Try remote link"
|
"button": "Try remote link"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"avatar": {
|
||||||
|
"accessibilityLabel": "Avatar of {{name}}",
|
||||||
|
"accessibilityHint": "Tap to go to {{name}}'s page"
|
||||||
|
},
|
||||||
"content": {
|
"content": {
|
||||||
"expandHint": "hidden content"
|
"expandHint": "hidden content"
|
||||||
},
|
},
|
||||||
"fullConversation": "Read conversations",
|
"fullConversation": "Read conversations",
|
||||||
"header": {
|
"header": {
|
||||||
"shared": {
|
"shared": {
|
||||||
"application": "Tooted with {{application}}"
|
"account": {
|
||||||
|
"name": {
|
||||||
|
"accessibilityHint": "User's display name"
|
||||||
|
},
|
||||||
|
"account": {
|
||||||
|
"accessibilityHint": "User's account"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"application": "Tooted with {{application}}",
|
||||||
|
"muted": {
|
||||||
|
"accessibilityLabel": "Toot muted"
|
||||||
|
},
|
||||||
|
"visibility": {
|
||||||
|
"direct": {
|
||||||
|
"accessibilityLabel": "Toot is a direct message"
|
||||||
|
},
|
||||||
|
"private": {
|
||||||
|
"accessibilityLabel": "Toot is visible to followers only"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"conversation": {
|
"conversation": {
|
||||||
"withAccounts": "With",
|
"withAccounts": "With",
|
||||||
@ -67,6 +104,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
|
"accessibilityHint": "Actions for this toot, such as its posted user, toot itself",
|
||||||
"account": {
|
"account": {
|
||||||
"heading": "About user",
|
"heading": "About user",
|
||||||
"mute": {
|
"mute": {
|
||||||
|
@ -45,15 +45,38 @@
|
|||||||
},
|
},
|
||||||
"footer": {
|
"footer": {
|
||||||
"attachments": {
|
"attachments": {
|
||||||
"sensitive": "Mark attachments as sensitive"
|
"sensitive": "Mark attachments as sensitive",
|
||||||
|
"remove": {
|
||||||
|
"accessibilityLabel": "Remove uploaded attachment, number {{attachment}}"
|
||||||
|
},
|
||||||
|
"edit": {
|
||||||
|
"accessibilityLabel": "Edit uploaded attachment, number {{attachment}}"
|
||||||
|
},
|
||||||
|
"upload": {
|
||||||
|
"accessibilityLabel": "Upload more attachments"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"emojis": {
|
||||||
|
"accessibilityHint": "Tap to add emoji to toot"
|
||||||
},
|
},
|
||||||
"poll": {
|
"poll": {
|
||||||
"option": {
|
"option": {
|
||||||
"placeholder": {
|
"placeholder": {
|
||||||
|
"accessibilityLabel": "Poll option {{index}}",
|
||||||
"single": "Single choice",
|
"single": "Single choice",
|
||||||
"multiple": "Multiple choice"
|
"multiple": "Multiple choice"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"quantity": {
|
||||||
|
"reduce": {
|
||||||
|
"accessibilityLabel": "Reduce poll options to {{amount}}",
|
||||||
|
"accessibilityHint": "Minimum poll options quantity reached, currently has {{amount}}"
|
||||||
|
},
|
||||||
|
"increase": {
|
||||||
|
"accessibilityLabel": "Increase poll options to {{amount}}",
|
||||||
|
"accessibilityHint": "Maximum poll options quantity reached, currently has {{amount}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
"multiple": {
|
"multiple": {
|
||||||
"heading": "Choice type",
|
"heading": "Choice type",
|
||||||
"options": {
|
"options": {
|
||||||
@ -79,6 +102,8 @@
|
|||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"attachment": {
|
"attachment": {
|
||||||
|
"accessibilityLabel": "Upload attachment",
|
||||||
|
"accessibilityHint": "Poll function will be disabled when there is any attachment",
|
||||||
"actions": {
|
"actions": {
|
||||||
"options": {
|
"options": {
|
||||||
"library": "Upload from photo library",
|
"library": "Upload from photo library",
|
||||||
@ -113,7 +138,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"poll": {
|
||||||
|
"accessibilityLabel": "Add poll",
|
||||||
|
"accessibilityHint": "Attachment function will be disabled when poll is active"
|
||||||
|
},
|
||||||
"visibility": {
|
"visibility": {
|
||||||
|
"accessibilityLabel": "Toot visibility is {{visibility}}",
|
||||||
"title": "Toot visibility",
|
"title": "Toot visibility",
|
||||||
"options": {
|
"options": {
|
||||||
"public": "Public",
|
"public": "Public",
|
||||||
@ -122,6 +152,13 @@
|
|||||||
"direct": "Direct message",
|
"direct": "Direct message",
|
||||||
"cancel": "$t(common:buttons.cancel)"
|
"cancel": "$t(common:buttons.cancel)"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"spoiler": {
|
||||||
|
"accessibilityLabel": "Spoiler"
|
||||||
|
},
|
||||||
|
"emoji": {
|
||||||
|
"accessibilityLabel": "Add emoji",
|
||||||
|
"accessibilityHint": "Open emoji selection panel, swipe horizontally to change page"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"drafts": "Draft ({{count}})",
|
"drafts": "Draft ({{count}})",
|
||||||
@ -131,6 +168,7 @@
|
|||||||
"header": {
|
"header": {
|
||||||
"title": "Edit attachment",
|
"title": "Edit attachment",
|
||||||
"right": {
|
"right": {
|
||||||
|
"accessibilityLabel": "Save editing attachment",
|
||||||
"failed": {
|
"failed": {
|
||||||
"title": "Editing failed",
|
"title": "Editing failed",
|
||||||
"button": "Try again"
|
"button": "Try again"
|
||||||
@ -150,6 +188,7 @@
|
|||||||
"title": "Draft"
|
"title": "Draft"
|
||||||
},
|
},
|
||||||
"content": {
|
"content": {
|
||||||
|
"accessibilityHint": "Saved draft, tap to edit this draft",
|
||||||
"textEmpty": "Content empty"
|
"textEmpty": "Content empty"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
{
|
{
|
||||||
"content": {
|
"content": {
|
||||||
|
"actions": {
|
||||||
|
"accessibilityLabel": "More actions of this image",
|
||||||
|
"accessibilityHint": "You can save or share this image"
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"save": "Save image",
|
"save": "Save image",
|
||||||
"share": "Share iamge",
|
"share": "Share image",
|
||||||
"cancel": "$t(common:buttons.cancel)"
|
"cancel": "$t(common:buttons.cancel)"
|
||||||
},
|
},
|
||||||
"save": {
|
"save": {
|
||||||
|
@ -17,6 +17,18 @@
|
|||||||
"name": "About me"
|
"name": "About me"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"common": {
|
||||||
|
"search": {
|
||||||
|
"accessibilityLabel": "Search",
|
||||||
|
"accessibilityHint": "Search for hashtags, users or toots"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notifications": {
|
||||||
|
"filter": {
|
||||||
|
"accessibilityLabel": "Filter",
|
||||||
|
"accessibilityHint": "Filter shown notifications' types"
|
||||||
|
}
|
||||||
|
},
|
||||||
"me": {
|
"me": {
|
||||||
"stacks": {
|
"stacks": {
|
||||||
"bookmarks": {
|
"bookmarks": {
|
||||||
@ -175,6 +187,10 @@
|
|||||||
},
|
},
|
||||||
"shared": {
|
"shared": {
|
||||||
"account": {
|
"account": {
|
||||||
|
"actions": {
|
||||||
|
"accessibilityLabel": "Actions for user {{user}}",
|
||||||
|
"accessibilityHint": "You can mute, block, report or share this user"
|
||||||
|
},
|
||||||
"moved": "User moved",
|
"moved": "User moved",
|
||||||
"created_at": "Registered on: {{date}}",
|
"created_at": "Registered on: {{date}}",
|
||||||
"summary": {
|
"summary": {
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
"apply": "应用",
|
"apply": "应用",
|
||||||
"cancel": "取消"
|
"cancel": "取消"
|
||||||
},
|
},
|
||||||
|
"customEmoji": {
|
||||||
|
"accessibilityLabel": "自定义表情{{emoji}}"
|
||||||
|
},
|
||||||
"message": {
|
"message": {
|
||||||
"success": {
|
"success": {
|
||||||
"message": "{{function}}成功"
|
"message": "{{function}}成功"
|
||||||
|
@ -29,19 +29,33 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"favourited": {
|
"reply": {
|
||||||
"function": "喜欢嘟文"
|
"accessibilityLabel": "回复此嘟文"
|
||||||
},
|
},
|
||||||
"reblogged": {
|
"reblogged": {
|
||||||
|
"accessibilityLabel": "转发此嘟文",
|
||||||
"function": "转嘟"
|
"function": "转嘟"
|
||||||
},
|
},
|
||||||
|
"favourited": {
|
||||||
|
"accessibilityLabel": "添加此嘟文至喜欢列表",
|
||||||
|
"function": "喜欢嘟文"
|
||||||
|
},
|
||||||
"bookmarked": {
|
"bookmarked": {
|
||||||
|
"accessibilityLabel": "添加此嘟文至书签列表",
|
||||||
"function": "喜欢嘟文"
|
"function": "喜欢嘟文"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"actionsUsers": {
|
"actionsUsers": {
|
||||||
"reblogged_by": "$t(screenTabs:shared.users.statuses.reblogged_by)",
|
"reblogged_by": {
|
||||||
"favourited_by": "$t(screenTabs:shared.users.statuses.favourited_by)"
|
"accessibilityLabel": "{{count}}用户转嘟了此嘟文",
|
||||||
|
"accessibilityHint": "点击以了解用户",
|
||||||
|
"text": "$t(screenTabs:shared.users.statuses.reblogged_by)"
|
||||||
|
},
|
||||||
|
"favourited_by": {
|
||||||
|
"accessibilityLabel": "{{count}}用户喜欢了此嘟文",
|
||||||
|
"accessibilityHint": "点击以了解用户",
|
||||||
|
"text": "$t(screenTabs:shared.users.statuses.favourited_by)"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"attachment": {
|
"attachment": {
|
||||||
"sensitive": {
|
"sensitive": {
|
||||||
@ -52,13 +66,36 @@
|
|||||||
"button": "尝试远程链接"
|
"button": "尝试远程链接"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"avatar": {
|
||||||
|
"accessibilityLabel": "{{name}}的头像",
|
||||||
|
"accessibilityHint": "点击进入{{name}}的页面"
|
||||||
|
},
|
||||||
"content": {
|
"content": {
|
||||||
"expandHint": "隐藏内容"
|
"expandHint": "隐藏内容"
|
||||||
},
|
},
|
||||||
"fullConversation": "阅读全部对话",
|
"fullConversation": "阅读全部对话",
|
||||||
"header": {
|
"header": {
|
||||||
"shared": {
|
"shared": {
|
||||||
"application": "发自于 {{application}}"
|
"account": {
|
||||||
|
"name": {
|
||||||
|
"accessibilityHint": "用户显示名"
|
||||||
|
},
|
||||||
|
"account": {
|
||||||
|
"accessibilityHint": "用户帐户名"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"application": "发自于 {{application}}",
|
||||||
|
"muted": {
|
||||||
|
"accessibilityLabel": "已静音此嘟文"
|
||||||
|
},
|
||||||
|
"visibility": {
|
||||||
|
"direct": {
|
||||||
|
"accessibilityLabel": "此嘟文是私信"
|
||||||
|
},
|
||||||
|
"private": {
|
||||||
|
"accessibilityLabel": "此嘟文仅关注着可见"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"conversation": {
|
"conversation": {
|
||||||
"withAccounts": "与",
|
"withAccounts": "与",
|
||||||
@ -67,6 +104,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
|
"accessibilityHint": "更多关于此条嘟文,例如发布者等",
|
||||||
"account": {
|
"account": {
|
||||||
"heading": "关于用户",
|
"heading": "关于用户",
|
||||||
"mute": {
|
"mute": {
|
||||||
|
@ -45,15 +45,38 @@
|
|||||||
},
|
},
|
||||||
"footer": {
|
"footer": {
|
||||||
"attachments": {
|
"attachments": {
|
||||||
"sensitive": "标记附件为敏感内容"
|
"sensitive": "标记附件为敏感内容",
|
||||||
|
"remove": {
|
||||||
|
"accessibilityLabel": "删除已上传的附件,序号{{attachment}}"
|
||||||
|
},
|
||||||
|
"edit": {
|
||||||
|
"accessibilityLabel": "编辑已上传的附件,序号{{attachment}}"
|
||||||
|
},
|
||||||
|
"upload": {
|
||||||
|
"accessibilityLabel": "上传更多附件"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"emojis": {
|
||||||
|
"accessibilityHint": "点击添加表情符号至嘟文"
|
||||||
},
|
},
|
||||||
"poll": {
|
"poll": {
|
||||||
"option": {
|
"option": {
|
||||||
"placeholder": {
|
"placeholder": {
|
||||||
|
"accessibilityLabel": "选项{{index}}",
|
||||||
"single": "单选项",
|
"single": "单选项",
|
||||||
"multiple": "多选项"
|
"multiple": "多选项"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"quantity": {
|
||||||
|
"reduce": {
|
||||||
|
"accessibilityLabel": "减少至{{amount}}选项",
|
||||||
|
"accessibilityHint": "已达到最低选项数,目前有{{amount}}选项"
|
||||||
|
},
|
||||||
|
"increase": {
|
||||||
|
"accessibilityLabel": "增加至{{amount}}选项",
|
||||||
|
"accessibilityHint": "已达到最高选项数,目前有{{amount}}选项"
|
||||||
|
}
|
||||||
|
},
|
||||||
"multiple": {
|
"multiple": {
|
||||||
"heading": "可选项",
|
"heading": "可选项",
|
||||||
"options": {
|
"options": {
|
||||||
@ -79,6 +102,8 @@
|
|||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"attachment": {
|
"attachment": {
|
||||||
|
"accessibilityLabel": "上传附件",
|
||||||
|
"accessibilityHint": "当有任何附件时,投票功能将被禁用",
|
||||||
"actions": {
|
"actions": {
|
||||||
"options": {
|
"options": {
|
||||||
"library": "从相册上传",
|
"library": "从相册上传",
|
||||||
@ -113,7 +138,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"poll": {
|
||||||
|
"accessibilityLabel": "发起投票",
|
||||||
|
"accessibilityHint": "当启用投票功能时,附件功能将被禁用"
|
||||||
|
},
|
||||||
"visibility": {
|
"visibility": {
|
||||||
|
"accessibilityLabel": "此嘟文可见性为{{visibility}}",
|
||||||
"title": "嘟文可见范围",
|
"title": "嘟文可见范围",
|
||||||
"options": {
|
"options": {
|
||||||
"public": "公开",
|
"public": "公开",
|
||||||
@ -122,6 +152,13 @@
|
|||||||
"direct": "私信",
|
"direct": "私信",
|
||||||
"cancel": "$t(common:buttons.cancel)"
|
"cancel": "$t(common:buttons.cancel)"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"spoiler": {
|
||||||
|
"accessibilityLabel": "剧透"
|
||||||
|
},
|
||||||
|
"emoji": {
|
||||||
|
"accessibilityLabel": "添加表情符号",
|
||||||
|
"accessibilityHint": "打开表情选择面板,水平滑动切换页面"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"drafts": "草稿 ({{count}})",
|
"drafts": "草稿 ({{count}})",
|
||||||
@ -131,6 +168,7 @@
|
|||||||
"header": {
|
"header": {
|
||||||
"title": "编辑附件",
|
"title": "编辑附件",
|
||||||
"right": {
|
"right": {
|
||||||
|
"accessibilityLabel": "保存编辑附件",
|
||||||
"failed": {
|
"failed": {
|
||||||
"title": "编辑失败",
|
"title": "编辑失败",
|
||||||
"button": "返回重试"
|
"button": "返回重试"
|
||||||
@ -150,6 +188,7 @@
|
|||||||
"title": "草稿"
|
"title": "草稿"
|
||||||
},
|
},
|
||||||
"content": {
|
"content": {
|
||||||
|
"accessibilityHint": "已保存的草稿,点击编辑此草稿",
|
||||||
"textEmpty": "无正文内容"
|
"textEmpty": "无正文内容"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
"content": {
|
"content": {
|
||||||
|
"actions": {
|
||||||
|
"accessibilityLabel": "更多此图像的操作",
|
||||||
|
"accessibilityHint": "您可以保存或分享此图片"
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"save": "保存图片",
|
"save": "保存图片",
|
||||||
"share": "分享图片",
|
"share": "分享图片",
|
||||||
|
@ -17,6 +17,18 @@
|
|||||||
"name": "关于我"
|
"name": "关于我"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"common": {
|
||||||
|
"search": {
|
||||||
|
"accessibilityLabel": "搜索",
|
||||||
|
"accessibilityHint": "搜索标签、用户或嘟文"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notifications": {
|
||||||
|
"filter": {
|
||||||
|
"accessibilityLabel": "筛选",
|
||||||
|
"accessibilityHint": "筛选显示的通知类型"
|
||||||
|
}
|
||||||
|
},
|
||||||
"me": {
|
"me": {
|
||||||
"stacks": {
|
"stacks": {
|
||||||
"bookmarks": {
|
"bookmarks": {
|
||||||
@ -175,6 +187,10 @@
|
|||||||
},
|
},
|
||||||
"shared": {
|
"shared": {
|
||||||
"account": {
|
"account": {
|
||||||
|
"actions": {
|
||||||
|
"accessibilityLabel": "对用户{{user}} 的操作",
|
||||||
|
"accessibilityHint": "您可以静音、屏蔽、举报或分享此用户"
|
||||||
|
},
|
||||||
"moved": "账户已迁移",
|
"moved": "账户已迁移",
|
||||||
"created_at": "注册时间:{{date}}",
|
"created_at": "注册时间:{{date}}",
|
||||||
"summary": {
|
"summary": {
|
||||||
|
@ -224,7 +224,7 @@ const ScreenAnnouncements: React.FC<ScreenAnnouncementsProp> = ({
|
|||||||
onPress={() => navigation.goBack()}
|
onPress={() => navigation.goBack()}
|
||||||
/>
|
/>
|
||||||
<HeaderCenter content={t('screenAnnouncements:heading')} />
|
<HeaderCenter content={t('screenAnnouncements:heading')} />
|
||||||
<View style={{ opacity: 0 }}>
|
<View style={{ opacity: 0 }} accessible={false}>
|
||||||
<HeaderRight
|
<HeaderRight
|
||||||
content='MoreHorizontal'
|
content='MoreHorizontal'
|
||||||
native={false}
|
native={false}
|
||||||
|
@ -195,7 +195,7 @@ const ScreenCompose: React.FC<ScreenComposeProp> = ({
|
|||||||
const autoSave = composeState.dirty
|
const autoSave = composeState.dirty
|
||||||
? setInterval(() => {
|
? setInterval(() => {
|
||||||
saveDraft()
|
saveDraft()
|
||||||
}, 2000)
|
}, 1000)
|
||||||
: removeDraft()
|
: removeDraft()
|
||||||
return () => autoSave && clearInterval(autoSave)
|
return () => autoSave && clearInterval(autoSave)
|
||||||
}, [composeState])
|
}, [composeState])
|
||||||
|
@ -55,6 +55,7 @@ const ComposeDraftsListRoot: React.FC<Props> = ({ timestamp }) => {
|
|||||||
({ item }: { item: ComposeStateDraft }) => {
|
({ item }: { item: ComposeStateDraft }) => {
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityHint={t('content.draftsList.content.accessibilityHint')}
|
||||||
style={[styles.draft, { backgroundColor: theme.backgroundDefault }]}
|
style={[styles.draft, { backgroundColor: theme.backgroundDefault }]}
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
setCheckingAttachments(true)
|
setCheckingAttachments(true)
|
||||||
@ -181,7 +182,10 @@ const ComposeDraftsListRoot: React.FC<Props> = ({ timestamp }) => {
|
|||||||
visible={checkingAttachments}
|
visible={checkingAttachments}
|
||||||
children={
|
children={
|
||||||
<View
|
<View
|
||||||
style={[styles.modal, { backgroundColor: theme.backgroundOverlayInvert }]}
|
style={[
|
||||||
|
styles.modal,
|
||||||
|
{ backgroundColor: theme.backgroundOverlayInvert }
|
||||||
|
]}
|
||||||
children={
|
children={
|
||||||
<Text
|
<Text
|
||||||
children='检查附件在服务器的状态…'
|
children='检查附件在服务器的状态…'
|
||||||
|
@ -21,7 +21,6 @@ const ComposeEditAttachment: React.FC<ScreenComposeEditAttachmentProp> = ({
|
|||||||
},
|
},
|
||||||
navigation
|
navigation
|
||||||
}) => {
|
}) => {
|
||||||
console.log('rendering')
|
|
||||||
const { t } = useTranslation('screenCompose')
|
const { t } = useTranslation('screenCompose')
|
||||||
|
|
||||||
const headerLeft = useCallback(
|
const headerLeft = useCallback(
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useContext } from 'react'
|
import React, { useContext } from 'react'
|
||||||
@ -22,6 +23,7 @@ export interface Props {
|
|||||||
const ComposeEditAttachmentImage: React.FC<Props> = ({ index }) => {
|
const ComposeEditAttachmentImage: React.FC<Props> = ({ index }) => {
|
||||||
const { t } = useTranslation('screenCompose')
|
const { t } = useTranslation('screenCompose')
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
const { screenReaderEnabled } = useAccessibility()
|
||||||
|
|
||||||
const { composeState, composeDispatch } = useContext(ComposeContext)
|
const { composeState, composeDispatch } = useContext(ComposeContext)
|
||||||
const theAttachmentRemote = composeState.attachments.uploads[index].remote!
|
const theAttachmentRemote = composeState.attachments.uploads[index].remote!
|
||||||
@ -160,9 +162,11 @@ const ComposeEditAttachmentImage: React.FC<Props> = ({ index }) => {
|
|||||||
</Animated.View>
|
</Animated.View>
|
||||||
</PanGestureHandler>
|
</PanGestureHandler>
|
||||||
</View>
|
</View>
|
||||||
<Text style={[styles.imageFocusText, { color: theme.primaryDefault }]}>
|
{screenReaderEnabled ? null : (
|
||||||
{t('content.editAttachment.content.imageFocus')}
|
<Text style={[styles.imageFocusText, { color: theme.primaryDefault }]}>
|
||||||
</Text>
|
{t('content.editAttachment.content.imageFocus')}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,9 @@ const ComposeEditAttachmentSubmit: React.FC<Props> = ({ index }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<HeaderRight
|
<HeaderRight
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'content.editAttachment.header.right.accessibilityLabel'
|
||||||
|
)}
|
||||||
type='icon'
|
type='icon'
|
||||||
content='Save'
|
content='Save'
|
||||||
loading={isSubmitting}
|
loading={isSubmitting}
|
||||||
@ -39,8 +42,8 @@ const ComposeEditAttachmentSubmit: React.FC<Props> = ({ index }) => {
|
|||||||
) {
|
) {
|
||||||
formData.append(
|
formData.append(
|
||||||
'focus',
|
'focus',
|
||||||
`${theAttachment.meta.focus.x || 0},${-theAttachment.meta.focus.y ||
|
`${theAttachment.meta?.focus?.x || 0},${-theAttachment.meta?.focus
|
||||||
0}`
|
?.y || 0}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,20 @@ import { useSearchQuery } from '@utils/queryHooks/search'
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import { forEach, groupBy, sortBy } from 'lodash'
|
import { forEach, groupBy, sortBy } from 'lodash'
|
||||||
import React, { useCallback, useContext, useEffect, useMemo } from 'react'
|
import React, {
|
||||||
import { FlatList, StyleSheet, View } from 'react-native'
|
useCallback,
|
||||||
|
useContext,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef
|
||||||
|
} from 'react'
|
||||||
|
import {
|
||||||
|
AccessibilityInfo,
|
||||||
|
findNodeHandle,
|
||||||
|
FlatList,
|
||||||
|
StyleSheet,
|
||||||
|
View
|
||||||
|
} from 'react-native'
|
||||||
import { Circle } from 'react-native-animated-spinkit'
|
import { Circle } from 'react-native-animated-spinkit'
|
||||||
import ComposeActions from './Root/Actions'
|
import ComposeActions from './Root/Actions'
|
||||||
import ComposePosting from './Posting'
|
import ComposePosting from './Posting'
|
||||||
@ -44,6 +56,15 @@ const ComposeRoot = React.memo(
|
|||||||
const { reduceMotionEnabled } = useAccessibility()
|
const { reduceMotionEnabled } = useAccessibility()
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
|
||||||
|
const accessibleRefDrafts = useRef(null)
|
||||||
|
const accessibleRefAttachments = useRef(null)
|
||||||
|
const accessibleRefEmojis = useRef(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const tagDrafts = findNodeHandle(accessibleRefDrafts.current)
|
||||||
|
tagDrafts && AccessibilityInfo.setAccessibilityFocus(tagDrafts)
|
||||||
|
}, [accessibleRefDrafts.current])
|
||||||
|
|
||||||
const { composeState, composeDispatch } = useContext(ComposeContext)
|
const { composeState, composeDispatch } = useContext(ComposeContext)
|
||||||
|
|
||||||
const { isFetching, data, refetch } = useSearchQuery({
|
const { isFetching, data, refetch } = useSearchQuery({
|
||||||
@ -106,6 +127,16 @@ const ComposeRoot = React.memo(
|
|||||||
[composeState]
|
[composeState]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const ListFooter = useCallback(
|
||||||
|
() => (
|
||||||
|
<ComposeRootFooter
|
||||||
|
accessibleRefAttachments={accessibleRefAttachments}
|
||||||
|
accessibleRefEmojis={accessibleRefEmojis}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.base}>
|
<View style={styles.base}>
|
||||||
<FlatList
|
<FlatList
|
||||||
@ -113,14 +144,14 @@ const ComposeRoot = React.memo(
|
|||||||
ListEmptyComponent={listEmpty}
|
ListEmptyComponent={listEmpty}
|
||||||
keyboardShouldPersistTaps='always'
|
keyboardShouldPersistTaps='always'
|
||||||
ListHeaderComponent={ComposeRootHeader}
|
ListHeaderComponent={ComposeRootHeader}
|
||||||
ListFooterComponent={ComposeRootFooter}
|
ListFooterComponent={ListFooter}
|
||||||
ItemSeparatorComponent={ComponentSeparator}
|
ItemSeparatorComponent={ComponentSeparator}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
data={data ? data[composeState.tag?.type] : undefined}
|
data={data ? data[composeState.tag?.type] : undefined}
|
||||||
keyExtractor={() => Math.random().toString()}
|
keyExtractor={() => Math.random().toString()}
|
||||||
/>
|
/>
|
||||||
<ComposeActions />
|
<ComposeActions />
|
||||||
<ComposeDrafts />
|
<ComposeDrafts accessibleRefDrafts={accessibleRefDrafts} />
|
||||||
<ComposePosting />
|
<ComposePosting />
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
@ -164,20 +164,50 @@ const ComposeActions: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
accessibilityRole='toolbar'
|
||||||
style={[
|
style={[
|
||||||
styles.additions,
|
styles.additions,
|
||||||
{ backgroundColor: theme.backgroundDefault, borderTopColor: theme.border }
|
{
|
||||||
|
backgroundColor: theme.backgroundDefault,
|
||||||
|
borderTopColor: theme.border
|
||||||
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityRole='button'
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'content.root.actions.attachment.accessibilityLabel'
|
||||||
|
)}
|
||||||
|
accessibilityHint={t(
|
||||||
|
'content.root.actions.attachment.accessibilityHint'
|
||||||
|
)}
|
||||||
|
accessibilityState={{
|
||||||
|
disabled: composeState.poll.active
|
||||||
|
}}
|
||||||
|
style={styles.button}
|
||||||
onPress={attachmentOnPress}
|
onPress={attachmentOnPress}
|
||||||
children={<Icon name='Aperture' size={24} color={attachmentColor} />}
|
children={<Icon name='Aperture' size={24} color={attachmentColor} />}
|
||||||
/>
|
/>
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityRole='button'
|
||||||
|
accessibilityLabel={t('content.root.actions.poll.accessibilityLabel')}
|
||||||
|
accessibilityHint={t('content.root.actions.poll.accessibilityHint')}
|
||||||
|
accessibilityState={{
|
||||||
|
disabled: composeState.attachments.uploads.length ? true : false,
|
||||||
|
expanded: composeState.poll.active
|
||||||
|
}}
|
||||||
|
style={styles.button}
|
||||||
onPress={pollOnPress}
|
onPress={pollOnPress}
|
||||||
children={<Icon name='BarChart2' size={24} color={pollColor} />}
|
children={<Icon name='BarChart2' size={24} color={pollColor} />}
|
||||||
/>
|
/>
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityRole='button'
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'content.root.actions.visibility.accessibilityLabel',
|
||||||
|
{ visibility: composeState.visibility }
|
||||||
|
)}
|
||||||
|
accessibilityState={{ disabled: composeState.visibilityLock }}
|
||||||
|
style={styles.button}
|
||||||
onPress={visibilityOnPress}
|
onPress={visibilityOnPress}
|
||||||
children={
|
children={
|
||||||
<Icon
|
<Icon
|
||||||
@ -190,18 +220,34 @@ const ComposeActions: React.FC = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityRole='button'
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'content.root.actions.spoiler.accessibilityLabel'
|
||||||
|
)}
|
||||||
|
accessibilityState={{ expanded: composeState.spoiler.active }}
|
||||||
|
style={styles.button}
|
||||||
onPress={spoilerOnPress}
|
onPress={spoilerOnPress}
|
||||||
children={
|
children={
|
||||||
<Icon
|
<Icon
|
||||||
name='AlertTriangle'
|
name='AlertTriangle'
|
||||||
size={24}
|
size={24}
|
||||||
color={
|
color={
|
||||||
composeState.spoiler.active ? theme.primaryDefault : theme.secondary
|
composeState.spoiler.active
|
||||||
|
? theme.primaryDefault
|
||||||
|
: theme.secondary
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessibilityRole='button'
|
||||||
|
accessibilityLabel={t('content.root.actions.emoji.accessibilityLabel')}
|
||||||
|
accessibilityHint={t('content.root.actions.emoji.accessibilityHint')}
|
||||||
|
accessibilityState={{
|
||||||
|
disabled: composeState.emoji.emojis ? false : true,
|
||||||
|
expanded: composeState.emoji.active
|
||||||
|
}}
|
||||||
|
style={styles.button}
|
||||||
onPress={emojiOnPress}
|
onPress={emojiOnPress}
|
||||||
children={<Icon name='Smile' size={24} color={emojiColor} />}
|
children={<Icon name='Smile' size={24} color={emojiColor} />}
|
||||||
/>
|
/>
|
||||||
@ -210,6 +256,12 @@ const ComposeActions: React.FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
button: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: '100%'
|
||||||
|
},
|
||||||
additions: {
|
additions: {
|
||||||
height: 45,
|
height: 45,
|
||||||
borderTopWidth: StyleSheet.hairlineWidth,
|
borderTopWidth: StyleSheet.hairlineWidth,
|
||||||
|
@ -3,13 +3,17 @@ import { useNavigation } from '@react-navigation/native'
|
|||||||
import { getInstanceDrafts } from '@utils/slices/instancesSlice'
|
import { getInstanceDrafts } from '@utils/slices/instancesSlice'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import layoutAnimation from '@utils/styles/layoutAnimation'
|
import layoutAnimation from '@utils/styles/layoutAnimation'
|
||||||
import React, { useContext, useEffect } from 'react'
|
import React, { RefObject, useContext, useEffect } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { StyleSheet, View } from 'react-native'
|
import { StyleSheet, View } from 'react-native'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
import ComposeContext from '../utils/createContext'
|
import ComposeContext from '../utils/createContext'
|
||||||
|
|
||||||
const ComposeDrafts: React.FC = () => {
|
export interface Props {
|
||||||
|
accessibleRefDrafts: RefObject<View>
|
||||||
|
}
|
||||||
|
|
||||||
|
const ComposeDrafts: React.FC<Props> = ({ accessibleRefDrafts }) => {
|
||||||
const { t } = useTranslation('screenCompose')
|
const { t } = useTranslation('screenCompose')
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation()
|
||||||
const { composeState } = useContext(ComposeContext)
|
const { composeState } = useContext(ComposeContext)
|
||||||
@ -24,6 +28,7 @@ const ComposeDrafts: React.FC = () => {
|
|||||||
if (!composeState.dirty && instanceDrafts?.length) {
|
if (!composeState.dirty && instanceDrafts?.length) {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
ref={accessibleRefDrafts}
|
||||||
style={styles.base}
|
style={styles.base}
|
||||||
children={
|
children={
|
||||||
<Button
|
<Button
|
||||||
|
@ -3,15 +3,30 @@ import ComposeEmojis from '@screens/Compose/Root/Footer/Emojis'
|
|||||||
import ComposePoll from '@screens/Compose/Root/Footer/Poll'
|
import ComposePoll from '@screens/Compose/Root/Footer/Poll'
|
||||||
import ComposeReply from '@screens/Compose/Root/Footer/Reply'
|
import ComposeReply from '@screens/Compose/Root/Footer/Reply'
|
||||||
import ComposeContext from '@screens/Compose/utils/createContext'
|
import ComposeContext from '@screens/Compose/utils/createContext'
|
||||||
import React, { useContext } from 'react'
|
import React, { RefObject, useContext } from 'react'
|
||||||
|
import { SectionList, View } from 'react-native'
|
||||||
|
|
||||||
const ComposeRootFooter: React.FC = () => {
|
export interface Props {
|
||||||
|
accessibleRefAttachments: RefObject<View>
|
||||||
|
accessibleRefEmojis: RefObject<SectionList>
|
||||||
|
}
|
||||||
|
|
||||||
|
const ComposeRootFooter: React.FC<Props> = ({
|
||||||
|
accessibleRefAttachments,
|
||||||
|
accessibleRefEmojis
|
||||||
|
}) => {
|
||||||
const { composeState } = useContext(ComposeContext)
|
const { composeState } = useContext(ComposeContext)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{composeState.emoji.active ? <ComposeEmojis /> : null}
|
{composeState.emoji.active ? (
|
||||||
{composeState.attachments.uploads.length ? <ComposeAttachments /> : null}
|
<ComposeEmojis accessibleRefEmojis={accessibleRefEmojis} />
|
||||||
|
) : null}
|
||||||
|
{composeState.attachments.uploads.length ? (
|
||||||
|
<ComposeAttachments
|
||||||
|
accessibleRefAttachments={accessibleRefAttachments}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
{composeState.poll.active ? <ComposePoll /> : null}
|
{composeState.poll.active ? <ComposePoll /> : null}
|
||||||
{composeState.replyToStatus ? <ComposeReply /> : null}
|
{composeState.replyToStatus ? <ComposeReply /> : null}
|
||||||
</>
|
</>
|
||||||
|
@ -8,6 +8,7 @@ import { StyleConstants } from '@utils/styles/constants'
|
|||||||
import layoutAnimation from '@utils/styles/layoutAnimation'
|
import layoutAnimation from '@utils/styles/layoutAnimation'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, {
|
import React, {
|
||||||
|
RefObject,
|
||||||
useCallback,
|
useCallback,
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
@ -28,9 +29,13 @@ import ComposeContext from '../../utils/createContext'
|
|||||||
import { ExtendedAttachment } from '../../utils/types'
|
import { ExtendedAttachment } from '../../utils/types'
|
||||||
import addAttachment from './addAttachment'
|
import addAttachment from './addAttachment'
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
accessibleRefAttachments: RefObject<View>
|
||||||
|
}
|
||||||
|
|
||||||
const DEFAULT_HEIGHT = 200
|
const DEFAULT_HEIGHT = 200
|
||||||
|
|
||||||
const ComposeAttachments: React.FC = () => {
|
const ComposeAttachments: React.FC<Props> = ({ accessibleRefAttachments }) => {
|
||||||
const { showActionSheetWithOptions } = useActionSheet()
|
const { showActionSheetWithOptions } = useActionSheet()
|
||||||
const { composeState, composeDispatch } = useContext(ComposeContext)
|
const { composeState, composeDispatch } = useContext(ComposeContext)
|
||||||
const { t } = useTranslation('screenCompose')
|
const { t } = useTranslation('screenCompose')
|
||||||
@ -153,6 +158,10 @@ const ComposeAttachments: React.FC = () => {
|
|||||||
) : (
|
) : (
|
||||||
<View style={styles.actions}>
|
<View style={styles.actions}>
|
||||||
<Button
|
<Button
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'content.root.footer.attachments.remove.accessibilityLabel',
|
||||||
|
{ attachment: index + 1 }
|
||||||
|
)}
|
||||||
type='icon'
|
type='icon'
|
||||||
content='X'
|
content='X'
|
||||||
spacing='M'
|
spacing='M'
|
||||||
@ -169,6 +178,10 @@ const ComposeAttachments: React.FC = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'content.root.footer.attachments.edit.accessibilityLabel',
|
||||||
|
{ attachment: index + 1 }
|
||||||
|
)}
|
||||||
type='icon'
|
type='icon'
|
||||||
content='Edit'
|
content='Edit'
|
||||||
spacing='M'
|
spacing='M'
|
||||||
@ -192,6 +205,10 @@ const ComposeAttachments: React.FC = () => {
|
|||||||
const listFooter = useMemo(
|
const listFooter = useMemo(
|
||||||
() => (
|
() => (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
accessible
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'content.root.footer.attachments.upload.accessibilityLabel'
|
||||||
|
)}
|
||||||
style={[
|
style={[
|
||||||
styles.container,
|
styles.container,
|
||||||
{
|
{
|
||||||
@ -233,7 +250,7 @@ const ComposeAttachments: React.FC = () => {
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
<View style={styles.base}>
|
<View style={styles.base} ref={accessibleRefAttachments} accessible>
|
||||||
<Pressable style={styles.sensitive} onPress={sensitiveOnPress}>
|
<Pressable style={styles.sensitive} onPress={sensitiveOnPress}>
|
||||||
<Icon
|
<Icon
|
||||||
name={composeState.attachments.sensitive ? 'CheckCircle' : 'Circle'}
|
name={composeState.attachments.sensitive ? 'CheckCircle' : 'Circle'}
|
||||||
|
@ -3,14 +3,30 @@ import haptics from '@components/haptics'
|
|||||||
import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
|
import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useCallback, useContext, useMemo } from 'react'
|
import React, {
|
||||||
import { Pressable, SectionList, StyleSheet, Text, View } from 'react-native'
|
RefObject,
|
||||||
|
useCallback,
|
||||||
|
useContext,
|
||||||
|
useEffect,
|
||||||
|
useMemo
|
||||||
|
} from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import {
|
||||||
|
AccessibilityInfo,
|
||||||
|
findNodeHandle,
|
||||||
|
Pressable,
|
||||||
|
SectionList,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
View
|
||||||
|
} from 'react-native'
|
||||||
import FastImage from 'react-native-fast-image'
|
import FastImage from 'react-native-fast-image'
|
||||||
import validUrl from 'valid-url'
|
import validUrl from 'valid-url'
|
||||||
import updateText from '../../updateText'
|
import updateText from '../../updateText'
|
||||||
import ComposeContext from '../../utils/createContext'
|
import ComposeContext from '../../utils/createContext'
|
||||||
|
|
||||||
const SingleEmoji = ({ emoji }: { emoji: Mastodon.Emoji }) => {
|
const SingleEmoji = ({ emoji }: { emoji: Mastodon.Emoji }) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
const { reduceMotionEnabled } = useAccessibility()
|
const { reduceMotionEnabled } = useAccessibility()
|
||||||
|
|
||||||
const { composeState, composeDispatch } = useContext(ComposeContext)
|
const { composeState, composeDispatch } = useContext(ComposeContext)
|
||||||
@ -29,6 +45,12 @@ const SingleEmoji = ({ emoji }: { emoji: Mastodon.Emoji }) => {
|
|||||||
if (validUrl.isHttpsUri(uri)) {
|
if (validUrl.isHttpsUri(uri)) {
|
||||||
return (
|
return (
|
||||||
<FastImage
|
<FastImage
|
||||||
|
accessibilityLabel={t('common:customEmoji.accessibilityLabel', {
|
||||||
|
emoji: emoji.shortcode
|
||||||
|
})}
|
||||||
|
accessibilityHint={t(
|
||||||
|
'screenCompose:content.root.footer.emojis.accessibilityHint'
|
||||||
|
)}
|
||||||
source={{ uri: reduceMotionEnabled ? emoji.static_url : emoji.url }}
|
source={{ uri: reduceMotionEnabled ? emoji.static_url : emoji.url }}
|
||||||
style={styles.emoji}
|
style={styles.emoji}
|
||||||
/>
|
/>
|
||||||
@ -42,10 +64,21 @@ const SingleEmoji = ({ emoji }: { emoji: Mastodon.Emoji }) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const ComposeEmojis: React.FC = () => {
|
export interface Props {
|
||||||
|
accessibleRefEmojis: RefObject<SectionList>
|
||||||
|
}
|
||||||
|
|
||||||
|
const ComposeEmojis: React.FC<Props> = ({ accessibleRefEmojis }) => {
|
||||||
const { composeState } = useContext(ComposeContext)
|
const { composeState } = useContext(ComposeContext)
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const tagEmojis = findNodeHandle(accessibleRefEmojis.current)
|
||||||
|
if (composeState.emoji.active) {
|
||||||
|
tagEmojis && AccessibilityInfo.setAccessibilityFocus(tagEmojis)
|
||||||
|
}
|
||||||
|
}, [composeState.emoji.active])
|
||||||
|
|
||||||
const listHeader = useCallback(
|
const listHeader = useCallback(
|
||||||
({ section: { title } }) => (
|
({ section: { title } }) => (
|
||||||
<Text style={[styles.group, { color: theme.secondary }]}>{title}</Text>
|
<Text style={[styles.group, { color: theme.secondary }]}>{title}</Text>
|
||||||
@ -73,6 +106,8 @@ const ComposeEmojis: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<View style={styles.base}>
|
<View style={styles.base}>
|
||||||
<SectionList
|
<SectionList
|
||||||
|
accessible
|
||||||
|
ref={accessibleRefEmojis}
|
||||||
horizontal
|
horizontal
|
||||||
keyboardShouldPersistTaps='always'
|
keyboardShouldPersistTaps='always'
|
||||||
sections={composeState.emoji.emojis || []}
|
sections={composeState.emoji.emojis || []}
|
||||||
|
@ -48,6 +48,10 @@ const ComposePoll: React.FC = () => {
|
|||||||
color={theme.secondary}
|
color={theme.secondary}
|
||||||
/>
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
accessibilityLabel={t(
|
||||||
|
'content.root.footer.poll.option.placeholder.accessibilityLabel',
|
||||||
|
{ index: i + 1 }
|
||||||
|
)}
|
||||||
keyboardAppearance={mode}
|
keyboardAppearance={mode}
|
||||||
{...(i === 0 && firstRender && { autoFocus: true })}
|
{...(i === 0 && firstRender && { autoFocus: true })}
|
||||||
style={[
|
style={[
|
||||||
@ -80,6 +84,19 @@ const ComposePoll: React.FC = () => {
|
|||||||
<View style={styles.controlAmount}>
|
<View style={styles.controlAmount}>
|
||||||
<View style={styles.firstButton}>
|
<View style={styles.firstButton}>
|
||||||
<Button
|
<Button
|
||||||
|
{...((total > 2)
|
||||||
|
? {
|
||||||
|
accessibilityLabel: t(
|
||||||
|
'content.root.footer.poll.quantity.reduce.accessibilityLabel',
|
||||||
|
{ amount: total - 1 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
accessibilityHint: t(
|
||||||
|
'content.root.footer.poll.quantity.reduce.accessibilityHint',
|
||||||
|
{ amount: total }
|
||||||
|
)
|
||||||
|
})}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
analytics('compose_poll_reduce_press')
|
analytics('compose_poll_reduce_press')
|
||||||
total > 2 &&
|
total > 2 &&
|
||||||
@ -95,6 +112,19 @@ const ComposePoll: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<Button
|
<Button
|
||||||
|
{...(total < 4
|
||||||
|
? {
|
||||||
|
accessibilityLabel: t(
|
||||||
|
'content.root.footer.poll.quantity.increase.accessibilityLabel',
|
||||||
|
{ amount: total + 1 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
accessibilityHint: t(
|
||||||
|
'content.root.footer.poll.quantity.increase.accessibilityHint',
|
||||||
|
{ amount: total }
|
||||||
|
)
|
||||||
|
})}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
analytics('compose_poll_increase_press')
|
analytics('compose_poll_increase_press')
|
||||||
total < 4 &&
|
total < 4 &&
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useContext } from 'react'
|
import React, { useContext, useEffect, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { StyleSheet, Text, TextInput } from 'react-native'
|
import { StyleSheet, Text, TextInput } from 'react-native'
|
||||||
import formatText from '../../formatText'
|
import formatText from '../../formatText'
|
||||||
@ -45,7 +45,6 @@ const ComposeSpoilerInput: React.FC = () => {
|
|||||||
payload: { selection: { start, end } }
|
payload: { selection: { start, end } }
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
ref={composeState.textInputFocus.refs.spoiler}
|
|
||||||
scrollEnabled={false}
|
scrollEnabled={false}
|
||||||
onFocus={() =>
|
onFocus={() =>
|
||||||
composeDispatch({
|
composeDispatch({
|
||||||
|
@ -37,7 +37,7 @@ const composeInitialState: Omit<ComposeState, 'timestamp'> = {
|
|||||||
replyToStatus: undefined,
|
replyToStatus: undefined,
|
||||||
textInputFocus: {
|
textInputFocus: {
|
||||||
current: 'text',
|
current: 'text',
|
||||||
refs: { text: createRef(), spoiler: createRef() }
|
refs: { text: createRef() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
src/screens/Compose/utils/types.d.ts
vendored
@ -63,7 +63,7 @@ export type ComposeState = {
|
|||||||
replyToStatus?: Mastodon.Status
|
replyToStatus?: Mastodon.Status
|
||||||
textInputFocus: {
|
textInputFocus: {
|
||||||
current: 'text' | 'spoiler'
|
current: 'text' | 'spoiler'
|
||||||
refs: { text: RefObject<TextInput>; spoiler: RefObject<TextInput> }
|
refs: { text: RefObject<TextInput> }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +98,10 @@ const ImageItem = ({
|
|||||||
setImageDimensions
|
setImageDimensions
|
||||||
})}
|
})}
|
||||||
style={{ flex: 1 }}
|
style={{ flex: 1 }}
|
||||||
|
imageStyle={{
|
||||||
|
flex: 1,
|
||||||
|
resizeMode: 'stretch'
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
44
src/screens/ImageViewer/save.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import haptics from '@components/haptics'
|
||||||
|
import CameraRoll from '@react-native-community/cameraroll'
|
||||||
|
import { FileSystem, Permissions } from 'react-native-unimodules'
|
||||||
|
|
||||||
|
const saveIos = async (
|
||||||
|
image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
|
||||||
|
) => {
|
||||||
|
CameraRoll.save(image.url)
|
||||||
|
.then(() => haptics('Success'))
|
||||||
|
.catch(() => {
|
||||||
|
if (image.remote_url) {
|
||||||
|
CameraRoll.save(image.remote_url)
|
||||||
|
.then(() => haptics('Success'))
|
||||||
|
.catch(() => haptics('Error'))
|
||||||
|
} else {
|
||||||
|
haptics('Error')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveAndroid = async (
|
||||||
|
image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
|
||||||
|
) => {
|
||||||
|
const fileUri: string = `${FileSystem.documentDirectory}test.jpg`
|
||||||
|
const downloadedFile: FileSystem.FileSystemDownloadResult = await FileSystem.downloadAsync(
|
||||||
|
image.url,
|
||||||
|
fileUri
|
||||||
|
)
|
||||||
|
|
||||||
|
if (downloadedFile.status != 200) {
|
||||||
|
console.warn('error!')
|
||||||
|
}
|
||||||
|
|
||||||
|
const perm = await Permissions.askAsync(Permissions.MEDIA_LIBRARY)
|
||||||
|
if (perm.status != 'granted') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
CameraRoll.save(downloadedFile.uri)
|
||||||
|
.then(() => haptics('Success'))
|
||||||
|
.catch(() => haptics('Error'))
|
||||||
|
}
|
||||||
|
|
||||||
|
export { saveIos, saveAndroid }
|
@ -1,19 +1,11 @@
|
|||||||
import analytics from '@components/analytics'
|
import analytics from '@components/analytics'
|
||||||
import haptics from '@components/haptics'
|
|
||||||
import { HeaderCenter, HeaderLeft, HeaderRight } from '@components/Header'
|
import { HeaderCenter, HeaderLeft, HeaderRight } from '@components/Header'
|
||||||
import { useActionSheet } from '@expo/react-native-action-sheet'
|
import { useActionSheet } from '@expo/react-native-action-sheet'
|
||||||
import CameraRoll from '@react-native-community/cameraroll'
|
|
||||||
import { StackScreenProps } from '@react-navigation/stack'
|
import { StackScreenProps } from '@react-navigation/stack'
|
||||||
import { findIndex } from 'lodash'
|
import { findIndex } 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 {
|
import { Platform, Share, StatusBar, View } from 'react-native'
|
||||||
PermissionsAndroid,
|
|
||||||
Platform,
|
|
||||||
Share,
|
|
||||||
StatusBar,
|
|
||||||
View
|
|
||||||
} from 'react-native'
|
|
||||||
import {
|
import {
|
||||||
SafeAreaProvider,
|
SafeAreaProvider,
|
||||||
useSafeAreaInsets
|
useSafeAreaInsets
|
||||||
@ -23,35 +15,11 @@ import ImageViewer from './ImageViewer/Root'
|
|||||||
const saveImage = async (
|
const saveImage = async (
|
||||||
image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
|
image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
|
||||||
) => {
|
) => {
|
||||||
if (Platform.OS === 'ios') {
|
const save = require('./ImageViewer/save')
|
||||||
CameraRoll.save(image.url)
|
Platform.select({
|
||||||
.then(() => haptics('Success'))
|
ios: save.saveIos(image),
|
||||||
.catch(() => {
|
android: save.saveAndroid(image)
|
||||||
if (image.remote_url) {
|
})
|
||||||
CameraRoll.save(image.remote_url)
|
|
||||||
.then(() => haptics('Success'))
|
|
||||||
.catch(() => haptics('Error'))
|
|
||||||
} else {
|
|
||||||
haptics('Error')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if (Platform.OS === 'android') {
|
|
||||||
const hasAndroidPermission = async () => {
|
|
||||||
const permission = PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
|
|
||||||
|
|
||||||
const hasPermission = await PermissionsAndroid.check(permission)
|
|
||||||
if (hasPermission) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
const status = await PermissionsAndroid.request(permission)
|
|
||||||
return status === 'granted'
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(await hasAndroidPermission())) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const HeaderComponent = React.memo(
|
const HeaderComponent = React.memo(
|
||||||
@ -120,6 +88,8 @@ const HeaderComponent = React.memo(
|
|||||||
content={`${currentIndex + 1} / ${imageUrls.length}`}
|
content={`${currentIndex + 1} / ${imageUrls.length}`}
|
||||||
/>
|
/>
|
||||||
<HeaderRight
|
<HeaderRight
|
||||||
|
accessibilityLabel={t('content.actions.accessibilityLabel')}
|
||||||
|
accessibilityHint={t('content.actions.accessibilityHint')}
|
||||||
content='MoreHorizontal'
|
content='MoreHorizontal'
|
||||||
native={false}
|
native={false}
|
||||||
background
|
background
|
||||||
|