Compare commits

...

49 Commits

Author SHA1 Message Date
xmflsct 9f70cef94f Merge branch 'main' into candidate 2022-08-07 01:19:46 +02:00
xmflsct 8041b2309d
Merge pull request #355 from tooot-app/l10n_main
New Crowdin updates
2022-08-07 01:18:59 +02:00
xmflsct e2ba4660df Fxied #353 2022-08-07 01:18:10 +02:00
xmflsct 99b38f421c Update and patch packages 2022-08-07 00:20:34 +02:00
xmflsct 28b5a2e17e Update rest of the packages 2022-08-06 22:20:03 +02:00
xmflsct 33d8a97efb Updated to expo 46 2022-08-06 22:05:26 +02:00
xmflsct 6ad59c9c3a New translations contextMenu.json (Japanese) 2022-07-17 23:48:57 +02:00
xmflsct 3a3ee95c5f New translations emojis.json (Japanese) 2022-07-17 23:48:56 +02:00
xmflsct 38ca647e29 New translations mediaSelector.json (Japanese) 2022-07-17 23:48:55 +02:00
xmflsct 053d438466 New translations tabs.json (Japanese) 2022-07-17 23:48:54 +02:00
xmflsct 98850d4a59 New translations screens.json (Japanese) 2022-07-17 23:48:54 +02:00
xmflsct 522afb42ba New translations compose.json (Japanese) 2022-07-17 23:48:53 +02:00
xmflsct 81a4b60ab4 New translations announcements.json (Japanese) 2022-07-17 23:48:51 +02:00
xmflsct fc5be8acc9 New translations imageViewer.json (Japanese) 2022-07-17 23:48:51 +02:00
xmflsct bbd3bf7d85 New translations actions.json (Japanese) 2022-07-17 23:48:50 +02:00
xmflsct 25e82f46d4 New translations timeline.json (Japanese) 2022-07-17 23:48:49 +02:00
xmflsct 5907bba2f0 New translations relationship.json (Japanese) 2022-07-17 23:48:48 +02:00
xmflsct 4812605aaf New translations parse.json (Japanese) 2022-07-17 23:48:47 +02:00
xmflsct 2421a6c1ee New translations instance.json (Japanese) 2022-07-17 23:48:46 +02:00
xmflsct 9f546312b2 New translations common.json (Japanese) 2022-07-17 23:48:45 +02:00
xmflsct b9cf0ceb6b Fixed #352 2022-07-09 11:40:48 +02:00
xmflsct 51a2ff012a Warn image processing error 2022-07-09 11:29:47 +02:00
xmflsct 621ed3561d Bump up packages 2022-07-09 00:27:02 +02:00
xmflsct 87ff05d132 Apple Silicon ready
https://developer.apple.com/forums/thread/670006
2022-07-09 00:07:59 +02:00
Zhiyuan Zheng 249320a3b5 Target translation language rule
App language may be in en while the spoken language is others, due to limited translation options
2022-06-26 22:59:46 +02:00
Zhiyuan Zheng 6f774d8c13 Fixed #350 2022-06-26 22:56:21 +02:00
Zhiyuan Zheng c457141e10 Fix source map missing 2022-06-25 00:51:13 +02:00
xmflsct 239de22116
New Crowdin updates (#346)
* New translations instance.json (Italian)

* New translations timeline.json (Italian)

* New translations mediaSelector.json (Italian)

* New translations actions.json (Italian)

* New translations compose.json (Italian)

* New translations tabs.json (Italian)

* New translations contextMenu.json (Italian)

* New translations mediaSelector.json (Italian)

* New translations contextMenu.json (Italian)
2022-06-21 23:56:45 +02:00
Zhiyuan Zheng 0f8befc89c Fixed #348 2022-06-21 23:50:49 +02:00
Zhiyuan Zheng 29977b6c9e Fixed #347 2022-06-21 23:45:11 +02:00
Zhiyuan Zheng 41d85bf738 Fix row flexbox 2022-06-21 23:31:31 +02:00
Zhiyuan Zheng ca810065f8 Force clearing push count 2022-06-21 23:10:40 +02:00
Zhiyuan Zheng 869524eb84 Fix uploading avatar 2022-06-21 23:05:29 +02:00
xmflsct 1ebf732679
New translations contextMenu.json (Vietnamese) (#343) 2022-06-19 12:52:31 +02:00
Zhiyuan Zheng 778ff18457 Do not catch language detection failure 2022-06-19 12:52:11 +02:00
Zhiyuan Zheng 24d179eee7 Fixed #344 2022-06-19 12:51:44 +02:00
Zhiyuan Zheng 544910f0ed Fix iOS dots 2022-06-17 00:14:32 +02:00
Zhiyuan Zheng 16eaba14aa Allow Android drop menu instead of long press 2022-06-17 00:10:15 +02:00
Zhiyuan Zheng d5104bf6f8 Allowing toot to be copied when highlighted 2022-06-16 23:34:06 +02:00
Zhiyuan Zheng 8d0fc94303 Allow Android to have moving image 2022-06-16 23:22:28 +02:00
Zhiyuan Zheng 3cbcb6b3f9 Try using bearer token 2022-06-15 00:57:19 +02:00
Zhiyuan Zheng 04d2f5fa98 Add in PAT to prevent rate limiting 2022-06-15 00:39:45 +02:00
xmflsct 1ca41e5b14
New Crowdin updates (#340)
* New translations timeline.json (German)

* New translations timeline.json (Korean)

* New translations timeline.json (Chinese Simplified)

* New translations timeline.json (Vietnamese)

* New translations timeline.json (Portuguese, Brazilian)

* New translations contextMenu.json (German)

* New translations contextMenu.json (Italian)

* New translations contextMenu.json (Korean)

* New translations contextMenu.json (Chinese Simplified)

* New translations contextMenu.json (Chinese Traditional)

* New translations contextMenu.json (Vietnamese)

* New translations timeline.json (Italian)

* New translations contextMenu.json (Portuguese, Brazilian)

* New translations timeline.json (German)

* New translations timeline.json (Korean)

* New translations timeline.json (Chinese Simplified)

* New translations timeline.json (Vietnamese)

* New translations timeline.json (Portuguese, Brazilian)

* New translations contextMenu.json (German)

* New translations contextMenu.json (Italian)

* New translations contextMenu.json (Korean)

* New translations contextMenu.json (Chinese Simplified)

* New translations contextMenu.json (Vietnamese)

* New translations timeline.json (Italian)

* New translations contextMenu.json (Portuguese, Brazilian)
2022-06-15 00:20:46 +02:00
Zhiyuan Zheng e396953ac8 Improve menu row when content are long/short 2022-06-15 00:20:29 +02:00
Zhiyuan Zheng df80135226 Fixed #325 2022-06-15 00:00:33 +02:00
Zhiyuan Zheng 7c0bcbeb06 Fixed #337 2022-06-14 23:43:11 +02:00
Zhiyuan Zheng 04813cbc78 Fixed again #326 2022-06-14 23:35:52 +02:00
Zhiyuan Zheng 236ccbe45d Fixed #338
Also Android cannot read from ID, using index instead
2022-06-14 23:32:35 +02:00
Zhiyuan Zheng 85039db137 Fix context menu language missing 2022-06-12 12:30:53 +02:00
123 changed files with 5099 additions and 4511 deletions

View File

@ -39,6 +39,7 @@ jobs:
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }}
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }}
GH_PAT_GET_RELEASE: ${{ secrets.GITHUB_TOKEN }}
run: yarn app:build ios
build-android:
@ -73,6 +74,7 @@ jobs:
ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
ANDROID_KEYSTORE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }}
SUPPLY_JSON_KEY_DATA: ${{ secrets.SUPPLY_JSON_KEY_DATA }}
GH_PAT_GET_RELEASE: ${{ secrets.GITHUB_TOKEN }}
run: yarn app:build android
create-release:
@ -108,10 +110,13 @@ jobs:
ENVIRONMENT: ${{ steps.branch.outputs.branch }}
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
SENTRY_ORGANIZATION: ${{ secrets.SENTRY_ORGANIZATION }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
ANDROID_KEYSTORE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }}
GH_PAT_GET_RELEASE: ${{ secrets.GH_PAT_GET_RELEASE }}
GH_PAT_GET_RELEASE: ${{ secrets.GITHUB_TOKEN }}
FL_GITHUB_RELEASE_API_BEARER: ${{ secrets.GITHUB_TOKEN }}
run: yarn app:build release

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
ios/.xcode.env.local
# Android/IntelliJ
#

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"javascript.inlayHints.functionLikeReturnTypes.enabled": false
}

View File

@ -149,7 +149,7 @@ private_lane :build_android_apk do
end
lane :ios do
releaseExists = get_github_release(url: GITHUB_REPO, version: "v#{VERSION}", api_token: ENV['GH_PAT_GET_RELEASE'])
releaseExists = get_github_release(url: GITHUB_REPO, version: "v#{VERSION}", api_bearer: ENV['GH_PAT_GET_RELEASE'])
if releaseExists
puts("Release #{GITHUB_RELEASE} exists. Continue with building React Native only.")
else
@ -161,7 +161,7 @@ lane :ios do
end
lane :android do
releaseExists = get_github_release(url: GITHUB_REPO, version: "v#{VERSION}", api_token: ENV['GH_PAT_GET_RELEASE'])
releaseExists = get_github_release(url: GITHUB_REPO, version: "v#{VERSION}", api_bearer: ENV['GH_PAT_GET_RELEASE'])
if releaseExists
puts("Release #{GITHUB_RELEASE} exists. Continue with building React Native only.")
else
@ -172,7 +172,7 @@ lane :android do
end
lane :release do
releaseExists = get_github_release(url: GITHUB_REPO, version: "v#{VERSION}", api_token: ENV['GH_PAT_GET_RELEASE'])
releaseExists = get_github_release(url: GITHUB_REPO, version: "v#{VERSION}", api_bearer: ENV['GH_PAT_GET_RELEASE'])
if !releaseExists
build_android_apk
set_github_release(

10
ios/.xcode.env Normal file
View File

@ -0,0 +1,10 @@
# This `.xcode.env` file is versioned and is used to source the environment
# used when running script phases inside Xcode.
# To customize your local environment, you can create an `.xcode.env.local`
# file that is not versioned.
# NODE_BINARY variable contains the PATH to the node executable.
#
# Customize the NODE_BINARY variable here.
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)

View File

