Chore: evaluate SettingsView (#4090)

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Gerzon Z 2022-05-10 17:19:06 -04:00 committed by GitHub
parent e0bfdee70c
commit 9320d1e05e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -142,13 +142,13 @@ export default {
SE_CONTACT_US: 'se_contact_us',
SE_CONTACT_US_F: 'se_contact_us_f',
SE_GO_LANGUAGE: 'se_go_language',
SE_REVIEW_THIS_APP: 'se_review_this_app',
SE_REVIEW_THIS_APP_F: 'se_review_this_app_f',
SE_SHARE_THIS_APP: 'se_share_this_app',
SE_GO_DEFAULTBROWSER: 'se_go_default_browser',
SE_GO_THEME: 'se_go_theme',
SE_GO_PROFILE: 'se_go_profile',
SE_GO_SECURITYPRIVACY: 'se_go_securityprivacy',
SE_REVIEW_THIS_APP: 'se_review_this_app',
SE_REVIEW_THIS_APP_F: 'se_review_this_app_f',
SE_SHARE_THIS_APP: 'se_share_this_app',
SE_READ_LICENSE: 'se_read_license',
SE_COPY_APP_VERSION: 'se_copy_app_version',
SE_COPY_SERVER_VERSION: 'se_copy_server_version',

View File

@ -32,13 +32,14 @@ import SidebarView from '../SidebarView';
import { clearCache } from '../../lib/methods';
import { Services } from '../../lib/services';
type TLogScreenName = 'SE_GO_LANGUAGE' | 'SE_GO_DEFAULTBROWSER' | 'SE_GO_THEME' | 'SE_GO_PROFILE' | 'SE_GO_SECURITYPRIVACY';
interface ISettingsViewProps extends IBaseScreen<SettingsStackParamList, 'SettingsView'> {
server: IServer;
isMasterDetail: boolean;
user: IUser;
}
class SettingsView extends React.Component<ISettingsViewProps, any> {
class SettingsView extends React.Component<ISettingsViewProps> {
static navigationOptions = ({ navigation, isMasterDetail }: ISettingsViewProps): StackNavigationOptions => ({
headerLeft: () =>
isMasterDetail ? (
@ -54,7 +55,7 @@ class SettingsView extends React.Component<ISettingsViewProps, any> {
const db = database.servers;
const usersCollection = db.get('users');
try {
const userRecord: any = await usersCollection.find(user.id);
const userRecord = await usersCollection.find(user.id);
if (userRecord.isFromWebView) {
showConfirmationAlert({
title: I18n.t('Clear_cookies_alert'),
@ -107,15 +108,15 @@ class SettingsView extends React.Component<ISettingsViewProps, any> {
};
navigateToScreen = (screen: keyof SettingsStackParamList) => {
/* @ts-ignore */
logEvent(events[`SE_GO_${screen.replace('View', '').toUpperCase()}`]);
const screenName = screen.replace('View', '').toUpperCase();
logEvent(events[`SE_GO_${screenName}` as TLogScreenName]);
const { navigation } = this.props;
navigation.navigate(screen);
};
sendEmail = async () => {
logEvent(events.SE_CONTACT_US);
const subject = encodeURI('React Native App Support');
const subject = encodeURI('Rocket.Chat Mobile App Support');
const email = encodeURI('support@rocket.chat');
const description = encodeURI(`
version: ${getReadableVersion}