diff --git a/native/profile/delete-account.react.js b/native/profile/delete-account.react.js --- a/native/profile/delete-account.react.js +++ b/native/profile/delete-account.react.js @@ -17,6 +17,7 @@ } from 'lib/actions/user-actions'; import { preRequestUserStateSelector } from 'lib/selectors/account-selectors'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors'; +import { accountHasPassword } from 'lib/shared/account-utils'; import type { LogOutResult } from 'lib/types/account-types'; import type { LoadingStatus } from 'lib/types/loading-types'; import type { PreRequestUserState } from 'lib/types/session-types'; @@ -35,6 +36,7 @@ type Props = { // Redux state + +isAccountWithPassword: boolean, +loadingStatus: LoadingStatus, +preRequestUserState: PreRequestUserState, +activeTheme: ?GlobalTheme, @@ -44,16 +46,16 @@ +dispatchActionPromise: DispatchActionPromise, // async functions that hit server APIs +deleteAccount: ( - password: string, + password: ?string, preRequestUserState: PreRequestUserState, ) => Promise, }; type State = { - +password: string, + +password: ?string, }; class DeleteAccount extends React.PureComponent { state: State = { - password: '', + password: null, }; mounted = false; passwordInput: ?React.ElementRef; @@ -74,6 +76,30 @@ Delete account ); const { panelForegroundTertiaryLabel } = this.props.colors; + + let inputPasswordPrompt; + if (this.props.isAccountWithPassword) { + inputPasswordPrompt = ( + <> + PASSWORD + + + + + ); + } return ( - PASSWORD - - - + {inputPasswordPrompt} @@ -239,6 +250,9 @@ const ConnectedDeleteAccount: React.ComponentType<{ ... }> = React.memo<{ ... }>(function ConnectedDeleteAccount() { + const isAccountWithPassword = useSelector(state => + accountHasPassword(state.currentUserInfo), + ); const loadingStatus = useSelector(loadingStatusSelector); const preRequestUserState = useSelector(preRequestUserStateSelector); const activeTheme = useSelector(state => state.globalThemeInfo.activeTheme); @@ -250,6 +264,7 @@ return (