@ -2,22 +2,16 @@ require File.join(File.dirname(`node --print "require.resolve('expo/package.json
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")
platform :ios, '12.0'
platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false
production = ENV["PRODUCTION"] == "1"
require 'json'
podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {}
target 'tooot' do
use_expo_modules!
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
config = use_native_modules!
# Flags change depending on the env values.
@ -25,27 +19,33 @@ target 'tooot' do
use_react_native!(
:path => config[:reactNativePath],
:production => production,
:hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes',
:fabric_enabled => flags[:fabric_enabled],
:flipper_configuration => FlipperConfiguration.enabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
# For share extension
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
end
end
end
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
end
target 'ShareExtension' do

File diff suppressed because it is too large Load Diff

View File

@ -72,7 +72,7 @@
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = tooot/SplashScreen.storyboard; sourceTree = "<group>"; };
B96B72E5384D44A7B240B27E /* GoogleService-Info.plist */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "tooot/GoogleService-Info.plist"; sourceTree = "<group>"; };
BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = "<group>"; };
DF8133F098604A10B0D94952 /* boop.mp3 */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = boop.mp3; path = tooot/boop.mp3; sourceTree = "<group>"; };
DF8133F098604A10B0D94952 /* boop.mp3 */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = boop.mp3; path = tooot/boop.mp3; sourceTree = "<group>"; };
E613A80A28282A01003C97D6 /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = tooot/AppDelegate.mm; sourceTree = "<group>"; };
E633A420281EAEAB000E540F /* ShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = ShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
E633A427281EAEAB000E540F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@ -333,13 +333,15 @@
files = (
);
inputPaths = (
"$(SRCROOT)/.xcode.env.local",
"$(SRCROOT)/.xcode.env",
);
name = "Bundle React Native code and images";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n../node_modules/expo-constants/scripts/get-app-config-ios.sh\n";
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
08A4A3CD28434E44B6B9DE2E /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
@ -370,10 +372,16 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-tooot/Pods-tooot-frameworks.sh",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework/double-conversion",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework/glog",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework/hermes",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/double-conversion.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework",
);
runOnlyForDeploymentPostprocessing = 0;
@ -390,17 +398,13 @@
"${PODS_ROOT}/Target Support Files/Pods-tooot/Pods-tooot-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/EXUpdates/EXUpdates.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker/QBImagePicker.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/TOCropViewController/TOCropViewControllerBundle.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXUpdates.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QBImagePicker.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TOCropViewControllerBundle.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
@ -524,7 +528,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 6C2E3173556A471DD304B334 /* Pods-tooot.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = tooot/tooot.entitlements;
@ -533,13 +536,12 @@
CURRENT_PROJECT_VERSION = 2102022230;
DEVELOPMENT_TEAM = 8EGBLQ2MA6;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"FB_SONARKIT_ENABLED=1",
);
INFOPLIST_FILE = tooot/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
"$(inherited)",
@ -564,7 +566,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7A4D352CD337FB3A3BF06240 /* Pods-tooot.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = tooot/tooot.entitlements;
@ -572,9 +573,8 @@
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2102022230;
DEVELOPMENT_TEAM = 8EGBLQ2MA6;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = tooot/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
"$(inherited)",
@ -599,7 +599,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@ -644,15 +644,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(inherited)\"",
);
LIBRARY_SEARCH_PATHS = "\"\"";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
};
name = Debug;
@ -662,7 +659,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@ -700,14 +697,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(inherited)\"",
);
LIBRARY_SEARCH_PATHS = "\"\"";
MTL_ENABLE_DEBUG_INFO = NO;
ONLY_ACTIVE_ARCH = NO;
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
VALIDATE_PRODUCT = YES;
@ -736,7 +731,7 @@
INFOPLIST_FILE = ShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShareExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 1.0;
@ -781,7 +776,7 @@
INFOPLIST_FILE = ShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShareExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 1.0;

View File

@ -19,6 +19,8 @@
#import <react/config/ReactNativeConfig.h>
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
RCTTurboModuleManager *_turboModuleManager;
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
@ -46,6 +48,9 @@
UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
// NSDictionary *initProps = [self prepareInitialProps];
// UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"tooot", initProps);
if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor colorNamed:@"SplashScreenBackgroundColor"];
} else {
@ -61,6 +66,25 @@
return YES;
}
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
///
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
- (BOOL)concurrentRootEnabled
{
// Switch this bool to turn on and off the concurrent root
return false;
}
- (NSDictionary *)prepareInitialProps
{
NSMutableDictionary *initProps = [NSMutableDictionary new];
#ifdef RCT_NEW_ARCH_ENABLED
initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
#endif
return initProps;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG

View File

@ -1,11 +1,11 @@
{
"name": "tooot",
"versions": {
"native": "220603",
"native": "220806",
"major": 4,
"minor": 1,
"minor": 3,
"patch": 0,
"expo": "45.0.0"
"expo": "46.0.0"
},
"description": "tooot app for Mastodon",
"author": "xmflsct <me@xmflsct.com>",
@ -25,112 +25,106 @@
"postinstall": "patch-package"
},
"dependencies": {
"@expo/react-native-action-sheet": "3.13.0",
"@formatjs/intl-datetimeformat": "^6.0.2",
"@expo/react-native-action-sheet": "^3.13.0",
"@formatjs/intl-datetimeformat": "^6.0.3",
"@formatjs/intl-getcanonicallocales": "^2.0.2",
"@formatjs/intl-locale": "^3.0.2",
"@formatjs/intl-numberformat": "^8.0.2",
"@formatjs/intl-pluralrules": "^5.0.2",
"@formatjs/intl-relativetimeformat": "^11.0.2",
"@mattermost/react-native-paste-input": "^0.4.2",
"@neverdull-agency/expo-unlimited-secure-store": "1.0.10",
"@react-native-async-storage/async-storage": "1.17.6",
"@react-native-community/blur": "3.6.0",
"@react-native-community/cameraroll": "4.1.2",
"@react-native-community/netinfo": "9.0.0",
"@react-native-community/segmented-control": "2.2.2",
"@react-navigation/bottom-tabs": "6.3.1",
"@react-navigation/native": "6.0.10",
"@react-navigation/native-stack": "6.6.2",
"@react-navigation/stack": "6.2.1",
"@reduxjs/toolkit": "1.8.2",
"@sentry/react-native": "3.4.3",
"@sharcoux/slider": "6.0.3",
"axios": "0.27.2",
"expo": "45.0.5",
"expo-auth-session": "3.6.1",
"expo-av": "11.2.3",
"expo-constants": "^13.1.1",
"expo-crypto": "10.2.0",
"expo-device": "4.2.0",
"expo-file-system": "14.0.0",
"expo-firebase-analytics": "7.0.0",
"expo-haptics": "11.2.0",
"expo-image-manipulator": "^10.3.1",
"expo-image-picker": "13.1.1",
"expo-linking": "3.1.0",
"expo-localization": "13.0.0",
"expo-notifications": "0.15.2",
"expo-random": "12.2.0",
"expo-screen-capture": "4.2.0",
"expo-secure-store": "11.2.0",
"expo-splash-screen": "0.15.1",
"expo-store-review": "5.2.0",
"expo-updates": "0.13.2",
"expo-video-thumbnails": "6.3.0",
"expo-web-browser": "10.2.1",
"i18next": "21.8.8",
"li": "1.3.0",
"lodash": "4.17.21",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.17.0",
"react-intl": "^6.0.4",
"react-native": "0.68.2",
"react-native-animated-spinkit": "1.5.2",
"@formatjs/intl-locale": "^3.0.3",
"@formatjs/intl-numberformat": "^8.0.4",
"@formatjs/intl-pluralrules": "^5.0.3",
"@formatjs/intl-relativetimeformat": "^11.0.3",
"@mattermost/react-native-paste-input": "^0.5.0",
"@neverdull-agency/expo-unlimited-secure-store": "^1.0.10",
"@react-native-async-storage/async-storage": "^1.17.7",
"@react-native-community/blur": "^4.2.0",
"@react-native-community/cameraroll": "^4.1.2",
"@react-native-community/netinfo": "^9.3.0",
"@react-native-community/segmented-control": "^2.2.2",
"@react-navigation/bottom-tabs": "^6.3.2",
"@react-navigation/native": "^6.0.11",
"@react-navigation/native-stack": "^6.7.0",
"@react-navigation/stack": "^6.2.2",
"@reduxjs/toolkit": "^1.8.3",
"@sentry/react-native": "^4.2.2",
"@sharcoux/slider": "^6.0.3",
"axios": "^0.27.2",
"expo": "^46.0.2",
"expo-auth-session": "^3.7.1",
"expo-av": "^12.0.3",
"expo-constants": "^13.2.3",
"expo-crypto": "^11.0.0",
"expo-device": "^4.3.0",
"expo-file-system": "^14.1.0",
"expo-firebase-analytics": "^7.1.1",
"expo-haptics": "^11.3.0",
"expo-linking": "^3.2.2",
"expo-localization": "^13.1.0",
"expo-notifications": "^0.16.1",
"expo-random": "^12.3.0",
"expo-screen-capture": "^4.3.0",
"expo-secure-store": "^11.3.0",
"expo-splash-screen": "^0.16.1",
"expo-store-review": "^5.3.0",
"expo-updates": "^0.14.3",
"expo-video-thumbnails": "^6.4.0",
"expo-web-browser": "^11.0.0",
"i18next": "^21.8.16",
"li": "^1.3.0",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^11.18.3",
"react-intl": "^6.0.5",
"react-native": "^0.69.3",
"react-native-animated-spinkit": "^1.5.2",
"react-native-base64": "^0.2.1",
"react-native-blurhash": "1.1.10",
"react-native-blurhash": "^1.1.10",
"react-native-context-menu-view": "xmflsct/react-native-context-menu-view",
"react-native-fast-image": "8.5.11",
"react-native-feather": "1.1.2",
"react-native-flash-message": "0.2.1",
"react-native-gesture-handler": "2.4.2",
"react-native-htmlview": "0.16.0",
"react-native-image-crop-picker": "^0.37.3",
"react-native-fast-image": "^8.5.11",
"react-native-feather": "^1.1.2",
"react-native-flash-message": "^0.3.1",
"react-native-gesture-handler": "^2.5.0",
"react-native-htmlview": "^0.16.0",
"react-native-image-picker": "^4.8.4",
"react-native-language-detection": "^0.1.0",
"react-native-pager-view": "5.4.11",
"react-native-reanimated": "2.8.0",
"react-native-safe-area-context": "4.3.1",
"react-native-screens": "3.13.1",
"react-native-pager-view": "^5.4.25",
"react-native-reanimated": "^2.9.1",
"react-native-safe-area-context": "^4.3.1",
"react-native-screens": "^3.15.0",
"react-native-share-menu": "^5.0.5",
"react-native-svg": "12.3.0",
"react-native-swipe-list-view": "3.2.9",
"react-native-tab-view": "3.1.1",
"react-query": "3.39.1",
"react-redux": "8.0.2",
"redux-persist": "6.0.0",
"rn-placeholder": "3.0.3",
"sentry-expo": "4.2.0",
"tslib": "2.4.0",
"valid-url": "1.0.9"
"react-native-svg": "^12.4.3",
"react-native-swipe-list-view": "^3.2.9",
"react-native-tab-view": "^3.1.1",
"react-query": "^3.39.2",
"react-redux": "^8.0.2",
"redux-persist": "^6.0.0",
"rn-placeholder": "^3.0.3",
"sentry-expo": "^5.0.1",
"tslib": "^2.4.0",
"valid-url": "^1.0.9"
},
"devDependencies": {
"@babel/core": "7.18.2",
"@babel/plugin-proposal-optional-chaining": "7.17.12",
"@babel/preset-react": "^7.17.12",
"@babel/preset-typescript": "7.17.12",
"@expo/config": "6.0.24",
"@types/lodash": "4.14.182",
"@types/react": "17.0.43",
"@types/react-dom": "17.0.14",
"@types/react-native": "0.67.8",
"@babel/core": "^7.18.10",
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@expo/config": "^7.0.0",
"@types/lodash": "^4.14.182",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@types/react-native": "^0.69.5",
"@types/react-native-base64": "^0.2.0",
"@types/react-native-share-menu": "^5.0.2",
"@types/react-timeago": "4.1.3",
"@types/valid-url": "1.0.3",
"@welldone-software/why-did-you-render": "7.0.1",
"babel-plugin-module-resolver": "4.1.0",
"babel-plugin-transform-remove-console": "6.9.4",
"chalk": "4.1.2",
"dotenv": "16.0.1",
"patch-package": "6.4.7",
"postinstall-postinstall": "2.1.0",
"react-native-clean-project": "4.0.1",
"typescript": "4.7.3"
},
"resolutions": {
"@types/react": "17.0.43",
"@types/react-dom": "17.0.14"
"@types/react-timeago": "^4.1.3",
"@types/valid-url": "^1.0.3",
"@welldone-software/why-did-you-render": "^7.0.1",
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"chalk": "^4.1.2",
"dotenv": "^16.0.1",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0",
"react-native-clean-project": "^4.0.1",
"typescript": "^4.7.4"
},
"expo": {
"autolinking": {
@ -154,4 +148,4 @@
}
}
}
}
}

View File

@ -1,5 +1,5 @@
diff --git a/node_modules/react-native-fast-image/RNFastImage.podspec b/node_modules/react-native-fast-image/RNFastImage.podspec
index db0fada..54d8d5b 100644
index db0fada..9379119 100644
--- a/node_modules/react-native-fast-image/RNFastImage.podspec
+++ b/node_modules/react-native-fast-image/RNFastImage.podspec
@@ -16,6 +16,6 @@ Pod::Spec.new do |s|
@ -7,8 +7,9 @@ index db0fada..54d8d5b 100644
s.dependency 'React-Core'
- s.dependency 'SDWebImage', '~> 5.11.1'
+ s.dependency 'SDWebImage', '~> 5.12.5'
s.dependency 'SDWebImageWebPCoder', '~> 0.8.4'
- s.dependency 'SDWebImageWebPCoder', '~> 0.8.4'
+ s.dependency 'SDWebImage', '~> 5.13.2'
+ s.dependency 'SDWebImageWebPCoder', '~> 0.9.0'
end
diff --git a/node_modules/react-native-fast-image/android/build.gradle b/node_modules/react-native-fast-image/android/build.gradle
index 5b21cd5..19d82f8 100644

View File

@ -0,0 +1,22 @@
diff --git a/node_modules/react-native-htmlview/HTMLView.js b/node_modules/react-native-htmlview/HTMLView.js
index 43f8b7e..728112b 100644
--- a/node_modules/react-native-htmlview/HTMLView.js
+++ b/node_modules/react-native-htmlview/HTMLView.js
@@ -1,7 +1,7 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import htmlToElement from './htmlToElement';
-import {Linking, Platform, StyleSheet, View, ViewPropTypes} from 'react-native';
+import {Linking, Platform, StyleSheet, View} from 'react-native';
const boldStyle = {fontWeight: 'bold'};
const italicStyle = {fontStyle: 'italic'};
@@ -146,7 +146,7 @@ HtmlView.propTypes = {
renderNode: PropTypes.func,
RootComponent: PropTypes.func,
rootComponentProps: PropTypes.object,
- style: ViewPropTypes.style,
+ style: PropTypes.any,
stylesheet: PropTypes.object,
TextComponent: PropTypes.func,
textComponentProps: PropTypes.object,

View File

@ -74,37 +74,6 @@ const App: React.FC = () => {
}
}, [])
const children = useCallback(
bootstrapped => {
log('log', 'App', 'bootstrapped')
if (bootstrapped) {
log('log', 'App', 'loading actual app :)')
const language = getSettingsLanguage(store.getState())
if (!language) {
store.dispatch(changeLanguage('en'))
i18n.changeLanguage('en')
} else {
i18n.changeLanguage(language)
}
return (
<Sentry.Native.TouchEventBoundary>
<ActionSheetProvider>
<AccessibilityManager>
<ThemeManager>
<Screens localCorrupt={localCorrupt} />
</ThemeManager>
</AccessibilityManager>
</ActionSheetProvider>
</Sentry.Native.TouchEventBoundary>
)
} else {
return null
}
},
[localCorrupt]
)
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<QueryClientProvider client={queryClient}>
@ -112,7 +81,33 @@ const App: React.FC = () => {
<PersistGate
persistor={persistor}
onBeforeLift={onBeforeLift}
children={children}
children={bootstrapped => {
log('log', 'App', 'bootstrapped')
if (bootstrapped) {
log('log', 'App', 'loading actual app :)')
const language = getSettingsLanguage(store.getState())
if (!language) {
store.dispatch(changeLanguage('en'))
i18n.changeLanguage('en')
} else {
i18n.changeLanguage(language)
}
return (
<Sentry.Native.TouchEventBoundary>
<ActionSheetProvider>
<AccessibilityManager>
<ThemeManager>
<Screens localCorrupt={localCorrupt} />
</ThemeManager>
</AccessibilityManager>
</ActionSheetProvider>
</Sentry.Native.TouchEventBoundary>
)
} else {
return null
}
}}
/>
</Provider>
</QueryClientProvider>

View File

@ -170,6 +170,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
}
| { data: string | string[]; mimeType: string }
) => {
console.log('item', item)
if (instanceActive < 0) {
return
}
@ -253,6 +254,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
if (!text && !media.length) {
return
} else {
console.log('media', media)
navigationRef.navigate('Screen-Compose', { type: 'share', text, media })
}
},
@ -271,8 +273,9 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
return (
<IntlProvider locale={i18n.language}>
<StatusBar
{...(Platform.OS === 'ios' && {
backgroundColor: colors.backgroundDefault
backgroundColor={colors.backgroundDefault}
{...(Platform.OS === 'android' && {
barStyle: theme === 'light' ? 'dark-content' : 'light-content'
})}
/>
<NavigationContainer

View File

@ -1,5 +1,6 @@
import analytics from '@components/analytics'
import { displayMessage } from '@components/Message'
import { useRelationshipQuery } from '@utils/queryHooks/relationship'
import {
MutationVarsTimelineUpdateAccountProperty,
QueryKeyTimeline,
@ -8,13 +9,13 @@ import {
import { getInstanceAccount } from '@utils/slices/instancesSlice'
import { useTheme } from '@utils/styles/ThemeManager'
import { useTranslation } from 'react-i18next'
import { Platform } from 'react-native'
import { ContextMenuAction } from 'react-native-context-menu-view'
import { useQueryClient } from 'react-query'
import { useSelector } from 'react-redux'
export interface Props {
actions: ContextMenuAction[]
type: 'status' | 'account' // Do not need to fetch relationship in timeline
queryKey?: QueryKeyTimeline
rootQueryKey?: QueryKeyTimeline
id: Mastodon.Account['id']
@ -22,6 +23,7 @@ export interface Props {
const contextMenuAccount = ({
actions,
type,
queryKey,
rootQueryKey,
id: accountId
@ -32,12 +34,17 @@ const contextMenuAccount = ({
const queryClient = useQueryClient()
const mutateion = useTimelineMutation({
onSuccess: (_, params) => {
queryClient.refetchQueries(['Relationship', { id: accountId }])
const theParams = params as MutationVarsTimelineUpdateAccountProperty
displayMessage({
theme,
type: 'success',
message: t('common:message.success.message', {
function: t(`account.${theParams.payload.property}.action`)
function: t(`account.${theParams.payload.property}.action`, {
...(typeof theParams.payload.currentValue === 'boolean' && {
context: theParams.payload.currentValue.toString()
})
})
})
})
},
@ -47,7 +54,11 @@ const contextMenuAccount = ({
theme,
type: 'error',
message: t('common:message.error.message', {
function: t(`account.${theParams.payload.property}.action`)
function: t(`account.${theParams.payload.property}.action`, {
...(typeof theParams.payload.currentValue === 'boolean' && {
context: theParams.payload.currentValue.toString()
})
})
}),
...(err.status &&
typeof err.status === 'number' &&
@ -70,93 +81,70 @@ const contextMenuAccount = ({
)
const ownAccount = instanceAccount?.id === accountId
const { data: relationship } = useRelationshipQuery({
id: accountId,
options: { enabled: type === 'account' }
})
if (!ownAccount) {
switch (Platform.OS) {
case 'ios':
actions.push({
id: 'account',
title: t('account.title'),
inlineChildren: true,
actions: [
{
id: 'account-mute',
title: t('account.mute.action'),
systemIcon: 'eye.slash'
},
{
id: 'account-block',
title: t('account.block.action'),
systemIcon: 'xmark.circle',
destructive: true
},
{
id: 'account-reports',
title: t('account.reports.action'),
systemIcon: 'flag',
destructive: true
}
]
})
break
default:
actions.push(
{
id: 'account-mute',
title: t('account.mute.action'),
systemIcon: 'eye.slash'
},
{
id: 'account-block',
title: t('account.block.action'),
systemIcon: 'xmark.circle',
destructive: true
},
{
id: 'account-reports',
title: t('account.reports.action'),
systemIcon: 'flag',
destructive: true
}
)
break
}
actions.push(
{
id: 'account-mute',
title: t('account.mute.action', {
context: (relationship?.muting || false).toString()
}),
systemIcon: 'eye.slash'
},
{
id: 'account-block',
title: t('account.block.action', {
context: (relationship?.blocking || false).toString()
}),
systemIcon: 'xmark.circle',
destructive: true
},
{
id: 'account-reports',
title: t('account.reports.action'),
systemIcon: 'flag',
destructive: true
}
)
}
return (id: string) => {
switch (id) {
case 'account-mute':
analytics('timeline_shared_headeractions_account_mute_press', {
page: queryKey && queryKey[1].page
})
mutateion.mutate({
type: 'updateAccountProperty',
queryKey,
id: accountId,
payload: { property: 'mute' }
})
break
case 'account-block':
analytics('timeline_shared_headeractions_account_block_press', {
page: queryKey && queryKey[1].page
})
mutateion.mutate({
type: 'updateAccountProperty',
queryKey,
id: accountId,
payload: { property: 'block' }
})
break
case 'account-report':
analytics('timeline_shared_headeractions_account_reports_press', {
page: queryKey && queryKey[1].page
})
mutateion.mutate({
type: 'updateAccountProperty',
queryKey,
id: accountId,
payload: { property: 'reports' }
})
break
return (index: number) => {
if (actions[index].id === 'account-mute') {
analytics('timeline_shared_headeractions_account_mute_press', {
page: queryKey && queryKey[1].page
})
mutateion.mutate({
type: 'updateAccountProperty',
queryKey,
id: accountId,
payload: { property: 'mute', currentValue: relationship?.muting }
})
}
if (actions[index].id === 'account-block') {
analytics('timeline_shared_headeractions_account_block_press', {
page: queryKey && queryKey[1].page
})
mutateion.mutate({
type: 'updateAccountProperty',
queryKey,
id: accountId,
payload: { property: 'block', currentValue: relationship?.blocking }
})
}
if (actions[index].id === 'account-report') {
analytics('timeline_shared_headeractions_account_reports_press', {
page: queryKey && queryKey[1].page
})
mutateion.mutate({
type: 'updateAccountProperty',
queryKey,
id: accountId,
payload: { property: 'reports' }
})
}
}
}

View File

@ -29,7 +29,7 @@ const contextMenuInstance = ({
const { theme } = useTheme()
const currentInstance = useSelector(getInstanceUrl)
const instance = status.uri && status.uri.split(new RegExp(/\/\/(.*?)\//))[1]
const instance = status?.uri && status.uri.split(new RegExp(/\/\/(.*?)\//))[1]
const queryClient = useQueryClient()
const mutation = useTimelineMutation({
@ -71,36 +71,38 @@ const contextMenuInstance = ({
}
}
return (id: string) => {
switch (id) {
case 'instance-block':
analytics('timeline_shared_headeractions_domain_block_press', {
page: queryKey[1].page
})
Alert.alert(
t('instance.block.alert.title', { instance }),
t('instance.block.alert.message'),
[
{
text: t('instance.block.alert.buttons.confirm'),
style: 'destructive',
onPress: () => {
analytics(
'timeline_shared_headeractions_domain_block_confirm',
{ page: queryKey && queryKey[1].page }
)
mutation.mutate({
type: 'domainBlock',
queryKey,
domain: instance
})
}
},
{
text: t('common:buttons.cancel')
return (index: number) => {
if (
actions[index].id === 'instance-block' ||
(actions[index].id === 'instance' &&
actions[index].actions?.[0].id === 'instance-block')
) {
analytics('timeline_shared_headeractions_domain_block_press', {
page: queryKey[1].page
})
Alert.alert(
t('instance.block.alert.title', { instance }),
t('instance.block.alert.message'),
[
{
text: t('instance.block.alert.buttons.confirm'),
style: 'destructive',
onPress: () => {
analytics('timeline_shared_headeractions_domain_block_confirm', {
page: queryKey && queryKey[1].page
})
mutation.mutate({
type: 'domainBlock',
queryKey,
domain: instance
})
}
]
)
},
{
text: t('common:buttons.cancel')
}
]
)
}
}
}

View File

@ -18,19 +18,17 @@ const contextMenuShare = ({ actions, type, url }: Props) => {
systemIcon: 'square.and.arrow.up'
})
return (id: string) => {
switch (id) {
case 'share':
analytics('timeline_shared_headeractions_share_press')
switch (Platform.OS) {
case 'ios':
Share.share({ url })
break
case 'android':
Share.share({ message: url })
break
}
break
return (index: number) => {
if (actions[index].id === 'share') {
analytics('timeline_shared_headeractions_share_press')
switch (Platform.OS) {
case 'ios':
Share.share({ url })
break
case 'android':
Share.share({ message: url })
break
}
}
}
}

View File

@ -15,7 +15,7 @@ import {
} from '@utils/slices/instancesSlice'
import { useTheme } from '@utils/styles/ThemeManager'
import { useTranslation } from 'react-i18next'
import { Alert, Platform } from 'react-native'
import { Alert } from 'react-native'
import { ContextMenuAction } from 'react-native-context-menu-view'
import { useQueryClient } from 'react-query'
import { useSelector } from 'react-redux'
@ -70,7 +70,7 @@ const contextMenuStatus = ({
getInstanceAccount,
(prev, next) => prev.id === next.id
)
const ownAccount = instanceAccount?.id === status.account.id
const ownAccount = instanceAccount?.id === status?.account.id
if (ownAccount) {
const accountMenuItems: ContextMenuAction[] = [
@ -88,7 +88,7 @@ const contextMenuStatus = ({
},
{
id: 'status-mute',
title: t('status.mute.action-muted', {
title: t('status.mute.action', {
context: status.muted.toString()
}),
systemIcon: status.muted ? 'speaker' : 'speaker.slash'
@ -107,178 +107,161 @@ const contextMenuStatus = ({
if (status.visibility === 'public' || status.visibility === 'unlisted') {
accountMenuItems.push({
id: 'status-pin',
title: t('status.pin.action-pinned', {
title: t('status.pin.action', {
context: status.pinned.toString()
}),
systemIcon: status.pinned ? 'pin.slash' : 'pin'
})
}
switch (Platform.OS) {
case 'ios':
actions.push({
id: 'status',
title: t('status.title'),
inlineChildren: true,
actions: accountMenuItems
})
break
default:
actions.push(...accountMenuItems)
break
}
actions.push(...accountMenuItems)
}
return async (id: string) => {
switch (id) {
case 'status-delete':
analytics('timeline_shared_headeractions_status_delete_press', {
page: queryKey && queryKey[1].page
})
Alert.alert(
t('status.delete.alert.title'),
t('status.delete.alert.message'),
[
{
text: t('status.delete.alert.buttons.confirm'),
style: 'destructive',
onPress: async () => {
analytics(
'timeline_shared_headeractions_status_delete_confirm',
{
page: queryKey && queryKey[1].page
}
)
mutation.mutate({
return async (index: number) => {
if (actions[index].id === 'status-delete') {
analytics('timeline_shared_headeractions_status_delete_press', {
page: queryKey && queryKey[1].page
})
Alert.alert(
t('status.delete.alert.title'),
t('status.delete.alert.message'),
[
{
text: t('status.delete.alert.buttons.confirm'),
style: 'destructive',
onPress: async () => {
analytics('timeline_shared_headeractions_status_delete_confirm', {
page: queryKey && queryKey[1].page
})
mutation.mutate({
type: 'deleteItem',
source: 'statuses',
queryKey,
rootQueryKey,
id: status.id
})
}
},
{
text: t('common:buttons.cancel')
}
]
)
}
if (actions[index].id === 'status-delete-edit') {
analytics('timeline_shared_headeractions_status_deleteedit_press', {
page: queryKey && queryKey[1].page
})
Alert.alert(
t('status.deleteEdit.alert.title'),
t('status.deleteEdit.alert.message'),
[
{
text: t('status.deleteEdit.alert.buttons.confirm'),
style: 'destructive',
onPress: async () => {
analytics(
'timeline_shared_headeractions_status_deleteedit_confirm',
{
page: queryKey && queryKey[1].page
}
)
let replyToStatus: Mastodon.Status | undefined = undefined
if (status.in_reply_to_id) {
replyToStatus = await apiInstance<Mastodon.Status>({
method: 'get',
url: `statuses/${status.in_reply_to_id}`
}).then(res => res.body)
}
mutation
.mutateAsync({
type: 'deleteItem',
source: 'statuses',
queryKey,
rootQueryKey,
id: status.id
})
}
},
{
text: t('common:buttons.cancel')
}
]
)
break
case 'status-delete-edit':
analytics('timeline_shared_headeractions_status_deleteedit_press', {
page: queryKey && queryKey[1].page
})
Alert.alert(
t('status.deleteEdit.alert.title'),
t('status.deleteEdit.alert.message'),
[
{
text: t('status.deleteEdit.alert.buttons.confirm'),
style: 'destructive',
onPress: async () => {
analytics(
'timeline_shared_headeractions_status_deleteedit_confirm',
{
page: queryKey && queryKey[1].page
}
)
let replyToStatus: Mastodon.Status | undefined = undefined
if (status.in_reply_to_id) {
replyToStatus = await apiInstance<Mastodon.Status>({
method: 'get',
url: `statuses/${status.in_reply_to_id}`
}).then(res => res.body)
}
mutation
.mutateAsync({
type: 'deleteItem',
source: 'statuses',
queryKey,
id: status.id
.then(res => {
navigation.navigate('Screen-Compose', {
type: 'deleteEdit',
incomingStatus: res.body as Mastodon.Status,
...(replyToStatus && { replyToStatus }),
queryKey
})
.then(res => {
navigation.navigate('Screen-Compose', {
type: 'deleteEdit',
incomingStatus: res.body as Mastodon.Status,
...(replyToStatus && { replyToStatus }),
queryKey
})
})
}
},
{
text: t('common:buttons.cancel')
})
}
]
)
break
case 'status-mute':
analytics('timeline_shared_headeractions_status_mute_press', {
page: queryKey && queryKey[1].page
})
mutation.mutate({
type: 'updateStatusProperty',
queryKey,
rootQueryKey,
id: status.id,
payload: {
property: 'muted',
currentValue: status.muted,
propertyCount: undefined,
countValue: undefined
},
{
text: t('common:buttons.cancel')
}
})
break
case 'status-edit':
analytics('timeline_shared_headeractions_status_edit_press', {
page: queryKey && queryKey[1].page
})
let replyToStatus: Mastodon.Status | undefined = undefined
if (status.in_reply_to_id) {
replyToStatus = await apiInstance<Mastodon.Status>({
method: 'get',
url: `statuses/${status.in_reply_to_id}`
}).then(res => res.body)
]
)
}
if (actions[index].id === 'status-mute') {
analytics('timeline_shared_headeractions_status_mute_press', {
page: queryKey && queryKey[1].page
})
mutation.mutate({
type: 'updateStatusProperty',
queryKey,
rootQueryKey,
id: status.id,
payload: {
property: 'muted',
currentValue: status.muted,
propertyCount: undefined,
countValue: undefined
}
apiInstance<{
id: Mastodon.Status['id']
text: NonNullable<Mastodon.Status['text']>
spoiler_text: Mastodon.Status['spoiler_text']
}>({
})
}
if (actions[index].id === 'status-edit') {
analytics('timeline_shared_headeractions_status_edit_press', {
page: queryKey && queryKey[1].page
})
let replyToStatus: Mastodon.Status | undefined = undefined
if (status.in_reply_to_id) {
replyToStatus = await apiInstance<Mastodon.Status>({
method: 'get',
url: `statuses/${status.id}/source`
}).then(res => {
navigation.navigate('Screen-Compose', {
type: 'edit',
incomingStatus: {
...status,
text: res.body.text,
spoiler_text: res.body.spoiler_text
},
...(replyToStatus && { replyToStatus }),
queryKey,
rootQueryKey
})
})
break
case 'status-pin':
// Also note that reblogs cannot be pinned.
analytics('timeline_shared_headeractions_status_pin_press', {
page: queryKey && queryKey[1].page
})
mutation.mutate({
type: 'updateStatusProperty',
url: `statuses/${status.in_reply_to_id}`
}).then(res => res.body)
}
apiInstance<{
id: Mastodon.Status['id']
text: NonNullable<Mastodon.Status['text']>
spoiler_text: Mastodon.Status['spoiler_text']
}>({
method: 'get',
url: `statuses/${status.id}/source`
}).then(res => {
navigation.navigate('Screen-Compose', {
type: 'edit',
incomingStatus: {
...status,
text: res.body.text,
spoiler_text: res.body.spoiler_text
},
...(replyToStatus && { replyToStatus }),
queryKey,
rootQueryKey,
id: status.id,
payload: {
property: 'pinned',
currentValue: status.pinned,
propertyCount: undefined,
countValue: undefined
}
rootQueryKey
})
break
})
}
if (actions[index].id === 'status-pin') {
// Also note that reblogs cannot be pinned.
analytics('timeline_shared_headeractions_status_pin_press', {
page: queryKey && queryKey[1].page
})
mutation.mutate({
type: 'updateStatusProperty',
queryKey,
rootQueryKey,
id: status.id,
payload: {
property: 'pinned',
currentValue: status.pinned,
propertyCount: undefined,
countValue: undefined
}
})
}
}
}

View File

@ -7,6 +7,7 @@ import { chunk, forEach, groupBy, sortBy } from 'lodash'
import React, {
Dispatch,
MutableRefObject,
PropsWithChildren,
SetStateAction,
useCallback,
useEffect,
@ -57,7 +58,7 @@ export interface Props {
maxLength?: number
}
const ComponentEmojis: React.FC<Props> = ({
const ComponentEmojis: React.FC<Props & PropsWithChildren> = ({
enabled = false,
value,
setValue,

View File

@ -27,18 +27,6 @@ const EmojisList = React.memo(
const { emojisState, emojisDispatch } = useContext(EmojisContext)
const { colors } = useTheme()
const listHeader = useCallback(
({ section: { title } }) => (
<CustomText
fontStyle='S'
style={{ position: 'absolute', color: colors.secondary }}
>
{title}
</CustomText>
),
[]
)
const listItem = useCallback(
({ index, item }: { item: Mastodon.Emoji[]; index: number }) => {
return (
@ -112,7 +100,14 @@ const EmojisList = React.memo(
keyboardShouldPersistTaps='always'
sections={emojisState.emojis}
keyExtractor={item => item[0].shortcode}
renderSectionHeader={listHeader}
renderSectionHeader={({ section: { title } }) => (
<CustomText
fontStyle='S'
style={{ position: 'absolute', color: colors.secondary }}
>
{title}
</CustomText>
)}
renderItem={listItem}
windowSize={4}
/>

View File

@ -5,12 +5,14 @@ import {
AccessibilityProps,
Image,
ImageStyle,
Platform,
Pressable,
StyleProp,
StyleSheet,
View,
ViewStyle
} from 'react-native'
import FastImage from 'react-native-fast-image'
import { Blurhash } from 'react-native-blurhash'
// blurhas -> if blurhash, show before any loading succeed
@ -125,13 +127,24 @@ const GracefullyImage = ({
]}
/>
) : null}
<Image
fadeDuration={0}
source={source}
style={[{ flex: 1 }, imageStyle]}
onLoad={onLoad}
onError={onError}
/>
{Platform.OS === 'ios' ? (
<Image
fadeDuration={0}
source={source}
style={[{ flex: 1 }, imageStyle]}
onLoad={onLoad}
onError={onError}
/>
) : (
<FastImage
fadeDuration={0}
source={source}
// @ts-ignore
style={[{ flex: 1 }, imageStyle]}
onLoad={onLoad}
onError={onError}
/>
)}
{blurhashView}
</Pressable>
)

View File

@ -4,7 +4,6 @@ import { useTheme } from '@utils/styles/ThemeManager'
import React, {
Dispatch,
SetStateAction,
useCallback,
useEffect,
useRef,
useState
@ -81,10 +80,6 @@ const Input: React.FC<Props> = ({
}
: { start: 0, end: 0 }
)
const onSelectionChange = useCallback(
({ nativeEvent: { selection } }) => (selectionRange.current = selection),
[]
)
const [inputFocused, setInputFocused] = useState(false)
useEffect(() => {
@ -128,7 +123,9 @@ const Input: React.FC<Props> = ({
: undefined
}}
onChangeText={setValue}
onSelectionChange={onSelectionChange}
onSelectionChange={({ nativeEvent: { selection } }) =>
(selectionRange.current = selection)
}
value={value}
{...(multiline && {
multiline,

View File

@ -88,21 +88,6 @@ const ComponentInstance: React.FC<Props> = ({
}
}, [domain])
const onSubmitEditing = useCallback(
({ nativeEvent: { text } }) => {
analytics('instance_textinput_submit', { match: text === domain })
if (
text === domain &&
instanceQuery.isSuccess &&
instanceQuery.data &&
instanceQuery.data.uri
) {
processUpdate()
}
},
[domain, instanceQuery.isSuccess, instanceQuery.data]
)
const requestAuth = useMemo(() => {
if (
domain &&
@ -180,7 +165,17 @@ const ComponentInstance: React.FC<Props> = ({
clearButtonMode='never'
keyboardType='url'
textContentType='URL'
onSubmitEditing={onSubmitEditing}
onSubmitEditing={({ nativeEvent: { text } }) => {
analytics('instance_textinput_submit', { match: text === domain })
if (
text === domain &&
instanceQuery.isSuccess &&
instanceQuery.data &&
instanceQuery.data.uri
) {
processUpdate()
}
}}
placeholder={' ' + t('server.textInput.placeholder')}
placeholderTextColor={colors.secondary}
returnKeyType='go'

View File

@ -5,7 +5,7 @@ import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import { ColorDefinitions } from '@utils/styles/themes'
import React, { useMemo } from 'react'
import { StyleSheet, Text, View } from 'react-native'
import { View } from 'react-native'
import { Flow } from 'react-native-animated-spinkit'
import { State, Switch, TapGestureHandler } from 'react-native-gesture-handler'
@ -61,7 +61,7 @@ const MenuRow: React.FC<Props> = ({
return (
<View
style={styles.base}
style={{ minHeight: 50 }}
accessible
accessibilityRole={switchValue ? 'switch' : 'button'}
accessibilityState={switchValue ? { checked: switchValue } : undefined}
@ -78,14 +78,26 @@ const MenuRow: React.FC<Props> = ({
}}
>
<View style={{ flex: 1 }}>
<View style={styles.core}>
<View style={styles.front}>
<View
style={{
flex: 1,
flexDirection: 'row',
paddingTop: StyleConstants.Spacing.S
}}
>
<View
style={{
flexGrow: 3,
flexDirection: 'row',
alignItems: 'center'
}}
>
{iconFront && (
<Icon
name={iconFront}
size={StyleConstants.Font.Size.L}
color={colors[iconFrontColor]}
style={styles.iconFront}
style={{ marginRight: StyleConstants.Spacing.S }}
/>
)}
{badge ? (
@ -99,19 +111,25 @@ const MenuRow: React.FC<Props> = ({
}}
/>
) : null}
<View style={styles.main}>
<CustomText
fontStyle='M'
style={{ color: colors.primaryDefault }}
numberOfLines={1}
>
{title}
</CustomText>
</View>
<CustomText
fontStyle='M'
style={{ color: colors.primaryDefault }}
numberOfLines={1}
>
{title}
</CustomText>
</View>
{content || switchValue !== undefined || iconBack ? (
<View style={styles.back}>
<View
style={{
flexShrink: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'center',
marginLeft: StyleConstants.Spacing.M
}}
>
{content ? (
typeof content === 'string' ? (
<CustomText
@ -141,7 +159,7 @@ const MenuRow: React.FC<Props> = ({
name={iconBack}
size={StyleConstants.Font.Size.L}
color={colors[iconBackColor]}
style={[styles.iconBack, { opacity: loading ? 0 : 1 }]}
style={{ marginLeft: 8, opacity: loading ? 0 : 1 }}
/>
) : null}
{loading && loadingSpinkit}
@ -159,42 +177,4 @@ const MenuRow: React.FC<Props> = ({
)
}
const styles = StyleSheet.create({
base: {
minHeight: 50
},
core: {
flex: 1,
flexDirection: 'row',
paddingTop: StyleConstants.Spacing.S
},
front: {
flex: 2,
flexDirection: 'row',
alignItems: 'center'
},
back: {
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'center',
marginLeft: StyleConstants.Spacing.M
},
iconFront: {
marginRight: StyleConstants.Spacing.S
},
main: {
flex: 1
},
description: {
...StyleConstants.FontStyle.S
},
content: {
...StyleConstants.FontStyle.M
},
iconBack: {
marginLeft: 8
}
})
export default MenuRow

View File

@ -80,7 +80,7 @@ const displayMessage = ({
})
} else {
showMessage({
duration: type === 'error' ? 3500 : duration === 'short' ? 1500 : 2500,
duration: type === 'error' ? 8000 : duration === 'short' ? 3000 : 5000,
autoHide,
message,
description,
@ -124,7 +124,8 @@ const Message = React.forwardRef<FlashMessage>((_, ref) => {
shadowColor: colors.primaryDefault,
shadowOffset: { width: 0, height: 0 },
shadowOpacity: theme === 'light' ? 0.16 : 0.24,
shadowRadius: 4
shadowRadius: 4,
paddingRight: StyleConstants.Spacing.M * 2
}}
titleStyle={{
color: colors.primaryDefault,

View File

@ -215,7 +215,7 @@ const ParseHTML = React.memo(
}
const renderNodeCallback = useCallback(
(node, index) =>
(node: any, index: any) =>
renderNode({
routeParams: route.params,
colors,
@ -231,7 +231,7 @@ const ParseHTML = React.memo(
}),
[]
)
const textComponent = useCallback(({ children }) => {
const textComponent = useCallback(({ children }: any) => {
if (children) {
return (
<ParseEmojis
@ -246,26 +246,24 @@ const ParseHTML = React.memo(
}
}, [])
const rootComponent = useCallback(
({ children }) => {
({ children }: any) => {
const { t } = useTranslation('componentParse')
const [expandAllow, setExpandAllow] = useState(false)
const [expanded, setExpanded] = useState(highlighted)
const onTextLayout = useCallback(({ nativeEvent }) => {
if (
numberOfLines === 1 ||
nativeEvent.lines.length >= numberOfLines + 5
) {
setExpandAllow(true)
}
}, [])
return (
<View style={{ overflow: 'hidden' }}>
<CustomText
children={children}
onTextLayout={onTextLayout}
onTextLayout={({ nativeEvent }) => {
if (
numberOfLines === 1 ||
nativeEvent.lines.length >= numberOfLines + 5
) {
setExpandAllow(true)
}
}}
numberOfLines={
expandAllow ? (expanded ? 999 : numberOfLines) : undefined
}

View File

@ -3,11 +3,10 @@ import { FormattedRelativeTime } from 'react-intl'
import { AppState } from 'react-native'
export interface Props {
type: 'past' | 'future'
time: string | number
}
const RelativeTime: React.FC<Props> = ({ type, time }) => {
const RelativeTime: React.FC<Props> = ({ time }) => {
const [now, setNow] = useState(new Date().getTime())
useEffect(() => {
const appStateListener = AppState.addEventListener('change', state => {
@ -21,9 +20,7 @@ const RelativeTime: React.FC<Props> = ({ type, time }) => {
return (
<FormattedRelativeTime
value={
((type === 'past' ? -1 : 1) * (now - new Date(time).getTime())) / 1000
}
value={(new Date(time).getTime() - now) / 1000}
updateIntervalInSeconds={1}
/>
)

View File

@ -64,17 +64,6 @@ const Timeline: React.FC<Props> = ({
? data.pages?.flatMap(page => [...page.body])
: []
const ItemSeparatorComponent = useCallback(
({ leadingItem }) =>
queryKey[1].page === 'Toot' && queryKey[1].toot === leadingItem.id ? (
<ComponentSeparator extraMarginLeft={0} />
) : (
<ComponentSeparator
extraMarginLeft={StyleConstants.Avatar.M + StyleConstants.Spacing.S}
/>
),
[]
)
const onEndReached = useCallback(
() => !disableInfinity && !isFetchingNextPage && fetchNextPage(),
[isFetchingNextPage]
@ -151,7 +140,17 @@ const Timeline: React.FC<Props> = ({
/>
}
ListEmptyComponent={<TimelineEmpty queryKey={queryKey} />}
ItemSeparatorComponent={ItemSeparatorComponent}
ItemSeparatorComponent={({ leadingItem }) =>
queryKey[1].page === 'Toot' && queryKey[1].toot === leadingItem.id ? (
<ComponentSeparator extraMarginLeft={0} />
) : (
<ComponentSeparator
extraMarginLeft={
StyleConstants.Avatar.M + StyleConstants.Spacing.S
}
/>
)
}
maintainVisibleContentPosition={
isFetching
? {

View File

@ -78,6 +78,7 @@ const TimelineDefault: React.FC<Props> = ({
status={actualStatus}
queryKey={queryKey}
rootQueryKey={rootQueryKey}
disabled={highlighted}
>
<Pressable
accessible={highlighted ? false : true}

View File

@ -59,7 +59,11 @@ const TimelineNotifications = React.memo(
}, [])
return (
<TimelineContextMenu status={notification.status} queryKey={queryKey}>
<TimelineContextMenu
status={notification.status}
queryKey={queryKey}
disabled={highlighted}
>
<Pressable
style={{
padding: StyleConstants.Spacing.Global.PagePadding,
@ -96,7 +100,10 @@ const TimelineNotifications = React.memo(
account={actualAccount}
highlighted={highlighted}
/>
<TimelineHeaderNotification notification={notification} />
<TimelineHeaderNotification
queryKey={queryKey}
notification={notification}
/>
</View>
{notification.status ? (

View File

@ -9,7 +9,7 @@ import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { RefObject, useCallback, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { FlatList, Platform, StyleSheet, Text, View } from 'react-native'
import { FlatList, LayoutChangeEvent, Platform, StyleSheet, Text, View } from 'react-native'
import { Circle } from 'react-native-animated-spinkit'
import Animated, {
Extrapolate,
@ -169,7 +169,7 @@ const TimelineRefresh: React.FC<Props> = ({
const arrowStage = useSharedValue(0)
const onLayout = useCallback(
({ nativeEvent }) => {
({ nativeEvent }: LayoutChangeEvent) => {
if (nativeEvent.layout.x + nativeEvent.layout.width > textRight) {
setTextRight(nativeEvent.layout.x + nativeEvent.layout.width)
}

View File

@ -5,6 +5,7 @@ import contextMenuStatus from '@components/ContextMenu/status'
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
import React from 'react'
import { createContext } from 'react'
import { Platform } from 'react-native'
import ContextMenu, {
ContextMenuAction,
ContextMenuProps
@ -14,6 +15,7 @@ export interface Props {
status?: Mastodon.Status
queryKey?: QueryKeyTimeline
rootQueryKey?: QueryKeyTimeline
disabled?: boolean // Allowing toot to be copied when highlighted
}
export const ContextMenuContext = createContext<ContextMenuAction[]>([])
@ -23,9 +25,10 @@ const TimelineContextMenu: React.FC<Props & ContextMenuProps> = ({
status,
queryKey,
rootQueryKey,
disabled,
...props
}) => {
if (!status || !queryKey) {
if (!status || !queryKey || disabled || Platform.OS === 'android') {
return <>{children}</>
}
@ -47,6 +50,7 @@ const TimelineContextMenu: React.FC<Props & ContextMenuProps> = ({
})
const accountOnPress = contextMenuAccount({
actions,
type: 'status',
queryKey,
rootQueryKey,
id: status.account.id
@ -62,14 +66,14 @@ const TimelineContextMenu: React.FC<Props & ContextMenuProps> = ({
<ContextMenuContext.Provider value={actions}>
<ContextMenu
actions={actions}
onPress={({ nativeEvent: { id } }) => {
onPress={({ nativeEvent: { index } }) => {
for (const on of [
shareOnPress,
statusOnPress,
accountOnPress,
instanceOnPress
]) {
on && on(id)
on && on(index)
}
}}
children={children}

View File

@ -0,0 +1,120 @@
import contextMenuAccount from '@components/ContextMenu/account'
import contextMenuInstance from '@components/ContextMenu/instance'
import contextMenuShare from '@components/ContextMenu/share'
import contextMenuStatus from '@components/ContextMenu/status'
import Icon from '@components/Icon'
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { Platform, Pressable, View } from 'react-native'
import ContextMenu, { ContextMenuAction } from 'react-native-context-menu-view'
import { ContextMenuContext } from './ContextMenu'
import HeaderSharedAccount from './HeaderShared/Account'
import HeaderSharedApplication from './HeaderShared/Application'
import HeaderSharedCreated from './HeaderShared/Created'
import HeaderSharedMuted from './HeaderShared/Muted'
import HeaderSharedVisibility from './HeaderShared/Visibility'
export interface Props {
queryKey?: QueryKeyTimeline
status: Mastodon.Status
highlighted: boolean
}
const TimelineHeaderDefault = ({ queryKey, status, highlighted }: Props) => {
if (!queryKey) return null
const { t } = useTranslation('componentContextMenu')
const { colors } = useTheme()
const actions: ContextMenuAction[] = []
const shareOnPress =
status.visibility !== 'direct'
? contextMenuShare({
actions,
type: 'status',
url: status.url || status.uri
})
: null
const statusOnPress = contextMenuStatus({
actions,
status,
queryKey
})
const accountOnPress = contextMenuAccount({
actions,
type: 'status',
queryKey,
id: status.account.id
})
const instanceOnPress = contextMenuInstance({
actions,
status,
queryKey
})
return (
<View style={{ flex: 1, flexDirection: 'row' }}>
<View style={{ flex: 7 }}>
<HeaderSharedAccount account={status.account} />
<View
style={{
flexDirection: 'row',
alignItems: 'center',
marginTop: StyleConstants.Spacing.XS,
marginBottom: StyleConstants.Spacing.S
}}
>
<HeaderSharedCreated
created_at={status.created_at}
edited_at={status.edited_at}
highlighted={highlighted}
/>
<HeaderSharedVisibility visibility={status.visibility} />
<HeaderSharedMuted muted={status.muted} />
<HeaderSharedApplication application={status.application} />
</View>
</View>
{queryKey ? (
<Pressable
accessibilityHint={t('accessibilityHint')}
style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
marginBottom: StyleConstants.Spacing.L
}}
>
<ContextMenu
dropdownMenuMode
actions={actions}
onPress={({ nativeEvent: { index } }) => {
console.log('index', index)
for (const on of [
shareOnPress,
statusOnPress,
accountOnPress,
instanceOnPress
]) {
on && on(index)
}
}}
children={
<Icon
name='MoreHorizontal'
color={colors.secondary}
size={StyleConstants.Font.Size.L}
/>
}
/>
</Pressable>
) : null}
</View>
)
}
export default TimelineHeaderDefault

View File

@ -4,7 +4,7 @@ import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { Pressable, View } from 'react-native'
import { Platform, Pressable, View } from 'react-native'
import ContextMenu from 'react-native-context-menu-view'
import { ContextMenuContext } from './ContextMenu'
import HeaderSharedAccount from './HeaderShared/Account'
@ -48,7 +48,7 @@ const TimelineHeaderDefault = ({ queryKey, status, highlighted }: Props) => {
</View>
</View>
{queryKey ? (
{queryKey && !highlighted ? (
<Pressable
accessibilityHint={t('accessibilityHint')}
style={{

View File

@ -0,0 +1,163 @@
import contextMenuAccount from '@components/ContextMenu/account'
import contextMenuInstance from '@components/ContextMenu/instance'
import contextMenuShare from '@components/ContextMenu/share'
import contextMenuStatus from '@components/ContextMenu/status'
import Icon from '@components/Icon'
import {
RelationshipIncoming,
RelationshipOutgoing
} from '@components/Relationship'
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useMemo } from 'react'
import { Pressable, View } from 'react-native'
import ContextMenu, { ContextMenuAction } from 'react-native-context-menu-view'
import HeaderSharedAccount from './HeaderShared/Account'
import HeaderSharedApplication from './HeaderShared/Application'
import HeaderSharedCreated from './HeaderShared/Created'
import HeaderSharedMuted from './HeaderShared/Muted'
import HeaderSharedVisibility from './HeaderShared/Visibility'
export interface Props {
queryKey?: QueryKeyTimeline
notification: Mastodon.Notification
}
const TimelineHeaderNotification = ({ queryKey, notification }: Props) => {
const { colors } = useTheme()
const contextMenuActions: ContextMenuAction[] = []
const status = notification.status
const shareOnPress =
status && status?.visibility !== 'direct'
? contextMenuShare({
actions: contextMenuActions,
type: 'status',
url: status.url || status.uri
})
: null
const statusOnPress = contextMenuStatus({
actions: contextMenuActions,
status,
queryKey
})
const accountOnPress = contextMenuAccount({
actions: contextMenuActions,
type: 'status',
queryKey,
id: status?.account.id
})
const instanceOnPress = contextMenuInstance({
actions: contextMenuActions,
status,
queryKey
})
const actions = useMemo(() => {
switch (notification.type) {
case 'follow':
return <RelationshipOutgoing id={notification.account.id} />
case 'follow_request':
return <RelationshipIncoming id={notification.account.id} />
default:
if (notification.status) {
return (
<Pressable
style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
paddingBottom: StyleConstants.Spacing.S
}}
children={
<ContextMenu
dropdownMenuMode
actions={contextMenuActions}
onPress={({ nativeEvent: { index } }) => {
for (const on of [
shareOnPress,
statusOnPress,
accountOnPress,
instanceOnPress
]) {
on && on(index)
}
}}
children={
<Icon
name='MoreHorizontal'
color={colors.secondary}
size={StyleConstants.Font.Size.L}
/>
}
/>
}
/>
)
}
}
}, [notification.type])
return (
<View style={{ flex: 1, flexDirection: 'row' }}>
<View
style={{
flex:
notification.type === 'follow' ||
notification.type === 'follow_request'
? 1
: 4
}}
>
<HeaderSharedAccount
account={
notification.status
? notification.status.account
: notification.account
}
{...((notification.type === 'follow' ||
notification.type === 'follow_request') && { withoutName: true })}
/>
<View
style={{
flexDirection: 'row',
alignItems: 'center',
marginTop: StyleConstants.Spacing.XS,
marginBottom: StyleConstants.Spacing.S
}}
>
<HeaderSharedCreated
created_at={
notification.status?.created_at || notification.created_at
}
edited_at={notification.status?.edited_at}
/>
{notification.status?.visibility ? (
<HeaderSharedVisibility
visibility={notification.status.visibility}
/>
) : null}
<HeaderSharedMuted muted={notification.status?.muted} />
<HeaderSharedApplication
application={notification.status?.application}
/>
</View>
</View>
<View
style={[
{ marginLeft: StyleConstants.Spacing.M },
notification.type === 'follow' ||
notification.type === 'follow_request'
? { flexShrink: 1 }
: { flex: 1 }
]}
>
{actions}
</View>
</View>
)
}
export default TimelineHeaderNotification

View File

@ -3,6 +3,7 @@ import {
RelationshipIncoming,
RelationshipOutgoing
} from '@components/Relationship'
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useContext, useMemo } from 'react'
@ -16,6 +17,7 @@ import HeaderSharedMuted from './HeaderShared/Muted'
import HeaderSharedVisibility from './HeaderShared/Visibility'
export interface Props {
queryKey: QueryKeyTimeline
notification: Mastodon.Notification
}

View File

@ -32,7 +32,7 @@ const HeaderSharedCreated = React.memo(
/>
</>
) : (
<RelativeTime type='past' time={actualTime} />
<RelativeTime time={actualTime} />
)}
</CustomText>
{edited_at ? (

View File

@ -269,7 +269,7 @@ const TimelinePoll: React.FC<Props> = ({
))
}, [theme, allOptions])
const pollVoteCounts = useMemo(() => {
const pollVoteCounts = () => {
if (poll.voters_count !== null) {
return (
t('shared.poll.meta.count.voters', { count: poll.voters_count }) + ' • '
@ -279,9 +279,9 @@ const TimelinePoll: React.FC<Props> = ({
t('shared.poll.meta.count.votes', { count: poll.votes_count }) + ' • '
)
}
}, [poll.voters_count, poll.votes_count])
}
const pollExpiration = useMemo(() => {
const pollExpiration = () => {
if (poll.expired) {
return t('shared.poll.meta.expiration.expired')
} else {
@ -289,12 +289,12 @@ const TimelinePoll: React.FC<Props> = ({
return (
<Trans
i18nKey='componentTimeline:shared.poll.meta.expiration.until'
components={[<RelativeTime type='future' time={poll.expires_at} />]}
components={[<RelativeTime time={poll.expires_at} />]}
/>
)
}
}
}, [theme, i18n.language, poll.expired, poll.expires_at])
}
return (
<View style={{ marginTop: StyleConstants.Spacing.M }}>
@ -312,8 +312,8 @@ const TimelinePoll: React.FC<Props> = ({
fontStyle='S'
style={{ flexShrink: 1, color: colors.secondary }}
>
{pollVoteCounts}
{pollExpiration}
{pollVoteCounts()}
{pollExpiration()}
</CustomText>
</View>
</View>

View File

@ -48,14 +48,18 @@ const TimelineTranslate = React.memo(
const [detectedLanguage, setDetectedLanguage] = useState<string>('')
useEffect(() => {
const detect = async () => {
const result = await detectLanguage(text.join(`\n\n`))
setDetectedLanguage(result.detected.slice(0, 2))
const result = await detectLanguage(text.join(`\n\n`)).catch(() => {
// No need to log language detection failure
})
result?.detected && setDetectedLanguage(result.detected.slice(0, 2))
}
detect()
}, [])
const settingsLanguage = useSelector(getSettingsLanguage)
const targetLanguage = settingsLanguage || Localization.locale || 'en'
const targetLanguage = settingsLanguage?.startsWith('en')
? Localization.locale || settingsLanguage || 'en'
: settingsLanguage || Localization.locale || 'en'
const [enabled, setEnabled] = useState(false)
const { refetch, data, isLoading, isSuccess, isError } = useTranslateQuery({

View File

@ -1,15 +1,8 @@
import analytics from '@components/analytics'
import { ActionSheetOptions } from '@expo/react-native-action-sheet'
import { store } from '@root/store'
import { getInstanceConfigurationStatusMaxAttachments } from '@utils/slices/instancesSlice'
import { manipulateAsync, SaveFormat } from 'expo-image-manipulator'
import * as ExpoImagePicker from 'expo-image-picker'
import i18next from 'i18next'
import { Alert, Linking, Platform } from 'react-native'
import ImagePicker, {
Image,
ImageOrVideo
} from 'react-native-image-crop-picker'
import { Asset, launchImageLibrary } from 'react-native-image-picker'
export interface Props {
mediaType?: 'photo' | 'video'
@ -28,43 +21,7 @@ const mediaSelector = async ({
maximum,
indicateMaximum = false,
showActionSheetWithOptions
}: Props): Promise<({ uri: string } & Omit<ImageOrVideo, 'path'>)[]> => {
const checkLibraryPermission = async (): Promise<boolean> => {
const { status } =
await ExpoImagePicker.requestMediaLibraryPermissionsAsync()
if (status !== 'granted') {
Alert.alert(
i18next.t('componentMediaSelector:library.alert.title'),
i18next.t('componentMediaSelector:library.alert.message'),
[
{
text: i18next.t('common:buttons.cancel'),
style: 'cancel',
onPress: () =>
analytics('mediaSelector_nopermission', {
action: 'cancel'
})
},
{
text: i18next.t(
'componentMediaSelector:library.alert.buttons.settings'
),
style: 'default',
onPress: () => {
analytics('mediaSelector_nopermission', {
action: 'settings'
})
Linking.openURL('app-settings:')
}
}
]
)
return false
} else {
return true
}
}
}: Props): Promise<Asset[]> => {
const _maximum =
maximum ||
getInstanceConfigurationStatusMaxAttachments(store.getState()) ||
@ -105,79 +62,30 @@ const mediaSelector = async ({
return new Promise((resolve, reject) => {
const selectImage = async () => {
const images = await ImagePicker.openPicker({
const images = await launchImageLibrary({
mediaType: 'photo',
includeExif: false,
multiple: true,
minFiles: 1,
maxFiles: _maximum,
smartAlbums: ['UserLibrary'],
writeTempFile: false,
loadingLabelText: ''
}).catch(() => {})
...(resize && { maxWidth: resize.width, maxHeight: resize.height }),
includeBase64: false,
includeExtra: false,
selectionLimit: _maximum
})
if (!images) {
if (!images.assets) {
return reject()
}
// react-native-image-crop-picker may return HEIC as JPG that causes upload failure
if (Platform.OS === 'ios') {
for (const [index, image] of images.entries()) {
if (image.mime === 'image/heic') {
const converted = await manipulateAsync(image.sourceURL!, [], {
base64: false,
compress: 0.8,
format: SaveFormat.JPEG
})
images[index] = {
...images[index],
sourceURL: converted.uri,
mime: 'image/jpeg'
}
}
}
}
if (!resize) {
return resolve(
images.map(image => ({
...image,
uri: image.sourceURL || `file://${image.path}`
}))
)
} else {
const croppedImages: Image[] = []
for (const image of images) {
const croppedImage = await ImagePicker.openCropper({
mediaType: 'photo',
path: image.path,
width: resize.width,
height: resize.height,
cropperChooseText: i18next.t('common:buttons.apply'),
cropperCancelText: i18next.t('common:buttons.cancel'),
hideBottomControls: true
}).catch(() => {})
croppedImage && croppedImages.push(croppedImage)
}
return resolve(
croppedImages.map(image => ({
...image,
uri: `file://${image.path}`
}))
)
}
return resolve(images.assets)
}
const selectVideo = async () => {
const video = await ImagePicker.openPicker({
const video = await launchImageLibrary({
mediaType: 'video',
includeExif: false,
loadingLabelText: ''
}).catch(() => {})
includeBase64: false,
includeExtra: false,
selectionLimit: 1
})
if (video) {
return resolve([
{ ...video, uri: video.sourceURL || `file://${video.path}` }
])
if (video.assets?.[0]) {
return resolve(video.assets)
} else {
return reject()
}
@ -189,10 +97,6 @@ const mediaSelector = async ({
cancelButtonIndex: mediaType ? 1 : 2
},
async buttonIndex => {
if (!(await checkLibraryPermission())) {
return reject()
}
switch (mediaType) {
case 'photo':
if (buttonIndex === 0) {

View File

@ -1,149 +0,0 @@
import { store } from '@root/store'
import { getInstanceConfigurationMediaAttachments } from '@utils/slices/instancesSlice'
import { Action, manipulateAsync, SaveFormat } from 'expo-image-manipulator'
import i18next from 'i18next'
import { Platform } from 'react-native'
import ImagePicker from 'react-native-image-crop-picker'
export interface Props {
type: 'image' | 'video'
uri: string // This can be pure path or uri starting with file://
mime?: string
transform: {
imageFormat?: SaveFormat.JPEG | SaveFormat.PNG
resize?: boolean
width?: number
height?: number
}
}
const getFileExtension = (uri: string) => {
const extension = uri.split('.').pop()
// Using mime type standard of jpeg
return extension === 'jpg' ? 'jpeg' : extension
}
const mediaTransformation = async ({
type,
uri,
mime,
transform
}: Props): Promise<{
uri: string
mime: string
width: number
height: number
}> => {
const configurationMediaAttachments =
getInstanceConfigurationMediaAttachments(store.getState())
const fileExtension = getFileExtension(uri)
switch (type) {
case 'image':
if (mime === 'image/gif' || fileExtension === 'gif') {
return Promise.reject('GIFs should not be transformed')
}
let targetFormat: SaveFormat.JPEG | SaveFormat.PNG = SaveFormat.JPEG
const supportedImageTypes =
configurationMediaAttachments.supported_mime_types.filter(mime =>
mime.startsWith('image/')
)
// @ts-ignore
const transformations: Action[] = [
!transform.resize && (transform.width || transform.height)
? {
resize: { width: transform.width, height: transform.height }
}
: null
].filter(t => !!t)
if (mime) {
if (
mime !== `image/${fileExtension}` ||
!supportedImageTypes.includes(mime)
) {
targetFormat = transform.imageFormat || SaveFormat.JPEG
} else {
targetFormat = mime.split('/').pop() as any
}
} else {
if (!fileExtension) {
return Promise.reject('Unable to get file extension')
}
if (!supportedImageTypes.includes(`image/${fileExtension}`)) {
targetFormat = transform.imageFormat || SaveFormat.JPEG
} else {
targetFormat = fileExtension as any
}
}
const converted = await manipulateAsync(uri, transformations, {
base64: false,
compress: Platform.OS === 'ios' ? 0.8 : 1,
format: targetFormat
})
if (transform.resize) {
const resized = await ImagePicker.openCropper({
mediaType: 'photo',
path: converted.uri,
width: transform.width,
height: transform.height,
cropperChooseText: i18next.t('common:buttons.apply'),
cropperCancelText: i18next.t('common:buttons.cancel'),
hideBottomControls: true
})
if (!resized) {
return Promise.reject('Resize failed')
} else {
return {
uri: resized.path,
mime: resized.mime,
width: resized.width,
height: resized.height
}
}
} else {
return {
uri: converted.uri,
mime: transform.imageFormat || SaveFormat.JPEG,
width: converted.width,
height: converted.height
}
}
case 'video':
const supportedVideoTypes =
configurationMediaAttachments.supported_mime_types.filter(mime =>
mime.startsWith('video/')
)
if (mime) {
if (mime !== `video/${fileExtension}`) {
console.warn('Video mime type and file extension does not match')
}
if (!supportedVideoTypes.includes(mime)) {
return Promise.reject('Video file type is not supported')
}
} else {
if (!fileExtension) {
return Promise.reject('Unable to get file extension')
}
if (!supportedVideoTypes.includes(`video/${fileExtension}`)) {
return Promise.reject('Video file type is not supported')
}
}
return {
uri: uri,
mime: mime || `video/${fileExtension}`,
width: 0,
height: 0
}
break
}
}
export default mediaTransformation

View File

@ -8,6 +8,7 @@ export default {
screenImageViewer: require('./screens/imageViewer'),
screenTabs: require('./screens/tabs'),
componentContextMenu: require('./components/contextMenu'),
componentEmojis: require('./components/emojis'),
componentInstance: require('./components/instance'),
componentMediaSelector: require('./components/mediaSelector'),

View File

@ -1,12 +1,14 @@
{
"accessibilityHint": "Funktionen für diesen Tröt - wie z. B. Autor und Originaltröt",
"account": {
"title": "",
"title": "Benutzeraktionen",
"mute": {
"action": "Profil stummschalten"
"action_false": "Profil stummschalten",
"action_true": ""
},
"block": {
"action": "Nutzer blockieren"
"action_false": "Nutzer blockieren",
"action_true": ""
},
"reports": {
"action": "User melden"
@ -59,12 +61,12 @@
}
},
"mute": {
"action-muted_false": "",
"action-muted_true": ""
"action_false": "",
"action_true": ""
},
"pin": {
"action-pinned_false": "",
"action-pinned_true": ""
"action_false": "",
"action_true": ""
}
}
}

View File

@ -139,7 +139,7 @@
},
"expiration": {
"expired": "Abstimmung abgelaufen",
"until": "Läuft in <0 /> ab"
"until": "Läuft <0 /> ab"
}
}
}

View File

@ -78,9 +78,7 @@
}
},
"fontSize": {
"showcase": "Beispieltröt",
"demo": "<p>Dies ist ein Beispieltröt😊. Du kannst aus mehreren der unteren Möglichkeiten auswählen.<br /><br />Diese Einstellung betrifft ausschließlich die Haupteinstellungen, nicht die Schriftgröße in anderen Bereichen der App.</p>",
"availableSizes": "Verfügbare Größen",
"sizes": {
"S": "S",
"M": "M Standard",

View File

@ -3,10 +3,12 @@
"account": {
"title": "User actions",
"mute": {
"action": "Mute user"
"action_false": "Mute user",
"action_true": "Unmute user"
},
"block": {
"action": "Block user"
"action_false": "Block user",
"action_true": "Unblock user"
},
"reports": {
"action": "Report user"
@ -59,12 +61,12 @@
}
},
"mute": {
"action-muted_false": "Mute toot and replies",
"action-muted_true": "Unmute toot and replies"
"action_false": "Mute toot and replies",
"action_true": "Unmute toot and replies"
},
"pin": {
"action-pinned_false": "Pin toot",
"action-pinned_true": "Unpin toot"
"action_false": "Pin toot",
"action_true": "Unpin toot"
}
}
}

View File

@ -139,7 +139,7 @@
},
"expiration": {
"expired": "Vote expired",
"until": "Expires in <0 />"
"until": "Expires <0 />"
}
}
}

