mattermost-mobile/app/utils/draft/index.ts
Avinash Lingaloo 0ef1dd44ea
Gekidou about screen (#5591)
* Added about screen

* Remove TS error

* Needs clean up

* Testing login flow

* Converted About screen to functional component

* Improvements

* Sort imports

* Prevents double tapping

* Apply suggestions from code review

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>

* Code clean up

* Adding translation keys

* Added some keys

* Updated AppVersion component

* Missed translation key

Co-authored-by: Avinash Lingaloo <>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2021-08-04 21:48:36 -07:00

35 lines
1.2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {MessageDescriptor} from '@formatjs/intl/src/types';
import {Alert, AlertButton} from 'react-native';
import type {IntlShape} from 'react-intl';
import {t} from '@i18n';
export function errorBadChannel(intl: IntlShape) {
const message = {
id: t('mobile.server_link.unreachable_channel.error'),
defaultMessage: 'This link belongs to a deleted channel or to a channel to which you do not have access.',
};
return alertErrorWithFallback(intl, {}, message);
}
export function permalinkBadTeam(intl: IntlShape) {
const message = {
id: t('mobile.server_link.unreachable_team.error'),
defaultMessage: 'This link belongs to a deleted team or to a team to which you do not have access.',
};
alertErrorWithFallback(intl, {}, message);
}
export function alertErrorWithFallback(intl: IntlShape, error: any, fallback: MessageDescriptor, values?: Record<string, string>, buttons?: AlertButton[]) {
let msg = error?.message;
if (!msg || msg === 'Network request failed') {
msg = intl.formatMessage(fallback, values);
}
Alert.alert('', msg, buttons);
}