1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
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(() => { useEffect(() => {
const screenshotListener = addScreenshotListener(() => const screenshotListener = addScreenshotListener(() =>
Alert.alert(t('screenshot.title'), t('screenshot.message'), [ 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 }) Platform.select({ ios: screenshotListener })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,10 +13,16 @@
}, },
"block": { "block": {
"action_false": "Block user", "action_false": "Block user",
"action_true": "Unblock user" "action_true": "Unblock user",
"alert": {
"title": "Confirm blocking user @{{username}} ?"
}
}, },
"reports": { "reports": {
"action": "Report and block user" "action": "Report and block user",
"alert": {
"title": "Confirm report and blocking user @{{username}} ?"
}
} }
}, },
"at": { "at": {
@ -33,10 +39,7 @@
"action": "Block instance {{instance}}", "action": "Block instance {{instance}}",
"alert": { "alert": {
"title": "Confirm blocking instance {{instance}} ?", "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!", "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"
}
} }
} }
}, },
@ -57,20 +60,14 @@
"action": "Delete toot", "action": "Delete toot",
"alert": { "alert": {
"title": "Confirm deleting?", "title": "Confirm deleting?",
"message": "All boosts and favourites will be cleared, including all replies.", "message": "All boosts and favourites will be cleared, including all replies."
"buttons": {
"confirm": "Confirm"
}
} }
}, },
"deleteEdit": { "deleteEdit": {
"action": "Delete toot and repost", "action": "Delete toot and repost",
"alert": { "alert": {
"title": "Confirm deleting and repost?", "title": "Confirm deleting and repost?",
"message": "All boosts and favourites will be cleared, including all replies.", "message": "All boosts and favourites will be cleared, including all replies."
"buttons": {
"confirm": "Confirm"
}
} }
}, },
"mute": { "mute": {

View File

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