View File

@ -78,9 +78,7 @@
}
},
"fontSize": {
"showcase": "Example toot",
"demo": "<p>This is a demo toot😊. You can choose from several options from below.<br /><br />This setting only affects the main content of toots, but not other font sizes.</p>",
"availableSizes": "Available sizes",
"sizes": {
"S": "S",
"M": "M - Default",
@ -147,7 +145,8 @@
"group": "Group {{index}}",
"label": "Label",
"content": "Content"
}
},
"mediaSelectionFailed": "Image processing failed. Please try again."
},
"push": {
"notAvailable": "Your phone does not support tooot's push notification",

View File

@ -8,6 +8,7 @@ export default {
screenImageViewer: require('./screens/imageViewer'),
screenTabs: require('./screens/tabs'),
componentContextMenu: require('./components/contextMenu'),
componentEmojis: require('./components/emojis'),
componentInstance: require('./components/instance'),
componentMediaSelector: require('./components/mediaSelector'),

View File

@ -1,23 +1,25 @@
{
"accessibilityHint": "Azioni per questo toot, per l'utente che l'ha pubblicato o per il toot stesso",
"account": {
"title": "",
"title": "Azioni utente",
"mute": {
"action": "Muta utente"
"action_false": "Muta utente",
"action_true": "Riattiva utente"
},
"block": {
"action": "Blocca utente"
"action_false": "Blocca utente",
"action_true": "Sblocca utente"
},
"reports": {
"action": "Segnala utente"
}
},
"instance": {
"title": "",
"title": "Azione sull'istanza",
"block": {
"action": "Blocca istanza {{instance}}",
"alert": {
"title": "",
"title": "Confermi di voler bloccare l'istanza {{instance}}?",
"message": "Sarebbe meglio mutare o bloccare singoli utenti.\n\nSe blocchi un'istanza, tutti i suoi contenuti a te relativi, inclusi tutti i tuoi seguaci da questa, saranno rimossi.",
"buttons": {
"confirm": "Ho capito"
@ -34,7 +36,7 @@
}
},
"status": {
"title": "",
"title": "Azioni sul toot",
"edit": {
"action": "Modifica toot"
},
@ -42,29 +44,29 @@
"action": "Cancella toot",
"alert": {
"title": "Conferma?",
"message": "",
"message": "Tutti i retoot, gli apprezzamenti, e le risposte, saranno cancellati.",
"buttons": {
"confirm": "Ho capito"
}
}
},
"deleteEdit": {
"action": "",
"action": "Cancella e ripubblica toot",
"alert": {
"title": "",
"message": "",
"title": "Confermi cancellazione e ripubblicazione?",
"message": "Tutti i retoot, gli apprezzamenti, e le risposte, saranno cancellati.",
"buttons": {
"confirm": "Ho capito"
}
}
},
"mute": {
"action-muted_false": "",
"action-muted_true": ""
"action_false": "Muta toot e le sue risposte",
"action_true": "Riattiva toot e le sue risposte"
},
"pin": {
"action-pinned_false": "",
"action-pinned_true": ""
"action_false": "Fissa toot",
"action_true": "Togli toot all'alto"
}
}
}

View File

@ -14,7 +14,7 @@
"base": "Per accedere, verrà aperta una pagina del browser di sistema. I dati di accesso del tuo account sono protetti."
},
"terms": {
"base": ""
"base": "Accedendo, accetti la <0>politica sulla privacy</0> e i <1>termini di servizio</1>."
}
},
"update": {

View File

@ -1,10 +1,10 @@
{
"title": "Seleziona origine media",
"options": {
"image": "",
"image_max": "",
"video": "",
"video_max": ""
"image": "Carica foto",
"image_max": "Carica foto (massimo {{max}})",
"video": "Carica video",
"video_max": "Carica video (max {{max}})"
},
"library": {
"alert": {

View File

@ -30,7 +30,7 @@
"default": "{{name}} ha ricondiviso",
"notification": "{{name}} ha ricondiviso il tuo toot"
},
"update": ""
"update": "Retoot ha subito una modifica"
},
"actions": {
"reply": {
@ -139,7 +139,7 @@
},
"expiration": {
"expired": "Voto scaduto",
"until": "Scade in <0 />"
"until": "Scade <0 />"
}
}
}

View File

@ -1,7 +1,7 @@
{
"content": {
"altText": {
"heading": ""
"heading": "Testo descrittivo"
},
"notificationsFilter": {
"heading": "Filtra notifiche per tipo",
@ -12,8 +12,8 @@
"reblog": "$t(screenTabs:me.push.reblog.heading)",
"mention": "$t(screenTabs:me.push.mention.heading)",
"poll": "$t(screenTabs:me.push.poll.heading)",
"status": "",
"update": ""
"status": "Toot da utenti seguiti",
"update": "Retoot ha subito una modifica"
}
}
}

View File

@ -168,7 +168,7 @@
"header": {
"title": "Bozza"
},
"warning": "",
"warning": "Le bozze sono salvate solo in locale, e potrebbero essere perse in seguito a problemi. Evita di usarle per archiviazione a lungo termine.",
"content": {
"accessibilityHint": "Bozza salvata, premi per modificarla",
"textEmpty": "Testo vuoto"

View File

@ -78,9 +78,7 @@
}
},
"fontSize": {
"showcase": "Toot di esempio",
"demo": "<p>Questo toot è un esempio 😺️. Puoi scegliere diverse opzioni di grandezza del testo qui sotto.<br /><br />Questa impostazione si applica solo al testo dei toot, non anche agli altri testi della app.</p>",
"availableSizes": "Dimensioni testo",
"sizes": {
"S": "S",
"M": "M - Predefinito",
@ -170,7 +168,7 @@
"heading": "Nuovi seguaci"
},
"follow_request": {
"heading": ""
"heading": "Richiesta di seguirti"
},
"favourite": {
"heading": "Apprezzamenti"
@ -185,7 +183,7 @@
"heading": "Novità sui sondaggi"
},
"status": {
"heading": ""
"heading": "Toot da utenti seguiti"
},
"howitworks": "Scopri come funziona il traversamento dei messaggi"
},

22
src/i18n/ja/common.json Normal file
View File

@ -0,0 +1,22 @@
{
"buttons": {
"OK": "",
"apply": "",
"cancel": ""
},
"customEmoji": {
"accessibilityLabel": ""
},
"message": {
"success": {
"message": ""
},
"warning": {
"message": ""
},
"error": {
"message": ""
}
},
"separator": ""
}

View File

@ -0,0 +1,72 @@
{
"accessibilityHint": "",
"account": {
"title": "",
"mute": {
"action_false": "",
"action_true": ""
},
"block": {
"action_false": "",
"action_true": ""
},
"reports": {
"action": ""
}
},
"instance": {
"title": "",
"block": {
"action": "",
"alert": {
"title": "",
"message": "",
"buttons": {
"confirm": ""
}
}
}
},
"share": {
"status": {
"action": ""
},
"account": {
"action": ""
}
},
"status": {
"title": "",
"edit": {
"action": ""
},
"delete": {
"action": "",
"alert": {
"title": "",
"message": "",
"buttons": {
"confirm": ""
}
}
},
"deleteEdit": {
"action": "",
"alert": {
"title": "",
"message": "",
"buttons": {
"confirm": ""
}
}
},
"mute": {
"action_false": "",
"action_true": ""
},
"pin": {
"action_false": "",
"action_true": ""
}
}
}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,30 @@
{
"server": {
"textInput": {
"placeholder": ""
},
"button": "",
"information": {
"name": "",
"accounts": "",
"statuses": "",
"domains": ""
},
"disclaimer": {
"base": ""
},
"terms": {
"base": ""
}
},
"update": {
"alert": {
"title": "",
"message": "",
"buttons": {
"cancel": "",
"continue": ""
}
}
}
}

View File

@ -0,0 +1,18 @@
{
"title": "",
"options": {
"image": "",
"image_max": "",
"video": "",
"video_max": ""
},
"library": {
"alert": {
"title": "",
"message": "",
"buttons": {
"settings": ""
}
}
}
}

View File

@ -0,0 +1,9 @@
{
"HTML": {
"expanded": {
"true": "",
"false": ""
},
"defaultHint": ""
}
}

View File

@ -0,0 +1,16 @@
{
"follow": {
"function": ""
},
"block": {
"function": ""
},
"button": {
"error": "",
"blocked_by": "",
"blocking": "",
"following": "",
"requested": "",
"default": ""
}
}

View File

@ -0,0 +1,147 @@
{
"empty": {
"error": {
"message": "",
"button": ""
},
"success": {
"message": ""
}
},
"end": {
"message": ""
},
"lookback": {
"message": ""
},
"refresh": {
"fetchPreviousPage": "",
"refetch": ""
},
"shared": {
"actioned": {
"pinned": "",
"favourite": "",
"status": "",
"follow": "",
"follow_request": "",
"poll": "",
"reblog": {
"default": "",
"notification": ""
},
"update": ""
},
"actions": {
"reply": {
"accessibilityLabel": ""
},
"reblogged": {
"accessibilityLabel": "",
"function": ""
},
"favourited": {
"accessibilityLabel": "",
"function": ""
},
"bookmarked": {
"accessibilityLabel": "",
"function": ""
}
},
"actionsUsers": {
"reblogged_by": {
"accessibilityLabel": "",
"accessibilityHint": "",
"text": ""
},
"favourited_by": {
"accessibilityLabel": "",
"accessibilityHint": "",
"text": ""
},
"history": {
"accessibilityLabel": "",
"accessibilityHint": "",
"text_one": "",
"text_other": ""
}
},
"attachment": {
"sensitive": {
"button": ""
},
"unsupported": {
"text": "",
"button": ""
}
},
"avatar": {
"accessibilityLabel": "",
"accessibilityHint": ""
},
"content": {
"expandHint": ""
},
"filtered": "",
"fullConversation": "",
"translate": {
"default": "",
"succeed": "",
"failed": "",
"source_not_supported": "",
"target_not_supported": ""
},
"header": {
"shared": {
"account": {
"name": {
"accessibilityHint": ""
},
"account": {
"accessibilityHint": ""
}
},
"application": "",
"edited": {
"accessibilityLabel": ""
},
"muted": {
"accessibilityLabel": ""
},
"visibility": {
"direct": {
"accessibilityLabel": ""
},
"private": {
"accessibilityLabel": ""
}
}
},
"conversation": {
"withAccounts": "",
"delete": {
"function": ""
}
}
},
"poll": {
"meta": {
"button": {
"vote": "",
"refresh": ""
},
"count": {
"voters_one": "",
"voters_other": "",
"votes_one": "",
"votes_other": ""
},
"expiration": {
"expired": "",
"until": ""
}
}
}
}
}

18
src/i18n/ja/screens.json Normal file
View File

@ -0,0 +1,18 @@
{
"screenshot": {
"title": "",
"message": "",
"button": ""
},
"localCorrupt": {
"message": ""
},
"pushError": {
"message": "",
"description": ""
},
"shareError": {
"imageNotSupported": "",
"videoNotSupported": ""
}
}

View File

@ -0,0 +1,20 @@
{
"content": {
"altText": {
"heading": ""
},
"notificationsFilter": {
"heading": "",
"content": {
"follow": "",
"follow_request": "",
"favourite": "",
"reblog": "",
"mention": "",
"poll": "",
"status": "",
"update": ""
}
}
}
}

View File

@ -0,0 +1,10 @@
{
"heading": "",
"content": {
"published": "",
"button": {
"read": "",
"unread": ""
}
}
}

View File

@ -0,0 +1,179 @@
{
"heading": {
"left": {
"button": "",
"alert": {
"title": "",
"buttons": {
"save": "",
"delete": "",
"cancel": ""
}
}
},
"right": {
"button": {
"default": "",
"conversation": "",
"reply": "",
"deleteEdit": "",
"edit": "",
"share": ""
},
"alert": {
"default": {
"title": "",
"button": ""
},
"removeReply": {
"title": "",
"description": "",
"cancel": "",
"confirm": ""
}
}
}
},
"content": {
"root": {
"header": {
"postingAs": "",
"spoilerInput": {
"placeholder": ""
},
"textInput": {
"placeholder": "",
"keyboardImage": {
"exceedMaximum": {
"title": "",
"OK": ""
}
}
}
},
"footer": {
"attachments": {
"sensitive": "",
"remove": {
"accessibilityLabel": ""
},
"edit": {
"accessibilityLabel": ""
},
"upload": {
"accessibilityLabel": ""
}
},
"emojis": {
"accessibilityHint": ""
},
"poll": {
"option": {
"placeholder": {
"accessibilityLabel": "",
"single": "",
"multiple": ""
}
},
"quantity": {
"reduce": {
"accessibilityLabel": "",
"accessibilityHint": ""
},
"increase": {
"accessibilityLabel": "",
"accessibilityHint": ""
}
},
"multiple": {
"heading": "",
"options": {
"single": "",
"multiple": "",
"cancel": ""
}
},
"expiration": {
"heading": "",
"options": {
"300": "",
"1800": "",
"3600": "",
"21600": "",
"86400": "",
"259200": "",
"604800": "",
"cancel": ""
}
}
}
},
"actions": {
"attachment": {
"accessibilityLabel": "",
"accessibilityHint": "",
"failed": {
"alert": {
"title": "",
"button": ""
}
}
},
"poll": {
"accessibilityLabel": "",
"accessibilityHint": ""
},
"visibility": {
"accessibilityLabel": "",
"title": "",
"options": {
"public": "",
"unlisted": "",
"private": "",
"direct": "",
"cancel": ""
}
},
"spoiler": {
"accessibilityLabel": ""
},
"emoji": {
"accessibilityLabel": "",
"accessibilityHint": ""
}
},
"drafts_one": "",
"drafts_other": ""
},
"editAttachment": {
"header": {
"title": "",
"right": {
"accessibilityLabel": "",
"failed": {
"title": "",
"button": ""
}
}
},
"content": {
"altText": {
"heading": "",
"placeholder": ""
},
"imageFocus": ""
}
},
"draftsList": {
"header": {
"title": ""
},
"warning": "",
"content": {
"accessibilityHint": "",
"textEmpty": ""
},
"checkAttachment": ""
}
}
}

View File

@ -0,0 +1,17 @@
{
"content": {
"actions": {
"accessibilityLabel": "",
"accessibilityHint": ""
},
"options": {
"save": "",
"share": "",
"cancel": ""
},
"save": {
"succeed": "",
"failed": ""
}
}
}

View File

@ -0,0 +1,354 @@
{
"tabs": {
"local": {
"name": ""
},
"public": {
"name": "",
"segments": {
"left": "",
"right": ""
}
},
"notifications": {
"name": ""
},
"me": {
"name": ""
}
},
"common": {
"search": {
"accessibilityLabel": "",
"accessibilityHint": ""
}
},
"notifications": {
"filter": {
"accessibilityLabel": "",
"accessibilityHint": ""
}
},
"me": {
"stacks": {
"bookmarks": {
"name": ""
},
"conversations": {
"name": ""
},
"favourites": {
"name": ""
},
"fontSize": {
"name": ""
},
"language": {
"name": ""
},
"lists": {
"name": ""
},
"list": {
"name": ""
},
"push": {
"name": ""
},
"profile": {
"name": ""
},
"profileName": {
"name": ""
},
"profileNote": {
"name": ""
},
"profileFields": {
"name": ""
},
"settings": {
"name": ""
},
"webSettings": {
"name": ""
},
"switch": {
"name": ""
}
},
"fontSize": {
"showcase": "",
"demo": "",
"availableSizes": "",
"sizes": {
"S": "",
"M": "",
"L": "",
"XL": "",
"XXL": ""
}
},
"profile": {
"cancellation": {
"title": "",
"message": "",
"buttons": {
"cancel": "",
"discard": ""
}
},
"feedback": {
"succeed": "",
"failed": ""
},
"root": {
"name": {
"title": ""
},
"avatar": {
"title": "",
"description": ""
},
"header": {
"title": "",
"description": ""
},
"note": {
"title": ""
},
"fields": {
"title": "",
"total_one": "",
"total_other": ""
},
"visibility": {
"title": "",
"options": {
"public": "",
"unlisted": "",
"private": "",
"cancel": ""
}
},
"sensitive": {
"title": ""
},
"lock": {
"title": "",
"description": ""
},
"bot": {
"title": "",
"description": ""
}
},
"fields": {
"group": "",
"label": "",
"content": ""
}
},
"push": {
"notAvailable": "",
"enable": {
"direct": "",
"settings": ""
},
"global": {
"heading": "",
"description": ""
},
"decode": {
"heading": "",
"description": ""
},
"default": {
"heading": ""
},
"follow": {
"heading": ""
},
"follow_request": {
"heading": ""
},
"favourite": {
"heading": ""
},
"reblog": {
"heading": ""
},
"mention": {
"heading": ""
},
"poll": {
"heading": ""
},
"status": {
"heading": ""
},
"howitworks": ""
},
"root": {
"announcements": {
"content": {
"unread": "",
"read": "",
"empty": ""
}
},
"push": {
"content": {
"enabled": "",
"disabled": ""
}
},
"update": {
"title": ""
},
"logout": {
"button": "",
"alert": {
"title": "",
"message": "",
"buttons": {
"logout": "",
"cancel": ""
}
}
}
},
"settings": {
"fontsize": {
"heading": "",
"content": {
"S": "",
"M": "",
"L": "",
"XL": "",
"XXL": ""
}
},
"language": {
"heading": "",
"options": {
"cancel": ""
}
},
"theme": {
"heading": "",
"options": {
"auto": "",
"light": "",
"dark": "",
"cancel": ""
}
},
"darkTheme": {
"heading": "",
"options": {
"lighter": "",
"darker": "",
"cancel": ""
}
},
"browser": {
"heading": "",
"options": {
"internal": "",
"external": "",
"cancel": ""
}
},
"staticEmoji": {
"heading": "",
"description": ""
},
"feedback": {
"heading": ""
},
"support": {
"heading": ""
},
"review": {
"heading": ""
},
"contact": {
"heading": ""
},
"analytics": {
"heading": "",
"description": ""
},
"version": "",
"instanceVersion": ""
},
"switch": {
"existing": "",
"new": ""
}
},
"shared": {
"account": {
"actions": {
"accessibilityLabel": "",
"accessibilityHint": ""
},
"followed_by": "",
"moved": "",
"created_at": "",
"summary": {
"statuses_count": "",
"following_count": "",
"followers_count": ""
},
"toots": {
"default": "",
"all": ""
}
},
"attachments": {
"name": ""
},
"search": {
"header": {
"prefix": "",
"placeholder": ""
},
"empty": {
"general": "",
"advanced": {
"header": "",
"example": {
"account": "",
"hashtag": "",
"statusLink": "",
"accountLink": ""
}
}
},
"sections": {
"accounts": "",
"hashtags": "",
"statuses": ""
},
"notFound": ""
},
"toot": {
"name": ""
},
"users": {
"accounts": {
"following": "",
"followers": ""
},
"statuses": {
"reblogged_by": "",
"favourited_by": ""
}
},
"history": {
"name": ""
}
}
}

View File

@ -8,6 +8,7 @@ export default {
screenImageViewer: require('./screens/imageViewer'),
screenTabs: require('./screens/tabs'),
componentContextMenu: require('./components/contextMenu'),
componentEmojis: require('./components/emojis'),
componentInstance: require('./components/instance'),
componentMediaSelector: require('./components/mediaSelector'),

View File

@ -3,10 +3,12 @@
"account": {
"title": "",
"mute": {
"action": "사용자 음소거"
"action_false": "사용자 음소거",
"action_true": ""
},
"block": {
"action": "사용자 차단"
"action_false": "사용자 차단",
"action_true": ""
},
"reports": {
"action": "사용자 신고"
@ -59,12 +61,12 @@
}
},
"mute": {
"action-muted_false": "",
"action-muted_true": ""
"action_false": "",
"action_true": ""
},
"pin": {
"action-pinned_false": "",
"action-pinned_true": ""
"action_false": "",
"action_true": ""
}
}
}

