forked from Ivasoft/mattermost-mobile
* MM_36721 : Added testscript for AppVersion component + Corrected imported Type definition
* Added CompassIcon component
* Adding TextProps to FormattedText component
* Added status bar component
* Added User status component
* Added ProfilePicture, did_update hook and sorted imports
* Added ChannelIcon component
* Added ChannelTitle component
* Added Channel Nav Bar component
* Added channel screen
* Added withSafeAreaInsets HOC and Added font compassIcon to Xcode
* Fix Android crashes as it is looking for MainSidebar and SettingsSidebar
* Revert "Fix Android crashes as it is looking for MainSidebar and SettingsSidebar"
This reverts commit 62ea11ae69.
* Channel Icon clean up
* Updated assets/compass-icons files
* Updated channel title component
* ProfilePicture - Code clean up
* UserStatus component - cleaned
* Channel screen fix
* Fix TS issue
* Update index.tsx
* Removed ProfilePicture component
To be added when needed
* Removed UserStatus component
* Added IS_LANDSCAPE constant
* Code review correction
* Fix ts issue
* Added channel.displayName to reinforce security for findAndObserve on potential null teammate profile
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
* Fix observation on array vs single element
* Refactored ChannelTitle component
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
* Refactored ChannelGuestLabel
* Refactored ChannelDisplayName
* ChannelTitle cleaned up
* Fix roles check
* Removing unused user utils
* Minor clean up
* Fix TS issue
* Code Refactored.
* Fix render bug in channel_display_name
* Added logout button
* refactored code
Co-authored-by: Avinash Lingaloo <>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
77 lines
2.9 KiB
TypeScript
77 lines
2.9 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Alert, AlertButton} from 'react-native';
|
|
|
|
import ViewTypes from '@constants/view';
|
|
import {tryOpenURL} from '@utils/url';
|
|
|
|
export interface FormatObjectType {
|
|
id: string;
|
|
defaultMessage: string;
|
|
}
|
|
|
|
export interface FormatMessageType {
|
|
(obj: FormatObjectType, values?: any): string;
|
|
}
|
|
|
|
export function unsupportedServer(isSystemAdmin: boolean, formatMessage: FormatMessageType) {
|
|
if (isSystemAdmin) {
|
|
return unsupportedServerAdminAlert(formatMessage);
|
|
}
|
|
return unsupportedServerAlert(formatMessage);
|
|
}
|
|
|
|
function unsupportedServerAdminAlert(formatMessage: FormatMessageType) {
|
|
const title = formatMessage({id: 'mobile.server_upgrade.title', defaultMessage: 'Server upgrade required'});
|
|
|
|
const message = formatMessage({
|
|
id: 'mobile.server_upgrade.alert_description',
|
|
defaultMessage: 'This server version is unsupported and users will be exposed to compatibility issues that cause crashes or severe bugs breaking core functionality of the app. Upgrading to server version {serverVersion} or later is required.',
|
|
}, {serverVersion: ViewTypes.RequiredServer.FULL_VERSION});
|
|
|
|
const cancel: AlertButton = {
|
|
text: formatMessage({id: 'mobile.server_upgrade.dismiss', defaultMessage: 'Dismiss'}),
|
|
style: 'default',
|
|
};
|
|
|
|
const learnMore: AlertButton = {
|
|
text: formatMessage({id: 'mobile.server_upgrade.learn_more', defaultMessage: 'Learn More'}),
|
|
style: 'cancel',
|
|
onPress: () => {
|
|
const url = 'https://docs.mattermost.com/administration/release-lifecycle.html';
|
|
const onError = () => {
|
|
Alert.alert(
|
|
formatMessage({id: 'mobile.link.error.title', defaultMessage: 'Error'}),
|
|
formatMessage({id: 'mobile.link.error.text', defaultMessage: 'Unable to open the link.'}),
|
|
);
|
|
};
|
|
|
|
tryOpenURL(url, onError);
|
|
},
|
|
};
|
|
const buttons: AlertButton[] = [cancel, learnMore];
|
|
const options = {cancelable: false};
|
|
|
|
Alert.alert(title, message, buttons, options);
|
|
}
|
|
|
|
function unsupportedServerAlert(formatMessage: FormatMessageType) {
|
|
const title = formatMessage({id: 'mobile.unsupported_server.title', defaultMessage: 'Unsupported server version'});
|
|
|
|
const message = formatMessage({
|
|
id: 'mobile.unsupported_server.message',
|
|
defaultMessage: 'Attachments, link previews, reactions and embed data may not be displayed correctly. If this issue persists contact your System Administrator to upgrade your Mattermost server.',
|
|
});
|
|
|
|
const okButton: AlertButton = {
|
|
text: formatMessage({id: 'mobile.unsupported_server.ok', defaultMessage: 'OK'}),
|
|
style: 'default',
|
|
};
|
|
|
|
const buttons: AlertButton[] = [okButton];
|
|
const options = {cancelable: false};
|
|
|
|
Alert.alert(title, message, buttons, options);
|
|
}
|