Feat: Adds the Info snackbar when the About info is copied (#7488)

* feat: adding the snackbar when the version info was copied

* fix: PR review
This commit is contained in:
Lucas Reis 2023-08-08 03:40:30 -03:00 committed by GitHub
parent 4767c28ae4
commit 833a0fc028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -8,6 +8,7 @@ export const SNACK_BAR_TYPE = keyMirror({
ADD_CHANNEL_MEMBERS: null,
FAVORITE_CHANNEL: null,
FOLLOW_THREAD: null,
INFO_COPIED: null,
LINK_COPIED: null,
MESSAGE_COPIED: null,
MUTE_CHANNEL: null,
@ -43,6 +44,12 @@ export const SNACK_BAR_CONFIG: Record<string, SnackBarConfig> = {
iconName: 'check',
canUndo: true,
},
INFO_COPIED: {
id: t('snack.bar.info.copied'),
defaultMessage: 'Info copied to clipboard',
iconName: 'content-copy',
canUndo: false,
},
LINK_COPIED: {
id: t('snack.bar.link.copied'),
defaultMessage: 'Link copied to clipboard',

View file

@ -13,11 +13,13 @@ import CompassIcon from '@components/compass_icon';
import FormattedText from '@components/formatted_text';
import SettingContainer from '@components/settings/container';
import AboutLinks from '@constants/about_links';
import {SNACK_BAR_TYPE} from '@constants/snack_bar';
import {useTheme} from '@context/theme';
import useAndroidHardwareBackHandler from '@hooks/android_back_handler';
import {t} from '@i18n';
import {popTopScreen} from '@screens/navigation';
import {buttonBackgroundStyle, buttonTextStyle} from '@utils/buttonStyles';
import {showSnackBar} from '@utils/snack_bar';
import {preventDoubleTap} from '@utils/tap';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
import {typography} from '@utils/typography';
@ -180,6 +182,7 @@ const About = ({componentId, config, license}: AboutProps) => {
const databaseSchemaVersion = intl.formatMessage({id: 'settings.about.database.schema', defaultMessage: 'Database Schema Version: {version}'}, {version: config.SchemaVersion});
const copiedString = `${appVersion}\n${server}\n${database}\n${databaseSchemaVersion}`;
Clipboard.setString(copiedString);
showSnackBar({barType: SNACK_BAR_TYPE.INFO_COPIED, sourceScreen: componentId});
},
[intl, config],
);

View file

@ -982,6 +982,7 @@
"snack.bar.channel.members.added": "{numMembers, number} {numMembers, plural, one {member} other {members}} added",
"snack.bar.favorited.channel": "This channel was favorited",
"snack.bar.following.thread": "Thread followed",
"snack.bar.info.copied": "Info copied to clipboard",
"snack.bar.link.copied": "Link copied to clipboard",
"snack.bar.message.copied": "Text copied to clipboard",
"snack.bar.mute.channel": "This channel was muted",