View File

@ -78,9 +78,7 @@
}
},
"fontSize": {
"showcase": "예시 툿",
"demo": "<p>데모 툿이에요😊. 아래의 여러 옵션 중에서 선택할 수 있어요.<br /><br />이 설정은 툿의 메인 내용에만 적용되고, 다른 폰트 크기에 영향을 미치지 않아요.</p>",
"availableSizes": "사용할 수 있는 크기",
"sizes": {
"S": "작게",
"M": "중간 - 기본값",

View File

@ -8,6 +8,7 @@ export default {
screenImageViewer: require('./screens/imageViewer'),
screenTabs: require('./screens/tabs'),
componentContextMenu: require('./components/contextMenu'),
componentEmojis: require('./components/emojis'),
componentInstance: require('./components/instance'),
componentMediaSelector: require('./components/mediaSelector'),

View File

@ -3,10 +3,12 @@
"account": {
"title": "Ações do Usuário",
"mute": {
"action": "Silenciar usuário"
"action_false": "Silenciar usuário",
"action_true": "Desativar o silêncio do usuário"
},
"block": {
"action": "Bloquear usuário"
"action_false": "Bloquear usuário",
"action_true": "Desbloquear usuário"
},
"reports": {
"action": "Denunciar usuário"
@ -59,12 +61,12 @@
}
},
"mute": {
"action-muted_false": "Silenciar este toot e respostas",
"action-muted_true": "Desbloquear este toot e respostas"
"action_false": "Silenciar este toot e respostas",
"action_true": "Desbloquear este toot e respostas"
},
"pin": {
"action-pinned_false": "Toot fixado",
"action-pinned_true": "Desafixar toot"
"action_false": "Toot fixado",
"action_true": "Desafixar toot"
}
}
}

View File

@ -139,7 +139,7 @@
},
"expiration": {
"expired": "Voto expirado",
"until": "Expira em <0 />"
"until": "Expira <0 />"
}
}
}

