From 9320d1e05e2f0f2c2285e7edc0de2b132df6a319 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Tue, 10 May 2022 17:19:06 -0400 Subject: [PATCH] Chore: evaluate SettingsView (#4090) Co-authored-by: Diego Mello --- app/utils/log/events.ts | 6 +++--- app/views/SettingsView/index.tsx | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/utils/log/events.ts b/app/utils/log/events.ts index 4b9b7a90d..98b505a73 100644 --- a/app/utils/log/events.ts +++ b/app/utils/log/events.ts @@ -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', diff --git a/app/views/SettingsView/index.tsx b/app/views/SettingsView/index.tsx index f4a6e5c77..7996e1b6f 100644 --- a/app/views/SettingsView/index.tsx +++ b/app/views/SettingsView/index.tsx @@ -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 { server: IServer; - isMasterDetail: boolean; user: IUser; } -class SettingsView extends React.Component { +class SettingsView extends React.Component { static navigationOptions = ({ navigation, isMasterDetail }: ISettingsViewProps): StackNavigationOptions => ({ headerLeft: () => isMasterDetail ? ( @@ -54,7 +55,7 @@ class SettingsView extends React.Component { 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 { }; 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}