From 469c04e90adab0d5326547f0081caaf3d53b2dac Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Thu, 19 May 2022 23:42:55 -0300 Subject: [PATCH] Chore: Evaluate e2e screens - TypeScript (#4142) --- app/views/E2EEncryptionSecurityView.tsx | 40 +++++++++++-------------- app/views/E2EHowItWorksView.tsx | 18 ++++------- app/views/E2ESaveYourPasswordView.tsx | 10 ++++--- 3 files changed, 28 insertions(+), 40 deletions(-) diff --git a/app/views/E2EEncryptionSecurityView.tsx b/app/views/E2EEncryptionSecurityView.tsx index 8a46468a3..3a3ef18e2 100644 --- a/app/views/E2EEncryptionSecurityView.tsx +++ b/app/views/E2EEncryptionSecurityView.tsx @@ -1,14 +1,13 @@ import React from 'react'; -import { StyleSheet, Text, View, TextInput as TextInputComp } from 'react-native'; +import { StyleSheet, Text, View, TextInput as RNTextInput } from 'react-native'; import { StackNavigationOptions } from '@react-navigation/stack'; import { connect } from 'react-redux'; -import { Dispatch } from 'redux'; import StatusBar from '../containers/StatusBar'; import * as List from '../containers/List'; import I18n from '../i18n'; import log, { events, logEvent } from '../utils/log'; -import { TSupportedThemes, withTheme } from '../theme'; +import { withTheme } from '../theme'; import SafeAreaView from '../containers/SafeAreaView'; import FormTextInput from '../containers/TextInput/FormTextInput'; import Button from '../containers/Button'; @@ -16,14 +15,15 @@ import { getUserSelector } from '../selectors/login'; import { PADDING_HORIZONTAL } from '../containers/List/constants'; import { themes } from '../lib/constants'; import { Encryption } from '../lib/encryption'; -import { logout as logoutAction } from '../actions/login'; +import { logout } from '../actions/login'; import { showConfirmationAlert, showErrorAlert } from '../utils/info'; import EventEmitter from '../utils/events'; import { LISTENER } from '../containers/Toast'; import debounce from '../utils/debounce'; import sharedStyles from './Styles'; -import { IUser } from '../definitions'; +import { IApplicationState, IBaseScreen, IUser } from '../definitions'; import { Services } from '../lib/services'; +import { SettingsStackParamList } from '../stacks/types'; const styles = StyleSheet.create({ container: { @@ -47,12 +47,10 @@ interface IE2EEncryptionSecurityViewState { newPassword: string; } -interface IE2EEncryptionSecurityViewProps { - theme?: TSupportedThemes; +interface IE2EEncryptionSecurityViewProps extends IBaseScreen { user: IUser; server: string; encryptionEnabled: boolean; - logout(): void; } class E2EEncryptionSecurityView extends React.Component { @@ -66,7 +64,7 @@ class E2EEncryptionSecurityView extends React.Component this.setState({ newPassword: text }), 300); - setNewPasswordRef = (ref: TextInputComp) => (this.newPasswordInputRef = ref); + setNewPasswordRef = (ref: RNTextInput) => (this.newPasswordInputRef = ref); changePassword = () => { const { newPassword } = this.state; @@ -107,8 +105,8 @@ class E2EEncryptionSecurityView extends React.Component - + {I18n.t('E2E_encryption_change_password_title')} - + {I18n.t('E2E_encryption_change_password_description')} + {this.renderChangePassword()} - + {I18n.t('E2E_encryption_reset_title')} - + {I18n.t('E2E_encryption_reset_description')}