View File

@ -78,9 +78,7 @@
}
},
"fontSize": {
"showcase": "Exemplo de toot",
"demo": "<p>Esta é uma demonstração também😊. Você pode escolher entre várias opções abaixo.<br /><br />Esta configuração afeta apenas o conteúdo principal dos toots, mas não os tamanhos de outra fonte.</p>",
"availableSizes": "Tamanhos disponíveis",
"sizes": {
"S": "P",
"M": "M - Padrão",

View File

@ -8,6 +8,7 @@ export default {
screenImageViewer: require('./screens/imageViewer'),
screenTabs: require('./screens/tabs'),
componentContextMenu: require('./components/contextMenu'),
componentEmojis: require('./components/emojis'),
componentInstance: require('./components/instance'),
componentMediaSelector: require('./components/mediaSelector'),

View File

@ -3,10 +3,12 @@
"account": {
"title": "Hành động người dùng",
"mute": {
"action": "Ẩn người này"
"action_false": "Ẩn người này",
"action_true": "Bỏ ẩn người dùng"
},
"block": {
"action": "Chặn người này"
"action_false": "Chặn người này",
"action_true": "Bỏ chặn người dùng"
},
"reports": {
"action": "Báo cáo"
@ -59,12 +61,12 @@
}
},
"mute": {
"action-muted_false": "Ẩn tút này",
"action-muted_true": "Bỏ ẩn tút này"
"action_false": "Ẩn tút này",
"action_true": "Bỏ ẩn tút này"
},
"pin": {
"action-pinned_false": "Tút ghim",
"action-pinned_true": "Bỏ ghim tút"
"action_false": "Tút ghim",
"action_true": "Bỏ ghim tút"
}
}
}

View File

@ -139,7 +139,7 @@
},
"expiration": {
"expired": "Đã kết thúc",
"until": "Kết thúc sau <0 />"
"until": "Kết thúc <0 />"
}
}
}

