This commit is contained in:
xmflsct 2022-12-19 23:06:39 +01:00
parent ed71f86983
commit 72fa8c4fcf
9 changed files with 85 additions and 61 deletions

View File

@ -56,7 +56,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
useEffect(() => {
const screenshotListener = addScreenshotListener(() =>
Alert.alert(t('screenshot.title'), t('screenshot.message'), [
{ text: t('screenshot.button'), style: 'destructive' }
{ text: t('common:buttons.confirm'), style: 'destructive' }
])
)
Platform.select({ ios: screenshotListener })

View File

@ -4,8 +4,8 @@ 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, { useMemo } from 'react'
import { Platform, StyleSheet, TextStyle } from 'react-native'
import React from 'react'
import { Platform, TextStyle } from 'react-native'
import FastImage from 'react-native-fast-image'
import { useSelector } from 'react-redux'
import validUrl from 'valid-url'
@ -36,23 +36,19 @@ const ParseEmojis = React.memo(
)
const { colors, theme } = useTheme()
const styles = useMemo(() => {
return StyleSheet.create({
text: {
color: colors.primaryDefault,
fontSize: adaptedFontsize,
lineHeight: adaptedLineheight
},
image: {
width: adaptedFontsize,
height: adaptedFontsize,
...(Platform.OS === 'android' && { transform: [{ translateY: 2 }] })
}
})
}, [theme, adaptiveFontsize])
return (
<CustomText style={[styles.text, style]} fontWeight={fontBold ? 'Bold' : undefined}>
<CustomText
style={[
{
color: colors.primaryDefault,
fontSize: adaptedFontsize,
lineHeight: adaptedLineheight
},
style
]}
fontWeight={fontBold ? 'Bold' : undefined}
>
{emojis ? (
content
.split(regexEmoji)
@ -73,7 +69,14 @@ const ParseEmojis = React.memo(
return (
<CustomText key={emojiShortcode + i}>
{i === 0 ? ' ' : undefined}
<FastImage source={{ uri }} style={styles.image} />
<FastImage
source={{ uri }}
style={{
width: adaptedFontsize,
height: adaptedFontsize,
transform: [{ translateY: Platform.OS === 'ios' ? -1 : 2 }]
}}
/>
</CustomText>
)
} else {

View File

@ -135,7 +135,7 @@ const renderNode = ({
size={adaptedFontsize}
style={{
marginLeft: StyleConstants.Spacing.XS,
...(Platform.OS === 'android' && { transform: [{ translateY: 2 }] })
transform: [{ translateY: Platform.OS === 'ios' ? -1 : 2 }]
}}
/>
) : null}

View File

@ -16,7 +16,7 @@ import {
import { getInstanceAccount } from '@utils/slices/instancesSlice'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Platform } from 'react-native'
import { Alert, Platform } from 'react-native'
import { useQueryClient } from '@tanstack/react-query'
import { useSelector } from 'react-redux'
@ -186,12 +186,22 @@ const menuAccount = ({
key: 'account-block',
item: {
onSelect: () =>
timelineMutation.mutate({
type: 'updateAccountProperty',
queryKey,
id: account.id,
payload: { property: 'block', currentValue: data?.blocking }
}),
Alert.alert(t('account.block.alert.title', { username: account.username }), undefined, [
{
text: t('common:buttons.confirm'),
style: 'destructive',
onPress: () =>
timelineMutation.mutate({
type: 'updateAccountProperty',
queryKey,
id: account.id,
payload: { property: 'block', currentValue: data?.blocking }
})
},
{
text: t('common:buttons.cancel')
}
]),
disabled: Platform.OS !== 'android' ? !data || !isFetched : false,
destructive: !data?.blocking,
hidden: false
@ -204,20 +214,34 @@ const menuAccount = ({
{
key: 'account-reports',
item: {
onSelect: () => {
timelineMutation.mutate({
type: 'updateAccountProperty',
queryKey,
id: account.id,
payload: { property: 'reports' }
})
timelineMutation.mutate({
type: 'updateAccountProperty',
queryKey,
id: account.id,
payload: { property: 'block', currentValue: false }
})
},
onSelect: () =>
Alert.alert(
t('account.reports.alert.title', { username: account.username }),
undefined,
[
{
text: t('common:buttons.confirm'),
style: 'destructive',
onPress: () => {
timelineMutation.mutate({
type: 'updateAccountProperty',
queryKey,
id: account.id,
payload: { property: 'reports' }
})
timelineMutation.mutate({
type: 'updateAccountProperty',
queryKey,
id: account.id,
payload: { property: 'block', currentValue: false }
})
}
},
{
text: t('common:buttons.cancel')
}
]
),
disabled: false,
destructive: true,
hidden: false

View File

@ -49,7 +49,7 @@ const menuInstance = ({
t('instance.block.alert.message'),
[
{
text: t('instance.block.alert.buttons.confirm'),
text: t('common:buttons.confirm'),
style: 'destructive',
onPress: () => {
mutation.mutate({

View File

@ -109,7 +109,7 @@ const menuStatus = ({
onSelect: () =>
Alert.alert(t('status.deleteEdit.alert.title'), t('status.deleteEdit.alert.message'), [
{
text: t('status.deleteEdit.alert.buttons.confirm'),
text: t('common:buttons.confirm'),
style: 'destructive',
onPress: async () => {
let replyToStatus: Mastodon.Status | undefined = undefined
@ -153,7 +153,7 @@ const menuStatus = ({
onSelect: () =>
Alert.alert(t('status.delete.alert.title'), t('status.delete.alert.message'), [
{
text: t('status.delete.alert.buttons.confirm'),
text: t('common:buttons.confirm'),
style: 'destructive',
onPress: async () => {
mutation.mutate({

View File

@ -7,7 +7,8 @@
"continue": "Continue",
"create": "Create",
"delete": "Delete",
"done": "Done"
"done": "Done",
"confirm": "Confirm"
},
"customEmoji": {
"accessibilityLabel": "Custom emoji {{emoji}}"

View File

@ -13,10 +13,16 @@
},
"block": {
"action_false": "Block user",
"action_true": "Unblock user"
"action_true": "Unblock user",
"alert": {
"title": "Confirm blocking user @{{username}} ?"
}
},
"reports": {
"action": "Report and block user"
"action": "Report and block user",
"alert": {
"title": "Confirm report and blocking user @{{username}} ?"
}
}
},
"at": {
@ -33,10 +39,7 @@
"action": "Block instance {{instance}}",
"alert": {
"title": "Confirm blocking instance {{instance}} ?",
"message": "Mostly you can mute or block certain user.\n\nAfter blocking instance, all its content including followers from this instance will be removed!",
"buttons": {
"confirm": "Confirm"
}
"message": "Mostly you can mute or block certain user.\n\nAfter blocking instance, all its content including followers from this instance will be removed!"
}
}
},
@ -57,20 +60,14 @@
"action": "Delete toot",
"alert": {
"title": "Confirm deleting?",
"message": "All boosts and favourites will be cleared, including all replies.",
"buttons": {
"confirm": "Confirm"
}
"message": "All boosts and favourites will be cleared, including all replies."
}
},
"deleteEdit": {
"action": "Delete toot and repost",
"alert": {
"title": "Confirm deleting and repost?",
"message": "All boosts and favourites will be cleared, including all replies.",
"buttons": {
"confirm": "Confirm"
}
"message": "All boosts and favourites will be cleared, including all replies."
}
},
"mute": {

View File

@ -1,8 +1,7 @@
{
"screenshot": {
"title": "Privacy Protection",
"message": "Please do not disclose other user's identity, such as username, avatar, etc. Thank you!",
"button": "Confirm"
"message": "Please do not disclose other user's identity, such as username, avatar, etc. Thank you!"
},
"localCorrupt": {
"message": "Login expired, please login again"