diff --git a/src/Screens.tsx b/src/Screens.tsx index e7430d1f..6febfbde 100644 --- a/src/Screens.tsx +++ b/src/Screens.tsx @@ -56,7 +56,7 @@ const Screens: React.FC = ({ 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 }) diff --git a/src/components/Parse/Emojis.tsx b/src/components/Parse/Emojis.tsx index d9e1e88b..7607f555 100644 --- a/src/components/Parse/Emojis.tsx +++ b/src/components/Parse/Emojis.tsx @@ -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 ( - + {emojis ? ( content .split(regexEmoji) @@ -73,7 +69,14 @@ const ParseEmojis = React.memo( return ( {i === 0 ? ' ' : undefined} - + ) } else { diff --git a/src/components/Parse/HTML.tsx b/src/components/Parse/HTML.tsx index e651a66e..78c18578 100644 --- a/src/components/Parse/HTML.tsx +++ b/src/components/Parse/HTML.tsx @@ -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} diff --git a/src/components/contextMenu/account.ts b/src/components/contextMenu/account.ts index bc2137ea..1b26735a 100644 --- a/src/components/contextMenu/account.ts +++ b/src/components/contextMenu/account.ts @@ -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 diff --git a/src/components/contextMenu/instance.ts b/src/components/contextMenu/instance.ts index 729d2eb0..19355d41 100644 --- a/src/components/contextMenu/instance.ts +++ b/src/components/contextMenu/instance.ts @@ -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({ diff --git a/src/components/contextMenu/status.ts b/src/components/contextMenu/status.ts index 8b3eaae1..650187cf 100644 --- a/src/components/contextMenu/status.ts +++ b/src/components/contextMenu/status.ts @@ -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({ diff --git a/src/i18n/en/common.json b/src/i18n/en/common.json index f2a5a1c6..e8f0f972 100644 --- a/src/i18n/en/common.json +++ b/src/i18n/en/common.json @@ -7,7 +7,8 @@ "continue": "Continue", "create": "Create", "delete": "Delete", - "done": "Done" + "done": "Done", + "confirm": "Confirm" }, "customEmoji": { "accessibilityLabel": "Custom emoji {{emoji}}" diff --git a/src/i18n/en/components/contextMenu.json b/src/i18n/en/components/contextMenu.json index a6b5e27c..caf26e48 100644 --- a/src/i18n/en/components/contextMenu.json +++ b/src/i18n/en/components/contextMenu.json @@ -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": { diff --git a/src/i18n/en/screens.json b/src/i18n/en/screens.json index b60b9e98..7565b7bd 100644 --- a/src/i18n/en/screens.json +++ b/src/i18n/en/screens.json @@ -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"