View File

@ -78,9 +78,7 @@
}
},
"fontSize": {
"showcase": "Xem trước",
"demo": "<p>Đây là một tút mẫu 😊 Bạn có thể chọn một trong nhiều lựa chọn bên dưới.<br /><br />Tùy chọn này chỉ áp dụng cho nội dung tút chứ không ảnh hưởng những phần tử khác của app.</p>",
"availableSizes": "Kích cỡ",
"sizes": {
"S": "S",
"M": "M - Mặc định",

View File

@ -8,6 +8,7 @@ export default {
screenImageViewer: require('./screens/imageViewer'),
screenTabs: require('./screens/tabs'),
componentContextMenu: require('./components/contextMenu'),
componentEmojis: require('./components/emojis'),
componentInstance: require('./components/instance'),
componentMediaSelector: require('./components/mediaSelector'),

View File

@ -3,10 +3,12 @@
"account": {
"title": "用户操作",
"mute": {
"action": "静音用户"
"action_false": "静音用户",
"action_true": "取消静音用户"
},
"block": {
"action": "屏蔽用户"
"action_false": "屏蔽用户",
"action_true": "取消屏蔽用户"
},
"reports": {
"action": "举报用户"
@ -59,12 +61,12 @@
}
},
"mute": {
"action-muted_false": "静音嘟文及回复",
"action-muted_true": "取消静音嘟文及回复"
"action_false": "静音嘟文及回复",
"action_true": "取消静音嘟文及回复"
},
"pin": {
"action-pinned_false": "置顶嘟文",
"action-pinned_true": "取消置顶嘟文"
"action_false": "置顶嘟文",
"action_true": "取消置顶嘟文"
}
}
}

View File

@ -78,9 +78,7 @@
}
},
"fontSize": {
"showcase": "嘟文示例",
"demo": "<p>这是一条测试用的嘟文😊。以下是可供选择的字号,从小号至超大号。<br /><br />这个设置仅会调整嘟文的正文字号,不影响其它字号。</p>",
"availableSizes": "可选字号",
"sizes": {
"S": "小号",
"M": "默认",

View File

@ -3,10 +3,12 @@
"account": {
"title": "",
"mute": {
"action": ""
"action_false": "",
"action_true": ""
},
"block": {
"action": ""
"action_false": "",
"action_true": ""
},
"reports": {
"action": ""
@ -59,12 +61,12 @@
}
},
"mute": {
"action-muted_false": "",
"action-muted_true": ""
"action_false": "",
"action_true": ""
},
"pin": {
"action-pinned_false": "",
"action-pinned_true": ""
"action_false": "",
"action_true": ""
}
}
}

View File

@ -78,9 +78,7 @@
}
},
"fontSize": {
"showcase": "嘟文範例",
"demo": "",
"availableSizes": "",
"sizes": {
"S": "",
"M": "",

View File

@ -15,8 +15,15 @@ import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useCallback, useEffect, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { FormattedRelativeTime } from 'react-intl'
import { Dimensions, Platform, Pressable, StyleSheet, View } from 'react-native'
import {
Dimensions,
NativeScrollEvent,
NativeSyntheticEvent,
Platform,
Pressable,
StyleSheet,
View
} from 'react-native'
import { Circle } from 'react-native-animated-spinkit'
import FastImage from 'react-native-fast-image'
import { FlatList, ScrollView } from 'react-native-gesture-handler'
@ -92,9 +99,7 @@ const ScreenAnnouncements: React.FC<
>
<Trans
i18nKey='screenAnnouncements:content.published'
components={[
<RelativeTime type='past' time={item.published_at} />
]}
components={[<RelativeTime time={item.published_at} />]}
/>
</CustomText>
<ScrollView
@ -218,7 +223,7 @@ const ScreenAnnouncements: React.FC<
contentOffset: { x },
layoutMeasurement: { width }
}
}) => {
}: NativeSyntheticEvent<NativeScrollEvent>) => {
setIndex(Math.floor(x / width))
},
[]

View File

@ -150,7 +150,7 @@ const ScreenCompose: React.FC<RootStackScreenProps<'Screen-Compose'>> = ({
for (const m of params.media) {
uploadAttachment({
composeDispatch,
media: { ...m, width: 100, height: 100 }
media: { uri: m.uri, fileName: 'temp.jpg', type: m.mime }
})
}
}

View File

@ -47,10 +47,6 @@ const ComposeDraftsListRoot: React.FC<Props> = ({ timestamp }) => {
const [checkingAttachments, setCheckingAttachments] = useState(false)
const removeDraft = useCallback(ts => {
dispatch(removeInstanceDraft(ts))
}, [])
const renderItem = useCallback(
({ item }: { item: ComposeStateDraft }) => {
return (
@ -144,7 +140,7 @@ const ComposeDraftsListRoot: React.FC<Props> = ({ timestamp }) => {
}}
source={{
uri:
attachment.local?.local_thumbnail ||
attachment.local?.thumbnail ||
attachment.remote?.preview_url
}}
/>
@ -157,38 +153,6 @@ const ComposeDraftsListRoot: React.FC<Props> = ({ timestamp }) => {
},
[theme]
)
const renderHiddenItem = useCallback(
({ item }) => (
<View
style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
backgroundColor: colors.red
}}
children={
<Pressable
style={{
flexBasis:
StyleConstants.Font.Size.L +
StyleConstants.Spacing.Global.PagePadding * 4,
justifyContent: 'center',
alignItems: 'center'
}}
onPress={() => removeDraft(item.timestamp)}
children={
<Icon
name='Trash'
size={StyleConstants.Font.Size.L}
color={colors.primaryOverlay}
/>
}
/>
}
/>
),
[theme]
)
return (
<>
@ -220,7 +184,35 @@ const ComposeDraftsListRoot: React.FC<Props> = ({ timestamp }) => {
<SwipeListView
data={instanceDrafts}
renderItem={renderItem}
renderHiddenItem={renderHiddenItem}
renderHiddenItem={({ item }) => (
<View
style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
backgroundColor: colors.red
}}
children={
<Pressable
style={{
flexBasis:
StyleConstants.Font.Size.L +
StyleConstants.Spacing.Global.PagePadding * 4,
justifyContent: 'center',
alignItems: 'center'
}}
onPress={() => dispatch(removeInstanceDraft(item.timestamp))}
children={
<Icon
name='Trash'
size={StyleConstants.Font.Size.L}
color={colors.primaryOverlay}
/>
}
/>
}
/>
)}
disableRightSwipe={true}
rightOpenValue={-actionWidth}
// previewRowKey={

View File

@ -35,7 +35,7 @@ const ComposeEditAttachmentRoot: React.FC<Props> = ({ index }) => {
video.local
? ({
url: video.local.uri,
preview_url: video.local.local_thumbnail,
preview_url: video.local.thumbnail,
blurhash: video.remote?.blurhash
} as Mastodon.AttachmentVideo)
: (video.remote as Mastodon.AttachmentVideo)

View File

@ -4,13 +4,7 @@ import { useSearchQuery } from '@utils/queryHooks/search'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import { chunk, forEach, groupBy, sortBy } from 'lodash'
import React, {
useCallback,
useContext,
useEffect,
useMemo,
useRef
} from 'react'
import React, { useContext, useEffect, useMemo, useRef } from 'react'
import {
AccessibilityInfo,
findNodeHandle,
@ -147,35 +141,25 @@ const ComposeRoot = React.memo(
}
}, [isFetching])
const listItem = useCallback(
({ item }) => (
<ComposeRootSuggestion
item={item}
composeState={composeState}
composeDispatch={composeDispatch}
/>
),
[composeState]
)
const ListFooter = useCallback(
() => (
<ComposeRootFooter
accessibleRefAttachments={accessibleRefAttachments}
accessibleRefEmojis={accessibleRefEmojis}
/>
),
[]
)
return (
<View style={styles.base}>
<FlatList
renderItem={listItem}
renderItem={({ item }) => (
<ComposeRootSuggestion
item={item}
composeState={composeState}
composeDispatch={composeDispatch}
/>
)}
ListEmptyComponent={listEmpty}
keyboardShouldPersistTaps='always'
ListHeaderComponent={ComposeRootHeader}
ListFooterComponent={ListFooter}
ListFooterComponent={() => (
<ComposeRootFooter
accessibleRefAttachments={accessibleRefAttachments}
accessibleRefEmojis={accessibleRefEmojis}
/>
)}
ItemSeparatorComponent={ComponentSeparator}
// @ts-ignore
data={data ? data[composeState.tag?.type] : undefined}

View File

@ -56,9 +56,12 @@ const ComposeAttachments: React.FC<Props> = ({ accessibleRefAttachments }) => {
})
}, [composeState.attachments.sensitive])
const calculateWidth = useCallback(item => {
const calculateWidth = useCallback((item: ExtendedAttachment) => {
if (item.local) {
return (item.local.width / item.local.height) * DEFAULT_HEIGHT
return (
((item.local.width || 100) / (item.local.height || 100)) *
DEFAULT_HEIGHT
)
} else {
if (item.remote) {
if (item.remote.meta.original.aspect) {
@ -135,7 +138,7 @@ const ComposeAttachments: React.FC<Props> = ({ accessibleRefAttachments }) => {
<FastImage
style={{ width: '100%', height: '100%' }}
source={{
uri: item.local?.local_thumbnail || item.remote?.preview_url
uri: item.local?.thumbnail || item.remote?.preview_url
}}
/>
{item.remote?.meta?.original?.duration ? (

View File

@ -42,22 +42,6 @@ const ComposeEmojis: React.FC<Props> = ({ accessibleRefEmojis }) => {
}
}, [composeState.emoji.active])
const listHeader = useCallback(
({ section: { title } }) => (
<CustomText
fontStyle='S'
style={{
position: 'absolute',
left: StyleConstants.Spacing.L,
color: colors.secondary
}}
>
{title}
</CustomText>
),
[]
)
const listItem = useCallback(
({ index, item }: { item: Mastodon.Emoji[]; index: number }) => {
return (
@ -155,7 +139,18 @@ const ComposeEmojis: React.FC<Props> = ({ accessibleRefEmojis }) => {
keyboardShouldPersistTaps='always'
sections={composeState.emoji.emojis || []}
keyExtractor={item => item[0].shortcode}
renderSectionHeader={listHeader}
renderSectionHeader={({ section: { title } }) => (
<CustomText
fontStyle='S'
style={{
position: 'absolute',
left: StyleConstants.Spacing.L,
color: colors.secondary
}}
>
{title}
</CustomText>
)}
renderItem={listItem}
windowSize={2}
/>

View File

@ -7,7 +7,7 @@ import { ActionSheetOptions } from '@expo/react-native-action-sheet'
import i18next from 'i18next'
import apiInstance from '@api/instance'
import mediaSelector from '@components/mediaSelector'
import { ImageOrVideo } from 'react-native-image-crop-picker'
import { Asset } from 'react-native-image-picker'
export interface Props {
composeDispatch: Dispatch<ComposeAction>
@ -22,46 +22,40 @@ export const uploadAttachment = async ({
media
}: {
composeDispatch: Dispatch<ComposeAction>
media: { uri: string } & Pick<ImageOrVideo, 'mime' | 'width' | 'height'>
media: Required<Pick<Asset, 'uri' | 'type' | 'fileName'>>
}) => {
const hash = await Crypto.digestStringAsync(
Crypto.CryptoDigestAlgorithm.SHA256,
media.uri + Math.random()
)
switch (media.mime.split('/')[0]) {
switch (media.type.split('/')[0]) {
case 'image':
composeDispatch({
type: 'attachment/upload/start',
payload: {
local: { ...media, type: 'image', local_thumbnail: media.uri, hash },
local: { ...media, thumbnail: media.uri, hash },
uploading: true
}
})
break
case 'video':
VideoThumbnails.getThumbnailAsync(media.uri)
.then(({ uri, width, height }) =>
.then(({ uri, width, height }) => {
console.log('new', uri, width, height)
composeDispatch({
type: 'attachment/upload/start',
payload: {
local: {
...media,
type: 'video',
local_thumbnail: uri,
hash,
width,
height
},
local: { ...media, thumbnail: uri, hash, width, height },
uploading: true
}
})
)
})
.catch(() =>
composeDispatch({
type: 'attachment/upload/start',
payload: {
local: { ...media, type: 'video', hash },
local: { ...media, hash },
uploading: true
}
})
@ -71,7 +65,7 @@ export const uploadAttachment = async ({
composeDispatch({
type: 'attachment/upload/start',
payload: {
local: { ...media, type: 'unknown', hash },
local: { ...media, hash },
uploading: true
}
})
@ -102,8 +96,8 @@ export const uploadAttachment = async ({
const formData = new FormData()
formData.append('file', {
uri: media.uri,
name: media.uri.match(new RegExp(/.*\/(.*)/))?.[1] || 'file.jpg',
type: media.mime
name: media.fileName,
type: media.type
} as any)
return apiInstance<Mastodon.Attachment>({
@ -140,7 +134,8 @@ const chooseAndUploadAttachment = async ({
showActionSheetWithOptions
})
for (const media of result) {
uploadAttachment({ composeDispatch, media })
const requiredMedia = media as Required<Asset>
uploadAttachment({ composeDispatch, media: requiredMedia })
await new Promise(res => setTimeout(res, 500))
}
}

View File

@ -1,9 +1,12 @@
import CustomText from '@components/Text'
import { getSettingsFontsize } from '@utils/slices/settingsSlice'
import { StyleConstants } from '@utils/styles/constants'
import { adaptiveScale } from '@utils/styles/scaling'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { TextInput } from 'react-native'
import { useSelector } from 'react-redux'
import formatText from '../../formatText'
import ComposeContext from '../../utils/createContext'
@ -12,6 +15,16 @@ const ComposeSpoilerInput: React.FC = () => {
const { t } = useTranslation('screenCompose')
const { colors, mode } = useTheme()
const adaptiveFontsize = useSelector(getSettingsFontsize)
const adaptedFontsize = adaptiveScale(
StyleConstants.Font.Size.M,
adaptiveFontsize
)
const adaptedLineheight = adaptiveScale(
StyleConstants.Font.LineHeight.M,
adaptiveFontsize
)
return (
<TextInput
keyboardAppearance={mode}
@ -23,7 +36,9 @@ const ComposeSpoilerInput: React.FC = () => {
marginRight: StyleConstants.Spacing.Global.PagePadding,
borderBottomWidth: 0.5,
color: colors.primaryDefault,
borderBottomColor: colors.border
borderBottomColor: colors.border,
fontSize: adaptedFontsize,
lineHeight: adaptedLineheight
}}
autoCapitalize='none'
autoCorrect={false}

View File

@ -1,7 +1,9 @@
import CustomText from '@components/Text'
import PasteInput, { PastedFile } from '@mattermost/react-native-paste-input'
import { getInstanceConfigurationStatusMaxAttachments } from '@utils/slices/instancesSlice'
import { getSettingsFontsize } from '@utils/slices/settingsSlice'
import { StyleConstants } from '@utils/styles/constants'
import { adaptiveScale } from '@utils/styles/scaling'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
@ -21,6 +23,16 @@ const ComposeTextInput: React.FC = () => {
() => true
)
const adaptiveFontsize = useSelector(getSettingsFontsize)
const adaptedFontsize = adaptiveScale(
StyleConstants.Font.Size.M,
adaptiveFontsize
)
const adaptedLineheight = adaptiveScale(
StyleConstants.Font.LineHeight.M,
adaptiveFontsize
)
return (
<PasteInput
keyboardAppearance={mode}
@ -31,7 +43,9 @@ const ComposeTextInput: React.FC = () => {
marginLeft: StyleConstants.Spacing.Global.PagePadding,
marginRight: StyleConstants.Spacing.Global.PagePadding,
color: colors.primaryDefault,
borderBottomColor: colors.border
borderBottomColor: colors.border,
fontSize: adaptedFontsize,
lineHeight: adaptedLineheight
}}
autoFocus
enablesReturnKeyAutomatically
@ -87,15 +101,7 @@ const ComposeTextInput: React.FC = () => {
}
for (const file of files) {
uploadAttachment({
composeDispatch,
media: {
uri: file.uri,
mime: file.type,
width: 100,
height: 100
}
})
uploadAttachment({ composeDispatch, media: file })
}
}}
>

View File

@ -1,12 +1,8 @@
import { ImageOrVideo } from 'react-native-image-crop-picker'
import { Asset } from 'react-native-image-picker'
export type ExtendedAttachment = {
remote?: Mastodon.Attachment
local?: { uri: string } & Pick<ImageOrVideo, 'width' | 'height' | 'mime'> & {
type: 'image' | 'video' | 'unknown'
local_thumbnail?: string
hash?: string
}
local?: Asset & { thumbnail?: string; hash: string }
uploading?: boolean
}
@ -121,10 +117,7 @@ export type ComposeAction =
}
| {
type: 'attachment/upload/end'
payload: {
remote: Mastodon.Attachment
local: { uri: string } & Pick<ImageOrVideo, 'width' | 'height' | 'mime'>
}
payload: { remote: Mastodon.Attachment; local: Asset }
}
| {
type: 'attachment/upload/fail'

View File

@ -50,11 +50,9 @@ const usePanResponder = ({
onLongPress,
delayLongPress,
onRequestClose
}: Props): Readonly<[
GestureResponderHandlers,
Animated.Value,
Animated.ValueXY
]> => {
}: Props): Readonly<
[GestureResponderHandlers, Animated.Value, Animated.ValueXY]
> => {
let numberInitialTouches = 1
let initialTouches: NativeTouchEvent[] = []
let currentScale = initialScale
@ -137,6 +135,7 @@ const usePanResponder = ({
if (gestureState.numberActiveTouches > 1) return
// @ts-ignore
longPressHandlerRef = setTimeout(onLongPress, delayLongPress)
},
onStart: (
@ -150,6 +149,7 @@ const usePanResponder = ({
const tapTS = Date.now()
!timer &&
// @ts-ignore
(timer = setTimeout(() => onRequestClose(), DOUBLE_TAP_DELAY + 50))
// Handle double tap event by calculating diff between first and second taps timestamps
@ -158,6 +158,7 @@ const usePanResponder = ({
)
if (doubleTapToZoomEnabled && isDoubleTapPerformed) {
// @ts-ignore
clearTimeout(timer)
const isScaled = currentTranslate.x !== initialTranslate.x // currentScale !== initialScale;
const { pageX: touchX, pageY: touchY } = event.nativeEvent.touches[0]
@ -291,9 +292,8 @@ const usePanResponder = ({
if (isTapGesture && currentScale > initialScale) {
const { x, y } = currentTranslate
const { dx, dy } = gestureState
const [topBound, leftBound, bottomBound, rightBound] = getBounds(
currentScale
)
const [topBound, leftBound, bottomBound, rightBound] =
getBounds(currentScale)
let nextTranslateX = x + dx
let nextTranslateY = y + dy
@ -357,9 +357,8 @@ const usePanResponder = ({
if (tmpTranslate) {
const { x, y } = tmpTranslate
const [topBound, leftBound, bottomBound, rightBound] = getBounds(
currentScale
)
const [topBound, leftBound, bottomBound, rightBound] =
getBounds(currentScale)
let nextTranslateX = x
let nextTranslateY = y

View File

@ -44,6 +44,7 @@ export const getImageStyles = (
const transform = translate.getTranslateTransform()
if (scale) {
// @ts-ignore
transform.push({ scale }, { perspective: new Animated.Value(1000) })
}

View File

@ -1,10 +1,7 @@
import GracefullyImage from '@components/GracefullyImage'
import haptics from '@components/haptics'
import Icon from '@components/Icon'
import {
BottomTabNavigationOptions,
createBottomTabNavigator
} from '@react-navigation/bottom-tabs'
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
import { useAppDispatch } from '@root/store'
import {
RootStackScreenProps,
@ -15,10 +12,7 @@ import {
getInstanceAccount,
getInstanceActive
} from '@utils/slices/instancesSlice'
import {
getVersionUpdate,
retriveVersionLatest
} from '@utils/slices/appSlice'
import { getVersionUpdate, retriveVersionLatest } from '@utils/slices/appSlice'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useCallback, useEffect, useMemo } from 'react'
import { Platform } from 'react-native'
@ -32,7 +26,7 @@ const Tab = createBottomTabNavigator<ScreenTabsStackParamList>()
const ScreenTabs = React.memo(
({ navigation }: RootStackScreenProps<'Screen-Tabs'>) => {
const { colors, theme } = useTheme()
const { colors } = useTheme()
const instanceActive = useSelector(getInstanceActive)
const instanceAccount = useSelector(
@ -40,57 +34,6 @@ const ScreenTabs = React.memo(
(prev, next) => prev?.avatarStatic === next?.avatarStatic
)
const screenOptions = useCallback(
({ route }): BottomTabNavigationOptions => ({
headerShown: false,
tabBarActiveTintColor: colors.primaryDefault,
tabBarInactiveTintColor: colors.secondary,
tabBarShowLabel: false,
...(Platform.OS === 'android' && { tabBarHideOnKeyboard: true }),
tabBarStyle: { display: instanceActive !== -1 ? 'flex' : 'none' },
tabBarIcon: ({
focused,
color,
size
}: {
focused: boolean
color: string
size: number
}) => {
switch (route.name) {
case 'Tab-Local':
return <Icon name='Home' size={size} color={color} />
case 'Tab-Public':
return <Icon name='Globe' size={size} color={color} />
case 'Tab-Compose':
return <Icon name='Plus' size={size} color={color} />
case 'Tab-Notifications':
return <Icon name='Bell' size={size} color={color} />
case 'Tab-Me':
return (
<GracefullyImage
key={instanceAccount?.avatarStatic}
uri={{ original: instanceAccount?.avatarStatic }}
dimension={{
width: size,
height: size
}}
style={{
borderRadius: size,
overflow: 'hidden',
borderWidth: focused ? 2 : 0,
borderColor: focused ? colors.secondary : color
}}
/>
)
default:
return <Icon name='AlertOctagon' size={size} color={color} />
}
}
}),
[instanceAccount?.avatarStatic, instanceActive, theme]
)
const composeListeners = useMemo(
() => ({
tabPress: (e: any) => {
@ -132,7 +75,53 @@ const ScreenTabs = React.memo(
return (
<Tab.Navigator
initialRouteName={instanceActive !== -1 ? previousTab : 'Tab-Me'}
screenOptions={screenOptions}
screenOptions={({ route }) => ({
headerShown: false,
tabBarActiveTintColor: colors.primaryDefault,
tabBarInactiveTintColor: colors.secondary,
tabBarShowLabel: false,
...(Platform.OS === 'android' && { tabBarHideOnKeyboard: true }),
tabBarStyle: { display: instanceActive !== -1 ? 'flex' : 'none' },
tabBarIcon: ({
focused,
color,
size
}: {
focused: boolean
color: string
size: number
}) => {
switch (route.name) {
case 'Tab-Local':
return <Icon name='Home' size={size} color={color} />
case 'Tab-Public':
return <Icon name='Globe' size={size} color={color} />
case 'Tab-Compose':
return <Icon name='Plus' size={size} color={color} />
case 'Tab-Notifications':
return <Icon name='Bell' size={size} color={color} />
case 'Tab-Me':
return (
<GracefullyImage
key={instanceAccount?.avatarStatic}
uri={{ original: instanceAccount?.avatarStatic }}
dimension={{
width: size,
height: size
}}
style={{
borderRadius: size,
overflow: 'hidden',
borderWidth: focused ? 2 : 0,
borderColor: focused ? colors.secondary : color
}}
/>
)
default:
return <Icon name='AlertOctagon' size={size} color={color} />
}
}
})}
>
<Tab.Screen name='Tab-Local' component={TabLocal} />
<Tab.Screen name='Tab-Public' component={TabPublic} />

Some files were not shown because too many files have changed in this diff Show More